diff --git a/partner_invoicing_mode_monthly/README.rst b/partner_invoicing_mode_monthly/README.rst new file mode 100644 index 00000000000..b6dd2225a53 --- /dev/null +++ b/partner_invoicing_mode_monthly/README.rst @@ -0,0 +1,96 @@ +============================== +Partner Invoicing Mode Monthly +============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:87f13abfceac758858d34159ff8fb9f632dfef6dec67cc436dbd51a00f866221 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |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%2Faccount--invoicing-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoicing/tree/17.0/partner_invoicing_mode_monthly + :alt: OCA/account-invoicing +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-partner_invoicing_mode_monthly + :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/account-invoicing&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to select a monthly invoicing mode for a customer. It +is based on partner_invoicing_mode. When this mode is selected for a +customer, the customer will be automatically invoiced + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + + + +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 +------- + +* Camptocamp + +Contributors +------------ + +- `Camptocamp `__: + + - Thierry Ducrest + +- Phuc (Tran Thanh) + +- Tran Thanh Trai + +Other credits +------------- + +The development of this module has been financially supported by: + +- Camptocamp + +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/account-invoicing `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_invoicing_mode_monthly/__init__.py b/partner_invoicing_mode_monthly/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/partner_invoicing_mode_monthly/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_invoicing_mode_monthly/__manifest__.py b/partner_invoicing_mode_monthly/__manifest__.py new file mode 100644 index 00000000000..312776c1e46 --- /dev/null +++ b/partner_invoicing_mode_monthly/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2020 Camptocamp +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Partner Invoicing Mode Monthly", + "version": "17.0.1.0.0", + "summary": "Create invoices automatically on a monthly basis.", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-invoicing", + "license": "AGPL-3", + "category": "Accounting & Finance", + "depends": [ + "partner_invoicing_mode", + "sale_stock", + ], + "data": [ + "data/ir_cron.xml", + "data/queue_job_data.xml", + "views/res_config_settings_views.xml", + ], +} diff --git a/partner_invoicing_mode_monthly/data/ir_cron.xml b/partner_invoicing_mode_monthly/data/ir_cron.xml new file mode 100644 index 00000000000..b723a9369f9 --- /dev/null +++ b/partner_invoicing_mode_monthly/data/ir_cron.xml @@ -0,0 +1,18 @@ + + + + Generate Monthly Invoices + + + 1 + days + -1 + + + model.cron_generate_monthly_invoices() + + + diff --git a/partner_invoicing_mode_monthly/data/queue_job_data.xml b/partner_invoicing_mode_monthly/data/queue_job_data.xml new file mode 100644 index 00000000000..67ab12aa9c3 --- /dev/null +++ b/partner_invoicing_mode_monthly/data/queue_job_data.xml @@ -0,0 +1,15 @@ + + + + + invoice_monthly + + + + + + + _generate_invoices_by_partner + + + diff --git a/partner_invoicing_mode_monthly/i18n/es.po b/partner_invoicing_mode_monthly/i18n/es.po new file mode 100644 index 00000000000..29182df2999 --- /dev/null +++ b/partner_invoicing_mode_monthly/i18n/es.po @@ -0,0 +1,102 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_invoicing_mode_monthly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-05-12 18:36+0000\n" +"Last-Translator: Sergio Ariel Ameghino \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Monthly Invoicing Options" +msgstr "Opciones de facturación mensual" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_config_settings +msgid "Config Settings" +msgstr "Ajustes de Configuración" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "" +"Day of the month to execute the invoicing. For a number higherthan the " +"number of days in a month, the invoicing will beexecuted on the last day of " +"the month." +msgstr "" +"Día del mes para ejecutar la facturación. Si el número es mayor al numero de " +"días del mes, la facturación será ejecutada el último día del mes." + +#. module: partner_invoicing_mode_monthly +#: model:ir.actions.server,name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice_ir_actions_server +#: model:ir.cron,cron_name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice +msgid "Generate Monthly Invoices" +msgstr "Generar facturas mensuales" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "Invoicing Day" +msgstr "Día de facturación" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_users__invoicing_mode +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing Mode" +msgstr "Modo de facturación" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing day" +msgstr "Día de facturación" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Last executed on" +msgstr "Última ejecución el" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution (monthly)" +msgstr "Última ejecución (mensual)" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution of monthly invoicing." +msgstr "Última ejecución de la facturación mensual." + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields.selection,name:partner_invoicing_mode_monthly.selection__res_partner__invoicing_mode__monthly +msgid "Monthly" +msgstr "Mensualmente" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_sale_order +msgid "Sales Order" +msgstr "Órdenes de venta" + +#~ msgid "Last execution" +#~ msgstr "Última ejecución" diff --git a/partner_invoicing_mode_monthly/i18n/hr.po b/partner_invoicing_mode_monthly/i18n/hr.po new file mode 100644 index 00000000000..924305685e4 --- /dev/null +++ b/partner_invoicing_mode_monthly/i18n/hr.po @@ -0,0 +1,100 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_invoicing_mode_monthly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-17 11:23+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.17\n" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Monthly Invoicing Options" +msgstr "Opcije mjesečnih računa" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_company +msgid "Companies" +msgstr "Tvrtke" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_config_settings +msgid "Config Settings" +msgstr "Postavke" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_partner +msgid "Contact" +msgstr "Kontakt" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "" +"Day of the month to execute the invoicing. For a number higherthan the " +"number of days in a month, the invoicing will beexecuted on the last day of " +"the month." +msgstr "" +"Dan u mjesecu za izdavanje računa. Za broj veći od broja dana u mjesecu, " +"izdavanje računa će se izvršiti zadnji dan u mjesecu." + +#. module: partner_invoicing_mode_monthly +#: model:ir.actions.server,name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice_ir_actions_server +#: model:ir.cron,cron_name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice +msgid "Generate Monthly Invoices" +msgstr "Generiraj mjesečne račune" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "Invoicing Day" +msgstr "Dan za izdavanje" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_users__invoicing_mode +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing Mode" +msgstr "Način izdavanja" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing day" +msgstr "Dan izdavanja" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Last executed on" +msgstr "Zadnje izvršeno" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution (monthly)" +msgstr "Zadnje izvršavanje (mjesečno)" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution of monthly invoicing." +msgstr "Zadnje izvršavanje mjesečnog izdavanja računa." + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields.selection,name:partner_invoicing_mode_monthly.selection__res_partner__invoicing_mode__monthly +msgid "Monthly" +msgstr "Mjesečno" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_sale_order +msgid "Sales Order" +msgstr "Prodajni nalog" diff --git a/partner_invoicing_mode_monthly/i18n/it.po b/partner_invoicing_mode_monthly/i18n/it.po new file mode 100644 index 00000000000..d993a0758e3 --- /dev/null +++ b/partner_invoicing_mode_monthly/i18n/it.po @@ -0,0 +1,103 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_invoicing_mode_monthly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-05-02 11:44+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Monthly Invoicing Options" +msgstr "Opzione fatturazione mensile" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_company +msgid "Companies" +msgstr "Aziende" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_partner +msgid "Contact" +msgstr "Contatto" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "" +"Day of the month to execute the invoicing. For a number higherthan the " +"number of days in a month, the invoicing will beexecuted on the last day of " +"the month." +msgstr "" +"Giorno del mese in cui effettuare la fatturazione. Per un numero superiore " +"al numero di giorni nel mese, la fatturazione verrà eseguita nell'ultimo " +"giorno del mese." + +#. module: partner_invoicing_mode_monthly +#: model:ir.actions.server,name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice_ir_actions_server +#: model:ir.cron,cron_name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice +msgid "Generate Monthly Invoices" +msgstr "Genera fatture mensili" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "Invoicing Day" +msgstr "Giorno fatturazione" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_users__invoicing_mode +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing Mode" +msgstr "Modo fatturazione" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing day" +msgstr "Giorno fatturazione" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Last executed on" +msgstr "Ultima esecuzione il" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution (monthly)" +msgstr "Ultima esecuzione (mensile)" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution of monthly invoicing." +msgstr "Ultima esecuzione della fatturazione mensile." + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields.selection,name:partner_invoicing_mode_monthly.selection__res_partner__invoicing_mode__monthly +msgid "Monthly" +msgstr "Mensile" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#~ msgid "Last execution" +#~ msgstr "Ultima esecuzione" diff --git a/partner_invoicing_mode_monthly/i18n/partner_invoicing_mode_monthly.pot b/partner_invoicing_mode_monthly/i18n/partner_invoicing_mode_monthly.pot new file mode 100644 index 00000000000..de1ce48ad6a --- /dev/null +++ b/partner_invoicing_mode_monthly/i18n/partner_invoicing_mode_monthly.pot @@ -0,0 +1,94 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_invoicing_mode_monthly +# +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: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Monthly Invoicing Options" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_company +msgid "Companies" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_res_partner +msgid "Contact" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "" +"Day of the month to execute the invoicing. For a number higherthan the " +"number of days in a month, the invoicing will beexecuted on the last day of " +"the month." +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.actions.server,name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice_ir_actions_server +#: model:ir.cron,cron_name:partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice +msgid "Generate Monthly Invoices" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_day_todo +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__res_invoicing_mode_monthly_day_todo +msgid "Invoicing Day" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_users__invoicing_mode +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing Mode" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Invoicing day" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model_terms:ir.ui.view,arch_db:partner_invoicing_mode_monthly.res_config_settings_view_form +msgid "Last executed on" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,field_description:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution (monthly)" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_company__invoicing_mode_monthly_last_execution +#: model:ir.model.fields,help:partner_invoicing_mode_monthly.field_res_config_settings__invoicing_mode_monthly_last_execution +msgid "Last execution of monthly invoicing." +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model.fields.selection,name:partner_invoicing_mode_monthly.selection__res_partner__invoicing_mode__monthly +msgid "Monthly" +msgstr "" + +#. module: partner_invoicing_mode_monthly +#: model:ir.model,name:partner_invoicing_mode_monthly.model_sale_order +msgid "Sales Order" +msgstr "" diff --git a/partner_invoicing_mode_monthly/models/__init__.py b/partner_invoicing_mode_monthly/models/__init__.py new file mode 100644 index 00000000000..ea64a69d2e0 --- /dev/null +++ b/partner_invoicing_mode_monthly/models/__init__.py @@ -0,0 +1,4 @@ +from . import res_company +from . import res_config_settings +from . import res_partner +from . import sale_order diff --git a/partner_invoicing_mode_monthly/models/res_company.py b/partner_invoicing_mode_monthly/models/res_company.py new file mode 100644 index 00000000000..ba011ae78bb --- /dev/null +++ b/partner_invoicing_mode_monthly/models/res_company.py @@ -0,0 +1,21 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + invoicing_mode_monthly_day_todo = fields.Integer( + "Invoicing Day", + default="31", + help="Day of the month to execute the invoicing. For a number higher" + "than the number of days in a month, the invoicing will be" + "executed on the last day of the month.", + ) + invoicing_mode_monthly_last_execution = fields.Datetime( + string="Last execution (monthly)", + help="Last execution of monthly invoicing.", + readonly=True, + ) diff --git a/partner_invoicing_mode_monthly/models/res_config_settings.py b/partner_invoicing_mode_monthly/models/res_config_settings.py new file mode 100644 index 00000000000..a2c560c73c9 --- /dev/null +++ b/partner_invoicing_mode_monthly/models/res_config_settings.py @@ -0,0 +1,14 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + res_invoicing_mode_monthly_day_todo = fields.Integer( + related="company_id.invoicing_mode_monthly_day_todo", readonly=False + ) + invoicing_mode_monthly_last_execution = fields.Datetime( + related="company_id.invoicing_mode_monthly_last_execution", readonly=True + ) diff --git a/partner_invoicing_mode_monthly/models/res_partner.py b/partner_invoicing_mode_monthly/models/res_partner.py new file mode 100644 index 00000000000..630a2584b32 --- /dev/null +++ b/partner_invoicing_mode_monthly/models/res_partner.py @@ -0,0 +1,13 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + invoicing_mode = fields.Selection( + selection_add=[("monthly", "Monthly")], + ondelete={"monthly": "set default"}, + ) diff --git a/partner_invoicing_mode_monthly/models/sale_order.py b/partner_invoicing_mode_monthly/models/sale_order.py new file mode 100644 index 00000000000..1b512b30a22 --- /dev/null +++ b/partner_invoicing_mode_monthly/models/sale_order.py @@ -0,0 +1,66 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from datetime import datetime + +from dateutil.relativedelta import relativedelta + +from odoo import api, models +from odoo.osv.expression import OR + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + @api.model + def cron_generate_monthly_invoices(self): + """Cron called daily to check if monthly invoicing needs to be done.""" + company_ids = self._company_monthly_invoicing_today() + if company_ids: + self.generate_monthly_invoices(company_ids) + + @api.model + def generate_monthly_invoices(self, companies=None): + # TODO: Kept former function for backward compatibility. To remove + # in further version. + return self.generate_invoices( + companies, + invoicing_mode="monthly", + last_execution_field="invoicing_mode_monthly_last_execution", + ) + + @api.model + def _company_monthly_invoicing_today(self): + """Get company ids for which today is monthly invoicing day.""" + today = datetime.now() + first_day_this_month = today.replace( + day=1, hour=0, minute=0, second=0, microsecond=0 + ) + first_day_last_month = first_day_this_month - relativedelta(months=1) + last_day_of_this_month = (today + relativedelta(day=31)).day + # Last month still not executed, it needs to be done + domain_last_month = [ + ("invoicing_mode_monthly_last_execution", "<", first_day_last_month), + ] + # Invoicing day is today or in the past and invoicing not yet done + domain_this_month = [ + "|", + ("invoicing_mode_monthly_last_execution", "<", first_day_this_month), + ("invoicing_mode_monthly_last_execution", "=", False), + ("invoicing_mode_monthly_day_todo", "<=", today.day), + ] + # Make sure non exisiting days are done at the end of the month + domain_last_day_of_month = [ + "|", + ("invoicing_mode_monthly_last_execution", "<", first_day_this_month), + ("invoicing_mode_monthly_last_execution", "=", False), + ("invoicing_mode_monthly_day_todo", ">", today.day), + ] + if today.day == last_day_of_this_month: + domain = OR( + [domain_last_month, domain_this_month, domain_last_day_of_month] + ) + else: + domain = OR([domain_last_month, domain_this_month]) + + return self.env["res.company"].search(domain) diff --git a/partner_invoicing_mode_monthly/pyproject.toml b/partner_invoicing_mode_monthly/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/partner_invoicing_mode_monthly/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/partner_invoicing_mode_monthly/readme/CONTRIBUTORS.md b/partner_invoicing_mode_monthly/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..d8ff4cd8d1e --- /dev/null +++ b/partner_invoicing_mode_monthly/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- [Camptocamp](https://www.camptocamp.com): + + > - Thierry Ducrest \<\> + +- Phuc (Tran Thanh) \<\> +- Tran Thanh Trai \<\> diff --git a/partner_invoicing_mode_monthly/readme/CREDITS.md b/partner_invoicing_mode_monthly/readme/CREDITS.md new file mode 100644 index 00000000000..705d3b30cad --- /dev/null +++ b/partner_invoicing_mode_monthly/readme/CREDITS.md @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +- Camptocamp diff --git a/partner_invoicing_mode_monthly/readme/DESCRIPTION.md b/partner_invoicing_mode_monthly/readme/DESCRIPTION.md new file mode 100644 index 00000000000..e023aed5d91 --- /dev/null +++ b/partner_invoicing_mode_monthly/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module allows to select a monthly invoicing mode for a customer. It +is based on partner_invoicing_mode. When this mode is selected for a +customer, the customer will be automatically invoiced diff --git a/partner_invoicing_mode_monthly/readme/INSTALL.md b/partner_invoicing_mode_monthly/readme/INSTALL.md new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/partner_invoicing_mode_monthly/readme/INSTALL.md @@ -0,0 +1 @@ + diff --git a/partner_invoicing_mode_monthly/static/description/icon.png b/partner_invoicing_mode_monthly/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/partner_invoicing_mode_monthly/static/description/icon.png differ diff --git a/partner_invoicing_mode_monthly/static/description/index.html b/partner_invoicing_mode_monthly/static/description/index.html new file mode 100644 index 00000000000..79d3c0299da --- /dev/null +++ b/partner_invoicing_mode_monthly/static/description/index.html @@ -0,0 +1,447 @@ + + + + + +Partner Invoicing Mode Monthly + + + +
+

Partner Invoicing Mode Monthly

+ + +

Beta License: AGPL-3 OCA/account-invoicing Translate me on Weblate Try me on Runboat

+

This module allows to select a monthly invoicing mode for a customer. It +is based on partner_invoicing_mode. When this mode is selected for a +customer, the customer will be automatically invoiced

+

Table of contents

+ + +
+

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

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Camptocamp
  • +
+
+
+

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/account-invoicing project on GitHub.

+

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

+
+
+
+ + diff --git a/partner_invoicing_mode_monthly/tests/__init__.py b/partner_invoicing_mode_monthly/tests/__init__.py new file mode 100644 index 00000000000..bae1b469a28 --- /dev/null +++ b/partner_invoicing_mode_monthly/tests/__init__.py @@ -0,0 +1,2 @@ +from . import test_invoice_mode_monthly +from . import test_invoice_mode_monthly_is_it_today diff --git a/partner_invoicing_mode_monthly/tests/test_invoice_mode_monthly.py b/partner_invoicing_mode_monthly/tests/test_invoice_mode_monthly.py new file mode 100644 index 00000000000..5cba169dd43 --- /dev/null +++ b/partner_invoicing_mode_monthly/tests/test_invoice_mode_monthly.py @@ -0,0 +1,118 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from unittest import mock + +from odoo.tests.common import TransactionCase +from odoo.tools import mute_logger + +from odoo.addons.partner_invoicing_mode.tests.common import CommonPartnerInvoicingMode +from odoo.addons.partner_invoicing_mode_monthly.models.sale_order import SaleOrder + + +class TestInvoiceModeMonthly(CommonPartnerInvoicingMode, TransactionCase): + _invoicing_mode = "monthly" + + def deliver_invoice(self, sale_order): + sale_order.action_confirm() + for picking in sale_order.picking_ids: + for move in picking.move_ids: + move.quantity = move.product_uom_qty + picking.action_assign() + picking.with_context(test_queue_job_no_delay=True).button_validate() + + def test_invoice_mode_monthly(self): + self.so1.payment_term_id = self.pt1.id + self.deliver_invoice(self.so1) + self.assertFalse(self.so1.invoice_ids) + with mute_logger("odoo.addons.queue_job.delay"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_monthly_invoices() + self.assertTrue(self.so1.invoice_ids) + # No errors are raised when called without anything to invoice + with mute_logger("odoo.addons.queue_job.delay"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_monthly_invoices() + + def test_invoice_mode_monthly_cron(self): + cron = self.env.ref( + "partner_invoicing_mode_monthly.ir_cron_generate_monthly_invoice" + ) + self.so1.payment_term_id = self.pt1.id + self.deliver_invoice(self.so1) + self.assertFalse(self.so1.invoice_ids) + with mute_logger("odoo.addons.queue_job.delay"), mock.patch.object( + SaleOrder, + "_company_monthly_invoicing_today", + return_value=self.so1.company_id, + ): + cron.with_context(test_queue_job_no_delay=True).ir_actions_server_id.run() + self.assertTrue(self.so1.invoice_ids) + + def test_saleorder_with_different_mode_term(self): + """Check multiple sale order one partner diverse terms.""" + self.so1.payment_term_id = self.pt1.id + self.deliver_invoice(self.so1) + self.so2.payment_term_id = self.pt2.id + self.deliver_invoice(self.so2) + with mute_logger("odoo.addons.queue_job.delay"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_monthly_invoices(self.company) + self.assertEqual(len(self.so1.invoice_ids), 1) + self.assertEqual(len(self.so2.invoice_ids), 1) + # Two invoices because the term are different + self.assertNotEqual(self.so1.invoice_ids, self.so2.invoice_ids) + self.assertEqual(self.so1.invoice_ids.state, "posted") + + def test_saleorder_grouped_in_invoice(self): + """Check multiple sale order grouped in one invoice""" + self.deliver_invoice(self.so1) + self.deliver_invoice(self.so2) + with mute_logger("odoo.addons.queue_job.delay"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_monthly_invoices(self.company) + self.assertEqual(len(self.so1.invoice_ids), 1) + self.assertEqual(len(self.so2.invoice_ids), 1) + # Same invoice for both order + self.assertEqual(self.so1.invoice_ids, self.so2.invoice_ids) + self.assertEqual(self.so1.invoice_ids.state, "posted") + + def test_split_invoice_by_sale_order(self): + """For same customer invoice 2 sales order separately.""" + self.partner.invoicing_mode = "monthly" + self.so1.one_invoice_per_order = True + self.so2.one_invoice_per_order = True + self.deliver_invoice(self.so1) + self.deliver_invoice(self.so2) + with mute_logger("odoo.addons.queue_job.delay"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_monthly_invoices(self.company) + self.assertEqual(len(self.so1.invoice_ids), 1) + self.assertEqual(len(self.so2.invoice_ids), 1) + # Two invoices as they must be split + self.assertNotEqual(self.so1.invoice_ids, self.so2.invoice_ids) + self.assertEqual(self.so1.invoice_ids.state, "posted") + self.assertEqual(self.so2.invoice_ids.state, "posted") + + def test_invoice_for_multiple_customer(self): + """Check two sale order for different customers.""" + self.partner.invoicing_mode = "monthly" + self.so2.partner_id = self.partner2 + self.so2.partner_invoice_id = self.partner2 + self.so2.partner_shipping_id = self.partner2 + self.deliver_invoice(self.so1) + self.deliver_invoice(self.so2) + with mute_logger("odoo.addons.queue_job.delay"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_monthly_invoices(self.company) + self.assertEqual(len(self.so1.invoice_ids), 1) + self.assertEqual(len(self.so2.invoice_ids), 1) + self.assertNotEqual(self.so1.invoice_ids, self.so2.invoice_ids) + self.assertEqual(self.so1.invoice_ids.state, "posted") + self.assertEqual(self.so2.invoice_ids.state, "posted") diff --git a/partner_invoicing_mode_monthly/tests/test_invoice_mode_monthly_is_it_today.py b/partner_invoicing_mode_monthly/tests/test_invoice_mode_monthly_is_it_today.py new file mode 100644 index 00000000000..f3cee6fb210 --- /dev/null +++ b/partner_invoicing_mode_monthly/tests/test_invoice_mode_monthly_is_it_today.py @@ -0,0 +1,63 @@ +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from freezegun import freeze_time + +from odoo.tests.common import TransactionCase + + +class TestInvoiceModeMonthly(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.company = cls.env.company + cls.SaleOrder = cls.env["sale.order"] + + def test_late_invoicing_for_last_month(self): + """Check that last month invoicing will be done if missed.""" + company = self.env.company + company.invoicing_mode_monthly_day_todo = 31 + company.invoicing_mode_monthly_last_execution = "2020-05-31" + self.assertTrue(self.env.company) + with freeze_time("2020-07-03"): + res = self.SaleOrder._company_monthly_invoicing_today() + self.assertTrue(res) + company.invoicing_mode_monthly_last_execution = "2020-06-30" + with freeze_time("2020-07-03"): + res = self.SaleOrder._company_monthly_invoicing_today() + self.assertFalse(res) + + def test_selected_day_not_exist_in_month(self): + """Check on last day of the month invoicing is done. + + The day of invoicing selected could not exist in the current + month, but invoicing should still be executed on the last + day of the month. + """ + company = self.env.company + company.invoicing_mode_monthly_day_todo = 31 + company.invoicing_mode_monthly_last_execution = "2020-05-29" + self.assertTrue(self.env.company) + with freeze_time("2020-06-29"): + res = self.SaleOrder._company_monthly_invoicing_today() + self.assertFalse(res) + with freeze_time("2020-06-30"): + res = self.SaleOrder._company_monthly_invoicing_today() + self.assertTrue(res) + + def test_no_invoicing_done_yet(self): + """Check when is the first monthly invoicing done. + + When monthly invoicing has never been done, it will not be run + for the previous month. + """ + company = self.env.company + company.invoicing_mode_monthly_day_todo = 15 + company.invoicing_mode_monthly_last_execution = None + self.assertTrue(self.env.company) + with freeze_time("2020-06-11"): + res = self.SaleOrder._company_monthly_invoicing_today() + self.assertFalse(res) + with freeze_time("2020-06-30"): + res = self.SaleOrder._company_monthly_invoicing_today() + self.assertTrue(res) diff --git a/partner_invoicing_mode_monthly/views/res_config_settings_views.xml b/partner_invoicing_mode_monthly/views/res_config_settings_views.xml new file mode 100644 index 00000000000..d7369112e2b --- /dev/null +++ b/partner_invoicing_mode_monthly/views/res_config_settings_views.xml @@ -0,0 +1,37 @@ + + + + + res.config.settings + + +
+
+ Monthly Invoicing Options +
+
+
+
+
+
+
+
+
+
+
+