diff --git a/README.md b/README.md index eeeb490328..b7acd7cc3c 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,13 @@ addon | version | maintainers | summary [base_wamas_ubl](base_wamas_ubl/) | 16.0.1.13.0 | | Base module to aggregate WAMAS - UBL features. [despatch_advice_import](despatch_advice_import/) | 16.0.1.2.0 | | Despatch Advice import [despatch_advice_import_ubl](despatch_advice_import_ubl/) | 16.0.1.1.0 | | Import Despatch Advice files +[edi_voxel_account_invoice_oca](edi_voxel_account_invoice_oca/) | 16.0.1.0.2 | [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Sends account invoices to Voxel. +[edi_voxel_oca](edi_voxel_oca/) | 16.0.1.0.0 | [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Base module for connecting with Voxel +[edi_voxel_sale_order_import_oca](edi_voxel_sale_order_import_oca/) | 16.0.1.0.1 | [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Import sale order from Voxel. +[edi_voxel_sale_secondary_unit_oca](edi_voxel_sale_secondary_unit_oca/) | 16.0.1.0.0 | [![ernestotejeda](https://github.com/ernestotejeda.png?size=30px)](https://github.com/ernestotejeda) [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Map Voxel UoM to Sale Secondary UoM and Use Them +[edi_voxel_secondary_unit_oca](edi_voxel_secondary_unit_oca/) | 16.0.1.0.0 | [![ernestotejeda](https://github.com/ernestotejeda.png?size=30px)](https://github.com/ernestotejeda) [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Add Voxel UoM code to Secondary UoM model +[edi_voxel_stock_picking_oca](edi_voxel_stock_picking_oca/) | 16.0.1.0.2 | [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Sends stock picking report to Voxel. +[edi_voxel_stock_picking_secondary_unit_oca](edi_voxel_stock_picking_secondary_unit_oca/) | 16.0.1.0.0 | [![ernestotejeda](https://github.com/ernestotejeda.png?size=30px)](https://github.com/ernestotejeda) [![macagua](https://github.com/macagua.png?size=30px)](https://github.com/macagua) | Export Secondary UoMs Voxel Code in picking Voxel documents [pdf_helper](pdf_helper/) | 16.0.1.1.0 | [![simahawk](https://github.com/simahawk.png?size=30px)](https://github.com/simahawk) [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Provides helpers to work w/ PDFs [sale_order_import](sale_order_import/) | 16.0.1.2.0 | | Import RFQ or sale orders from files [sale_order_import_edifact](sale_order_import_edifact/) | 16.0.1.1.0 | [![rmorant](https://github.com/rmorant.png?size=30px)](https://github.com/rmorant) | EDIFACT/D96A Order diff --git a/edi_voxel_account_invoice_oca/README.rst b/edi_voxel_account_invoice_oca/README.rst new file mode 100644 index 0000000000..d2dc72de92 --- /dev/null +++ b/edi_voxel_account_invoice_oca/README.rst @@ -0,0 +1,135 @@ +========================= +Voxel account invoice oca +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1c182d8e2f9883bdabb69a89cf1911d7fce607f4a01ab61195430fefe6119e7d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github + :target: https://github.com/OCA/edi/tree/16.0/edi_voxel_account_invoice_oca + :alt: OCA/edi +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-edi_voxel_account_invoice_oca + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to send invoices to Voxel. Sending are queued in jobs +running in the background. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module you have to belong to the access group +'Voxel manager' under 'Technical Settings', then: + +#. Open a customer form view. In 'Sales & Purchases' page, + check 'Enable Voxel' if you want to send invoices to this + customer through Voxel. +#. Go to *Settings > Users & Companies > Companies*, open the companies you + want to enable Voxel communication and set 'Enable Voxel' field to True. +#. In the login list, add the corresponding login for connecting with + Voxel to send the invoices. The final URL where the invoices are going + to be sent is '/Outbox'. +#. Save the form and edit it again, find 'invoice login' field and select + the login to be used in the invoice sending. +#. Select also the 'Send mode' to set when the Invoice will be sent: + + * On validate: The invoice will be sent to Voxel automatically when + the invoice is validated. + * At fixed time: The invoice will be sent to Voxel automatically at + a fixed time. + * With delay: The invoice will be sent to Voxel automatically a certain + time after the invoice is validated. + +Note: + +This module enqueue the sending invoices to Voxel in jobs in the background. +To do that it uses queue_job module, so a configuration is required +according to that. +The jobs for sending invoices to Voxel are queued in the channel +``root.voxel_export channel``. +The sending status check jobs are queued in the channel +``root.voxel_status``. + +Usage +===== + +To use this module, you need to: + +#. Go to *Invoicing > Customers > Invoices* and create a + new Invoice or open an existing draft invoice. Make sure that the customer + has 'Enable Voxel' field checkbox (See configuration section). +#. Validate the invoice and it will be send to Voxel immediately or later, + depending on the Voxel 'Send mode' chosen in the company configuration. +#. A new tab will be visible on the invoice form with the label 'Voxel' + to show the information regarding sending the invoice to Voxel. +#. When the report is sent, you will be able to see the XML report in another + tab next to the jobs tab. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Ernesto Tejeda + * Pedro M. Baeza + * Sergio Teruel + +* `Guavana `_: + + * Leonardo J. Caballero G. + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/edi `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/edi_voxel_account_invoice_oca/__init__.py b/edi_voxel_account_invoice_oca/__init__.py new file mode 100644 index 0000000000..f3fa6d832a --- /dev/null +++ b/edi_voxel_account_invoice_oca/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import reports diff --git a/edi_voxel_account_invoice_oca/__manifest__.py b/edi_voxel_account_invoice_oca/__manifest__.py new file mode 100644 index 0000000000..3b85612f6d --- /dev/null +++ b/edi_voxel_account_invoice_oca/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Voxel account invoice oca", + "summary": "Sends account invoices to Voxel.", + "version": "16.0.1.0.0", + "development_status": "Production/Stable", + "category": "Accounting & Finance", + "author": "Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/edi", + "license": "AGPL-3", + "depends": ["edi_voxel_oca", "stock_picking_invoice_link"], + "data": [ + "data/ir_cron_data.xml", + "data/queue_job_function_data.xml", + "views/account_move_views.xml", + "views/report_voxel_invoice.xml", + "views/res_company_view.xml", + "views/res_config_settings_views.xml", + ], + "installable": True, +} diff --git a/edi_voxel_account_invoice_oca/data/ir_cron_data.xml b/edi_voxel_account_invoice_oca/data/ir_cron_data.xml new file mode 100644 index 0000000000..5534794aec --- /dev/null +++ b/edi_voxel_account_invoice_oca/data/ir_cron_data.xml @@ -0,0 +1,16 @@ + + + + + Edi Voxel: Update invoice export status + + code + model._cron_update_voxel_export_status() + + 10 + minutes + -1 + + + diff --git a/edi_voxel_account_invoice_oca/data/queue_job_function_data.xml b/edi_voxel_account_invoice_oca/data/queue_job_function_data.xml new file mode 100644 index 0000000000..94953253e1 --- /dev/null +++ b/edi_voxel_account_invoice_oca/data/queue_job_function_data.xml @@ -0,0 +1,14 @@ + + + + + _get_and_send_voxel_report + + + + + _update_error_status + + + diff --git a/edi_voxel_account_invoice_oca/i18n/edi_voxel_account_invoice_oca.pot b/edi_voxel_account_invoice_oca/i18n/edi_voxel_account_invoice_oca.pot new file mode 100644 index 0000000000..7ddaa45dd6 --- /dev/null +++ b/edi_voxel_account_invoice_oca/i18n/edi_voxel_account_invoice_oca.pot @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_voxel_account_invoice_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Cancel sending" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Cancelled Voxel reports" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_res_company +msgid "Companies" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_report_edi_voxel_account_invoice_oca_template_voxel_invoice +msgid "Edi Voxel Account Invoice Report" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.server,name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status_ir_actions_server +#: model:ir.cron,cron_name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status +#: model:ir.cron,name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status +msgid "Edi Voxel: Update invoice export status" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,help:edi_voxel_account_invoice_oca.field_account_move__voxel_state +msgid "Indicates the status of sending report to Voxel" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_res_company__voxel_invoice_login_id +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_res_config_settings__voxel_invoice_login_id +msgid "Invoice login" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_bank_statement_line__voxel_job_ids +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_job_ids +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_payment__voxel_job_ids +msgid "Jobs" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__processing_error +msgid "Processing Error" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Requeue" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Send now" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Send to Voxel" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "The last Voxel report processing with errors" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "The last attempt to sent to Voxel has failed" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_bank_statement_line__voxel_enabled +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_enabled +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_payment__voxel_enabled +msgid "Voxel Enabled" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_filename +msgid "Voxel Filename" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel Jobs" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel XML report" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel cancelled" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel filters" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.report,name:edi_voxel_account_invoice_oca.report_voxel_invoice +msgid "Voxel invoice" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report accepted" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report failed" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report in process" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report not sent" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report processing error" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_state +msgid "Voxel send state" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_xml_report +msgid "XML Report" +msgstr "" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.report,print_report_name:edi_voxel_account_invoice_oca.report_voxel_invoice +msgid "object._get_voxel_filename()" +msgstr "" diff --git a/edi_voxel_account_invoice_oca/i18n/es.po b/edi_voxel_account_invoice_oca/i18n/es.po new file mode 100644 index 0000000000..28c92c1c31 --- /dev/null +++ b/edi_voxel_account_invoice_oca/i18n/es.po @@ -0,0 +1,185 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_voxel_account_invoice_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-04-24 23:58+0000\n" +"PO-Revision-Date: 2023-11-15 14:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Cancel sending" +msgstr "Cancelar envío" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Cancelled Voxel reports" +msgstr "Envíos a Voxel cancelados" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_res_config_settings +msgid "Config Settings" +msgstr "Opciones de Configuración" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_report_edi_voxel_account_invoice_oca_template_voxel_invoice +msgid "Edi Voxel Account Invoice Report" +msgstr "Reporte de Factura para Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.server,name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status_ir_actions_server +#: model:ir.cron,cron_name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status +#: model:ir.cron,name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status +msgid "Edi Voxel: Update invoice export status" +msgstr "Edi Voxel: Actualizar estado de la exportación de facturas" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,help:edi_voxel_account_invoice_oca.field_account_move__voxel_state +msgid "Indicates the status of sending report to Voxel" +msgstr "Indica el estado del envío del informe a Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_res_company__voxel_invoice_login_id +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_res_config_settings__voxel_invoice_login_id +msgid "Invoice login" +msgstr "Login para Facturas" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_bank_statement_line__voxel_job_ids +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_job_ids +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_payment__voxel_job_ids +msgid "Jobs" +msgstr "Trabajos" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_account_move +msgid "Journal Entry" +msgstr "Entrada Diaria" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__processing_error +msgid "Processing Error" +msgstr "Error de procesamiento" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Requeue" +msgstr "Volver a poner en cola" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Send now" +msgstr "Enviar ahora" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Send to Voxel" +msgstr "Enviar a Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "The last Voxel report processing with errors" +msgstr "Último procesamiento de reporte con errores" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "The last attempt to sent to Voxel has failed" +msgstr "El úlimo intento de envío a Voxel ha fallado" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel" +msgstr "Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_bank_statement_line__voxel_enabled +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_enabled +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_payment__voxel_enabled +msgid "Voxel Enabled" +msgstr "Voxel habilitado" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_filename +msgid "Voxel Filename" +msgstr "Nombre de archivo Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel Jobs" +msgstr "Trabajos Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel XML report" +msgstr "Reporte XML Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel cancelled" +msgstr "Envíos a Voxel cancelados" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel filters" +msgstr "Filtros de Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.report,name:edi_voxel_account_invoice_oca.report_voxel_invoice +msgid "Voxel invoice" +msgstr "Factura Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report accepted" +msgstr "Informe Voxel aceptado" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report failed" +msgstr "Envíos a Voxel fallidos" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report in process" +msgstr "Reportes voxel en proceso" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report not sent" +msgstr "No envíadas a Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report processing error" +msgstr "Reporte Voxel con error de procesamiento" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_state +msgid "Voxel send state" +msgstr "Estado del envío Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_xml_report +msgid "XML Report" +msgstr "Informe XML" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.report,print_report_name:edi_voxel_account_invoice_oca.report_voxel_invoice +msgid "object._get_voxel_filename()" +msgstr "object._get_voxel_filename()" diff --git a/edi_voxel_account_invoice_oca/i18n/es_DO.po b/edi_voxel_account_invoice_oca/i18n/es_DO.po new file mode 100644 index 0000000000..2cb0913a80 --- /dev/null +++ b/edi_voxel_account_invoice_oca/i18n/es_DO.po @@ -0,0 +1,185 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * edi_voxel_account_invoice_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-04-24 23:58+0000\n" +"PO-Revision-Date: 2024-12-23 20:35+0100\n" +"Last-Translator: Leonardo J. Caballero G. \n" +"Language-Team: \n" +"Language: es_DO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Poedit 3.5\n" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Cancel sending" +msgstr "Cancelar envío" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Cancelled Voxel reports" +msgstr "Envíos a Voxel cancelados" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_res_config_settings +msgid "Config Settings" +msgstr "Opciones de Configuración" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_report_edi_voxel_account_invoice_oca_template_voxel_invoice +msgid "Edi Voxel Account Invoice Report" +msgstr "Reporte de Factura para Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.server,name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status_ir_actions_server +#: model:ir.cron,cron_name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status +#: model:ir.cron,name:edi_voxel_account_invoice_oca.ir_cron_check_invoice_export_status +msgid "Edi Voxel: Update invoice export status" +msgstr "Edi Voxel: Actualizar estado de la exportación de facturas" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,help:edi_voxel_account_invoice_oca.field_account_move__voxel_state +msgid "Indicates the status of sending report to Voxel" +msgstr "Indica el estado del envío del informe a Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_res_company__voxel_invoice_login_id +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_res_config_settings__voxel_invoice_login_id +msgid "Invoice login" +msgstr "Inicio de sesión para Facturas" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_bank_statement_line__voxel_job_ids +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_job_ids +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_payment__voxel_job_ids +msgid "Jobs" +msgstr "Trabajos" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model,name:edi_voxel_account_invoice_oca.model_account_move +msgid "Journal Entry" +msgstr "Entrada Diaria" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__processing_error +msgid "Processing Error" +msgstr "Error de procesamiento" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Requeue" +msgstr "Volver a poner en cola" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Send now" +msgstr "Enviar ahora" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Send to Voxel" +msgstr "Enviar a Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "The last Voxel report processing with errors" +msgstr "Último procesamiento de reporte con errores" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "The last attempt to sent to Voxel has failed" +msgstr "El úlimo intento de envío a Voxel ha fallado" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel" +msgstr "Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_bank_statement_line__voxel_enabled +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_enabled +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_payment__voxel_enabled +msgid "Voxel Enabled" +msgstr "Voxel habilitado" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_filename +msgid "Voxel Filename" +msgstr "Nombre de archivo Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel Jobs" +msgstr "Trabajos Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_move_form +msgid "Voxel XML report" +msgstr "Reporte XML Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel cancelled" +msgstr "Envíos a Voxel cancelados" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel filters" +msgstr "Filtros de Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.report,name:edi_voxel_account_invoice_oca.report_voxel_invoice +msgid "Voxel invoice" +msgstr "Factura Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report accepted" +msgstr "Informe Voxel aceptado" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report failed" +msgstr "Envíos a Voxel fallidos" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report in process" +msgstr "Reportes voxel en proceso" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report not sent" +msgstr "No envíadas a Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model_terms:ir.ui.view,arch_db:edi_voxel_account_invoice_oca.view_account_invoice_filter +msgid "Voxel report processing error" +msgstr "Reporte Voxel con error de procesamiento" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_state +msgid "Voxel send state" +msgstr "Estado del envío Voxel" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.model.fields,field_description:edi_voxel_account_invoice_oca.field_account_move__voxel_xml_report +msgid "XML Report" +msgstr "Informe XML" + +#. module: edi_voxel_account_invoice_oca +#: model:ir.actions.report,print_report_name:edi_voxel_account_invoice_oca.report_voxel_invoice +msgid "object._get_voxel_filename()" +msgstr "object._get_voxel_filename()" diff --git a/edi_voxel_account_invoice_oca/models/__init__.py b/edi_voxel_account_invoice_oca/models/__init__.py new file mode 100644 index 0000000000..4beacf3964 --- /dev/null +++ b/edi_voxel_account_invoice_oca/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_move +from . import res_company +from . import res_config_settings diff --git a/edi_voxel_account_invoice_oca/models/account_move.py b/edi_voxel_account_invoice_oca/models/account_move.py new file mode 100644 index 0000000000..290609b9c8 --- /dev/null +++ b/edi_voxel_account_invoice_oca/models/account_move.py @@ -0,0 +1,73 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# Copyright 2024 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountMove(models.Model): + _name = "account.move" + _inherit = ["account.move", "voxel.mixin"] + + voxel_enabled = fields.Boolean( + compute="_compute_voxel_enabled", + search="_search_voxel_enabled", + ) + voxel_job_ids = fields.Many2many( + comodel_name="queue.job", + relation="account_invoice_voxel_job_rel", + column1="invoice_id", + column2="voxel_job_id", + string="Jobs", + copy=False, + ) + + def get_voxel_login(self, company=None): + """This method overwrites the one defined in voxel.mixin to provide + the login for this specific model (account.invoice) + """ + return (company or self.company_id).voxel_invoice_login_id + + def _compute_voxel_enabled(self): + for record in self: + record.voxel_enabled = ( + record.company_id.voxel_enabled and record.partner_id.voxel_enabled + ) + + def _search_voxel_enabled(self, operator, value): + if (operator == "=" and value) or (operator == "!=" and not value): + domain = [ + ("company_id.voxel_enabled", "=", True), + ("partner_id.voxel_enabled", "=", True), + ] + else: + domain = [ + "|", + ("company_id.voxel_enabled", "=", False), + ("partner_id.voxel_enabled", "=", False), + ] + return [("id", "in", self.search(domain).ids)] + + def _post(self, soft=True): + """Send to Voxel when posting.""" + res = super()._post(soft=soft) + self.action_send_to_voxel() + return res + + def button_draft(self): + res = super().button_draft() + self._cancel_voxel_jobs() + return res + + def action_send_to_voxel(self): + invoices = self.filtered( + lambda inv: inv.is_sale_document() and inv.voxel_enabled + ) + if invoices: + invoices.enqueue_voxel_report( + "edi_voxel_account_invoice_oca.report_voxel_invoice" + ) + + def get_document_type(self): + """Document type name to be used in the name of the Voxel report""" + return "Factura" diff --git a/edi_voxel_account_invoice_oca/models/res_company.py b/edi_voxel_account_invoice_oca/models/res_company.py new file mode 100644 index 0000000000..240d9568fe --- /dev/null +++ b/edi_voxel_account_invoice_oca/models/res_company.py @@ -0,0 +1,12 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class Company(models.Model): + _inherit = "res.company" + + voxel_invoice_login_id = fields.Many2one( + string="Invoice login", comodel_name="voxel.login" + ) diff --git a/edi_voxel_account_invoice_oca/models/res_config_settings.py b/edi_voxel_account_invoice_oca/models/res_config_settings.py new file mode 100644 index 0000000000..33c7bad6f9 --- /dev/null +++ b/edi_voxel_account_invoice_oca/models/res_config_settings.py @@ -0,0 +1,12 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + voxel_invoice_login_id = fields.Many2one( + related="company_id.voxel_invoice_login_id", readonly=False + ) diff --git a/edi_voxel_account_invoice_oca/readme/CONFIGURE.rst b/edi_voxel_account_invoice_oca/readme/CONFIGURE.rst new file mode 100644 index 0000000000..ae8144a8bb --- /dev/null +++ b/edi_voxel_account_invoice_oca/readme/CONFIGURE.rst @@ -0,0 +1,31 @@ +To configure this module you have to belong to the access group +'Voxel manager' under 'Technical Settings', then: + +#. Open a customer form view. In 'Sales & Purchases' page, + check 'Enable Voxel' if you want to send invoices to this + customer through Voxel. +#. Go to *Settings > Users & Companies > Companies*, open the companies you + want to enable Voxel communication and set 'Enable Voxel' field to True. +#. In the login list, add the corresponding login for connecting with + Voxel to send the invoices. The final URL where the invoices are going + to be sent is '/Outbox'. +#. Save the form and edit it again, find 'invoice login' field and select + the login to be used in the invoice sending. +#. Select also the 'Send mode' to set when the Invoice will be sent: + + * On validate: The invoice will be sent to Voxel automatically when + the invoice is validated. + * At fixed time: The invoice will be sent to Voxel automatically at + a fixed time. + * With delay: The invoice will be sent to Voxel automatically a certain + time after the invoice is validated. + +Note: + +This module enqueue the sending invoices to Voxel in jobs in the background. +To do that it uses queue_job module, so a configuration is required +according to that. +The jobs for sending invoices to Voxel are queued in the channel +``root.voxel_export channel``. +The sending status check jobs are queued in the channel +``root.voxel_status``. diff --git a/edi_voxel_account_invoice_oca/readme/CONTRIBUTORS.rst b/edi_voxel_account_invoice_oca/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..1e643c28cf --- /dev/null +++ b/edi_voxel_account_invoice_oca/readme/CONTRIBUTORS.rst @@ -0,0 +1,9 @@ +* `Tecnativa `_: + + * Ernesto Tejeda + * Pedro M. Baeza + * Sergio Teruel + +* `Guavana `_: + + * Leonardo J. Caballero G. diff --git a/edi_voxel_account_invoice_oca/readme/DESCRIPTION.rst b/edi_voxel_account_invoice_oca/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..27a580408c --- /dev/null +++ b/edi_voxel_account_invoice_oca/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows you to send invoices to Voxel. Sending are queued in jobs +running in the background. diff --git a/edi_voxel_account_invoice_oca/readme/USAGE.rst b/edi_voxel_account_invoice_oca/readme/USAGE.rst new file mode 100644 index 0000000000..77c333488f --- /dev/null +++ b/edi_voxel_account_invoice_oca/readme/USAGE.rst @@ -0,0 +1,11 @@ +To use this module, you need to: + +#. Go to *Invoicing > Customers > Invoices* and create a + new Invoice or open an existing draft invoice. Make sure that the customer + has 'Enable Voxel' field checkbox (See configuration section). +#. Validate the invoice and it will be send to Voxel immediately or later, + depending on the Voxel 'Send mode' chosen in the company configuration. +#. A new tab will be visible on the invoice form with the label 'Voxel' + to show the information regarding sending the invoice to Voxel. +#. When the report is sent, you will be able to see the XML report in another + tab next to the jobs tab. diff --git a/edi_voxel_account_invoice_oca/reports/__init__.py b/edi_voxel_account_invoice_oca/reports/__init__.py new file mode 100644 index 0000000000..1be25b69bc --- /dev/null +++ b/edi_voxel_account_invoice_oca/reports/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import report_voxel_invoice diff --git a/edi_voxel_account_invoice_oca/reports/report_voxel_invoice.py b/edi_voxel_account_invoice_oca/reports/report_voxel_invoice.py new file mode 100644 index 0000000000..1ba2be4717 --- /dev/null +++ b/edi_voxel_account_invoice_oca/reports/report_voxel_invoice.py @@ -0,0 +1,184 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from datetime import date, datetime +from operator import itemgetter + +from odoo import api, fields, models + + +class ReportVoxelInvoice(models.AbstractModel): + _name = "report.edi_voxel_account_invoice_oca.template_voxel_invoice" + _inherit = "report.report_xml.abstract" + _description = "Edi Voxel Account Invoice Report" + + @api.model + def _get_report_values(self, docids, data=None): + docs = self.env["account.move"].browse(docids)[:1] + data = { + "general": self._get_general_data(docs), + "supplier": self._get_suplier_data(docs), + "client": self._get_client_data(docs), + "customers": self._get_customers_data(docs), + "comments": self._get_comments_data(docs), + "references": self._get_references_data(docs), + "products": self._get_products_data(docs), + "taxes": self._get_taxes_data(docs), + "tota_summary": self._get_total_summary_data(docs), + } + return data + + # report data. Auxiliary methods + def _get_general_data(self, invoice): + type_mapping = {"out_invoice": "FacturaComercial", "out_refund": "FacturaAbono"} + return { + "Type": type_mapping.get(invoice.move_type), + "Ref": invoice.name, + "Date": invoice.invoice_date + and datetime.strftime(invoice.invoice_date, "%Y-%m-%d"), + "Currency": invoice.currency_id.name, + } + + def _get_suplier_data(self, invoice): + supplier = invoice.company_id.partner_id + return { + "CIF": supplier._get_voxel_vat(), + "Company": supplier.name, + "Address": ", ".join(filter(None, [supplier.street, supplier.street2])), + "City": supplier.city, + "PC": supplier.zip, + "Province": supplier.state_id.name, + "Country": supplier.country_id.code_alpha3, + "Email": supplier.email, + } + + def _get_client_data(self, invoice): + client = invoice.partner_id + return { + "SupplierClientID": client.ref, + "CIF": client._get_voxel_vat(), + "Company": client.commercial_partner_id.name, + "Address": ", ".join(filter(None, [client.street, client.street2])), + "City": client.city, + "PC": client.zip, + "Province": client.state_id.name, + "Country": client.country_id.code_alpha3, + "Email": client.email, + } + + def _get_customers_data(self, invoice): + return [ + { + "SupplierClientID": invoice.partner_id.ref, + "SupplierCustomerID": customer.ref, + "Customer": customer.name, + "Address": ", ".join(filter(None, [customer.street, customer.street2])), + "City": customer.city, + "PC": customer.zip, + "Province": customer.state_id.name, + "Country": customer.country_id.code_alpha3, + "Email": customer.email, + } + for customer in ( + invoice.mapped("picking_ids.partner_id") or invoice.partner_shipping_id + ) + ] + + def _get_comments_data(self, invoice): + return invoice.narration and [{"Msg": invoice.narration}] or [] + + def _get_references_data(self, invoice): + references = [] + if invoice.picking_ids: + for picking in invoice.picking_ids: + picking_date = fields.Datetime.from_string(picking.date) + references.append( + { + "DNRef": picking.name, + "PORef": ( + picking.sale_id.client_order_ref or picking.sale_id.name + ), + "DNRefDate": picking_date + and datetime.strftime(picking_date, "%Y-%m-%d"), + } + ) + else: + orders = invoice.invoice_line_ids.mapped("sale_line_ids.order_id") + for order in orders: + references.append( + { + "DNRef": invoice.name, + "PORef": order.client_order_ref or order.name, + "DNRefDate": invoice.invoice_date + and date.strftime(invoice.invoice_date, "%Y-%m-%d"), + } + ) + return references + + def _get_products_data(self, invoice): + return [ + { + "product": self._get_product_data(line), + "taxes": self._get_product_taxes_data(line), + "discounts": self._get_product_discounts_data(line), + } + for line in invoice.invoice_line_ids + ] + + def _get_product_data(self, line): + customer_sku = line.move_id._get_customer_product_sku( + line.product_id, line.mapped("move_line_ids.picking_id.partner_id")[:1] + ) + if not customer_sku: + customer_sku = line.move_id._get_customer_product_sku( + line.product_id, line.move_id.partner_id + ) + return { + "SupplierSKU": line.product_id.default_code, + "CustomerSKU": customer_sku, + "Item": line.product_id.name, + "Qty": str(line.quantity), + "MU": line.product_uom_id.voxel_code, + "UP": str(line.price_unit), + "Total": str(round(line.price_subtotal, 2)), + } + + def _get_product_discounts_data(self, line): + taxes = [] + if line.discount: + amount = round(line.price_subtotal / line.quantity - line.price_unit, 2) + taxes.append( + { + "Qualifier": line.discount > 0.0 and "Descuento" or "Cargo", + "Type": line.discount > 0.0 and "Comercial" or "Otro", + "Rate": str(line.discount), + "Amount": str(amount), + } + ) + return taxes + + def _get_product_taxes_data(self, line): + taxes = [] + for tax in line.tax_ids: + rate = tax.amount_type != "group" and str(tax.amount) or False + taxes.append({"Type": tax.voxel_tax_code, "Rate": rate}) + return taxes + + def _get_taxes_data(self, invoice): + taxes = [] + for move_line in invoice.line_ids.filtered("tax_line_id"): + taxes.append( + { + "Type": move_line.tax_line_id.voxel_tax_code, + "Rate": str(move_line.tax_line_id.amount), + "Amount": str(abs(move_line.balance)), + } + ) + return sorted(taxes, key=itemgetter("Type", "Rate", "Amount")) + + def _get_total_summary_data(self, invoice): + return { + "SubTotal": str(invoice.amount_untaxed), + "Tax": str(invoice.amount_tax), + "Total": str(invoice.amount_total), + } diff --git a/edi_voxel_account_invoice_oca/static/description/icon.png b/edi_voxel_account_invoice_oca/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/edi_voxel_account_invoice_oca/static/description/icon.png differ diff --git a/edi_voxel_account_invoice_oca/static/description/index.html b/edi_voxel_account_invoice_oca/static/description/index.html new file mode 100644 index 0000000000..95d04dd79c --- /dev/null +++ b/edi_voxel_account_invoice_oca/static/description/index.html @@ -0,0 +1,486 @@ + + + + + +Voxel account invoice oca + + + +
+

Voxel account invoice oca

+ + +

Production/Stable License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

+

This module allows you to send invoices to Voxel. Sending are queued in jobs +running in the background.

+

Table of contents

+ +
+

Configuration

+

To configure this module you have to belong to the access group +‘Voxel manager’ under ‘Technical Settings’, then:

+
    +
  1. Open a customer form view. In ‘Sales & Purchases’ page, +check ‘Enable Voxel’ if you want to send invoices to this +customer through Voxel.
  2. +
  3. Go to Settings > Users & Companies > Companies, open the companies you +want to enable Voxel communication and set ‘Enable Voxel’ field to True.
  4. +
  5. In the login list, add the corresponding login for connecting with +Voxel to send the invoices. The final URL where the invoices are going +to be sent is ‘<Login URL>/Outbox’.
  6. +
  7. Save the form and edit it again, find ‘invoice login’ field and select +the login to be used in the invoice sending.
  8. +
  9. Select also the ‘Send mode’ to set when the Invoice will be sent:
  10. +
+
+
    +
  • On validate: The invoice will be sent to Voxel automatically when +the invoice is validated.
  • +
  • At fixed time: The invoice will be sent to Voxel automatically at +a fixed time.
  • +
  • With delay: The invoice will be sent to Voxel automatically a certain +time after the invoice is validated.
  • +
+
+

Note:

+

This module enqueue the sending invoices to Voxel in jobs in the background. +To do that it uses queue_job module, so a configuration is required +according to that. +The jobs for sending invoices to Voxel are queued in the channel +root.voxel_export channel. +The sending status check jobs are queued in the channel +root.voxel_status.

+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Invoicing > Customers > Invoices and create a +new Invoice or open an existing draft invoice. Make sure that the customer +has ‘Enable Voxel’ field checkbox (See configuration section).
  2. +
  3. Validate the invoice and it will be send to Voxel immediately or later, +depending on the Voxel ‘Send mode’ chosen in the company configuration.
  4. +
  5. A new tab will be visible on the invoice form with the label ‘Voxel’ +to show the information regarding sending the invoice to Voxel.
  6. +
  7. When the report is sent, you will be able to see the XML report in another +tab next to the jobs tab.
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Ernesto Tejeda
    • +
    • Pedro M. Baeza
    • +
    • Sergio Teruel
    • +
    +
  • +
  • Guavana:
      +
    • Leonardo J. Caballero G.
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/edi project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/edi_voxel_account_invoice_oca/tests/__init__.py b/edi_voxel_account_invoice_oca/tests/__init__.py new file mode 100644 index 0000000000..35df1b2533 --- /dev/null +++ b/edi_voxel_account_invoice_oca/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_voxel_account_invoice diff --git a/edi_voxel_account_invoice_oca/tests/test_voxel_account_invoice.py b/edi_voxel_account_invoice_oca/tests/test_voxel_account_invoice.py new file mode 100644 index 0000000000..7b2dd01c0e --- /dev/null +++ b/edi_voxel_account_invoice_oca/tests/test_voxel_account_invoice.py @@ -0,0 +1,293 @@ +# Copyright 2019 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from datetime import date, datetime + +from odoo.tests import TransactionCase + + +class TestVoxelAccountInvoice(TransactionCase): + @classmethod + def setUpClass(cls): + super(TestVoxelAccountInvoice, cls).setUpClass() + cls.env = cls.env( + context=dict( + cls.env.context, + mail_create_nolog=True, + mail_create_nosubscribe=True, + mail_notrack=True, + no_reset_password=True, + tracking_disable=True, + ) + ) + # Invoice line account + # Invoice company + cls.main_company = cls.env.ref("base.main_company") + cls.main_company.write( + { + "vat": "US1234567890", + "street": "Street 1", + "street2": "Street 2", + "name": "YourCompany", + "city": "City", + "zip": "99999", + "state_id": cls.env.ref("base.state_es_m").id, + "country_id": cls.env.ref("base.es").id, + "email": "info@yourcompany.example.com", + } + ) + # Set to false to avoid compare distinct data than expected + cls.env["ir.config_parameter"].sudo().set_param( + "account.use_invoice_terms", False + ) + # Invoice client + partner = cls.env["res.partner"].create( + { + "ref": "C01", + "vat": "BE0123456789", + "name": "Client (test)", + "email": "client_test@example.com", + "street": "Street 1", + "street2": "Street 2", + "city": "City (test)", + "zip": "10000", + "state_id": cls.env.ref("base.state_us_49").id, + "country_id": cls.env.ref("base.us").id, + } + ) + # Invoice products + product_obj = cls.env["product.product"] + product_1 = product_obj.create( + {"default_code": "DC_001", "name": "Product 1 (test)"} + ) + cls.env["product.customerinfo"].create( + { + "name": partner.id, + "product_tmpl_id": product_1.product_tmpl_id.id, + "product_id": product_1.id, + "product_code": "1234567891234", + } + ) + product_2 = product_obj.create( + {"default_code": "DC_002", "name": "Product 2 (test)"} + ) + product_3 = product_obj.create( + {"default_code": "DC_003", "name": "Product 3 (test)"} + ) + + tax_15 = cls.env["account.tax"].create( + { + "name": "Tax 15%", + "type_tax_use": "sale", + "amount_type": "percent", + "amount": 15, + "tax_group_id": cls.env.ref("account.tax_group_taxes").id, + } + ) + tax_30 = cls.env["account.tax"].create( + { + "name": "Tax 30.00%", + "type_tax_use": "sale", + "amount_type": "percent", + "amount": 30, + "tax_group_id": cls.env.ref("account.tax_group_taxes").id, + } + ) + # Invoice + cls.invoice = cls.env["account.move"].create( + { + "partner_id": partner.id, + "move_type": "out_invoice", + "currency_id": cls.main_company.currency_id.id, + "invoice_date": date(2019, 4, 13), + "company_id": cls.main_company.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "product_id": product_1.id, + "quantity": 2, + "price_unit": 750, + "name": "Product 1", + "product_uom_id": cls.env.ref("uom.product_uom_unit").id, + }, + ), + ( + 0, + 0, + { + "product_id": product_2.id, + "quantity": 3, + "price_unit": 147, + "discount": 20, + "tax_ids": [(6, 0, (tax_15 | tax_30).ids)], + "name": "Product 2", + "product_uom_id": product_2.uom_id.id, + }, + ), + ( + 0, + 0, + { + "product_id": product_3.id, + "quantity": 0, + "price_unit": 0, + "name": "Product 3", + "product_uom_id": product_3.uom_id.id, + }, + ), + ], + } + ) + + def test_get_voxel_filename(self): + bef = datetime.now() + bef = datetime( + bef.year, + bef.month, + bef.day, + bef.hour, + bef.minute, + bef.second, + (bef.microsecond // 1000) * 1000, + ) + filename = self.invoice._get_voxel_filename() + document_type, date_time = filename[:-4].split("_", 1) + date_time = datetime.strptime(date_time, "%Y%m%d_%H%M%S_%f") + self.assertEqual(document_type, "Factura") + self.assertGreaterEqual(date_time, bef) + + def test_get_report_values(self): + # Get report data + model_name = "report.edi_voxel_account_invoice_oca.template_voxel_invoice" + report_edi_obj = self.env[model_name] + report_data = report_edi_obj._get_report_values(self.invoice.ids) + # Get expected data + expected_report_data = self._get_invoice_data() + # Check data + self.assertDictEqual(report_data, expected_report_data) + + def _get_invoice_data(self): + return { + "general": self._get_general_data(), + "supplier": self._get_suplier_data(), + "client": self._get_client_data(), + "customers": self._get_customers_data(), + "comments": self._get_comments_data(), + "references": self._get_references_data(), + "products": self._get_products_data(), + "taxes": self._get_taxes_data(), + "tota_summary": self._get_total_summary_data(), + } + + # report data. Auxiliary methods + # ------------------------------ + def _get_general_data(self): + return { + "Type": "FacturaComercial", + "Ref": "INV/2019/00001", + "Date": "2019-04-13", + # Set currency code from company for resilient tests + "Currency": self.main_company.currency_id.name, + } + + def _get_suplier_data(self): + return { + "CIF": "US1234567890", + "Company": "YourCompany", + "Address": "Street 1, Street 2", + "City": "City", + "PC": "99999", + "Province": "Madrid", + "Country": "ESP", + "Email": "info@yourcompany.example.com", + } + + def _get_client_data(self): + return { + "SupplierClientID": "C01", + "CIF": "BE0123456789", + "Company": "Client (test)", + "Address": "Street 1, Street 2", + "City": "City (test)", + "PC": "10000", + "Province": "West Virginia", + "Country": "USA", + "Email": "client_test@example.com", + } + + def _get_customers_data(self): + return [] + + def _get_comments_data(self): + return [] + + def _get_references_data(self): + return [] + + def _get_products_data(self): + return [ + { + "product": { + "SupplierSKU": "DC_001", + "CustomerSKU": "1234567891234", + "Item": "Product 1 (test)", + "Qty": "2.0", + "MU": "Unidades", + "UP": "750.0", + "Total": "1500.0", + }, + "taxes": [], + "discounts": [], + }, + { + "product": { + "SupplierSKU": "DC_002", + "CustomerSKU": False, + "Item": "Product 2 (test)", + "Qty": "3.0", + "MU": "Unidades", + "UP": "147.0", + "Total": "352.8", + }, + "taxes": [ + {"Rate": "15.0", "Type": False}, + {"Rate": "30.0", "Type": False}, + ], + "discounts": [ + { + "Amount": "-29.4", + "Qualifier": "Descuento", + "Rate": "20.0", + "Type": "Comercial", + } + ], + }, + { + "product": { + "SupplierSKU": "DC_003", + "CustomerSKU": False, + "Item": "Product 3 (test)", + "Qty": "0.0", + "MU": "Unidades", + "UP": "0.0", + "Total": "0.0", + }, + "taxes": [], + "discounts": [], + }, + ] + + def _get_taxes_data(self): + return [ + {"Amount": "52.92", "Rate": "15.0", "Type": False}, + {"Amount": "105.84", "Rate": "30.0", "Type": False}, + ] + + def _get_total_summary_data(self): + return { + "Tax": "158.76", + "SubTotal": "1852.8", + "Total": "2011.56", + } diff --git a/edi_voxel_account_invoice_oca/views/account_move_views.xml b/edi_voxel_account_invoice_oca/views/account_move_views.xml new file mode 100644 index 0000000000..356d577c2b --- /dev/null +++ b/edi_voxel_account_invoice_oca/views/account_move_views.xml @@ -0,0 +1,157 @@ + + + + account.move.form.inherit + account.move + + +
+
+ + + + + + + + + + + + + + + + + + +