diff --git a/partner_invoicing_mode_weekly/README.rst b/partner_invoicing_mode_weekly/README.rst new file mode 100644 index 00000000000..c3e9f797ed0 --- /dev/null +++ b/partner_invoicing_mode_weekly/README.rst @@ -0,0 +1,85 @@ +=========================== +Account Invoice Mode Weekly +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/14.0/account_invoice_mode_weekly + :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-14-0/account-invoicing-14-0-account_invoice_mode_weekly + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/95/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to select a weekly invoicing mode for a customer. +It is based on `account_invoice_base_invoicing_mode`. +When this mode is selected for a customer, the customer will be automatically +invoiced + +**Table of contents** + +.. contents:: + :local: + +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 smashing 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 `_: + + * Julien Coux + +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_weekly/__init__.py b/partner_invoicing_mode_weekly/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/partner_invoicing_mode_weekly/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_invoicing_mode_weekly/__manifest__.py b/partner_invoicing_mode_weekly/__manifest__.py new file mode 100644 index 00000000000..680d99a8f9f --- /dev/null +++ b/partner_invoicing_mode_weekly/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2021 Camptocamp +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Account Invoice Mode Weekly", + "version": "16.0.1.0.0", + "summary": "Create invoices automatically on a weekly basis.", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-invoicing", + "license": "AGPL-3", + "category": "Accounting & Finance", + "depends": [ + "account", + "partner_invoicing_mode", + "queue_job", + "sale", + ], + "data": [ + "data/ir_cron.xml", + "data/queue_job_data.xml", + "views/res_config_settings_views.xml", + ], +} diff --git a/partner_invoicing_mode_weekly/data/ir_cron.xml b/partner_invoicing_mode_weekly/data/ir_cron.xml new file mode 100644 index 00000000000..3668c658486 --- /dev/null +++ b/partner_invoicing_mode_weekly/data/ir_cron.xml @@ -0,0 +1,18 @@ + + + + Generate Weekly Invoices + + + 1 + days + -1 + + + model.cron_generate_weekly_invoices() + + + diff --git a/partner_invoicing_mode_weekly/data/queue_job_data.xml b/partner_invoicing_mode_weekly/data/queue_job_data.xml new file mode 100644 index 00000000000..f0e528e4eb7 --- /dev/null +++ b/partner_invoicing_mode_weekly/data/queue_job_data.xml @@ -0,0 +1,15 @@ + + + + + invoice_weekly + + + + + + + _generate_invoices_by_partner + + + diff --git a/partner_invoicing_mode_weekly/i18n/account_invoice_mode_weekly.pot b/partner_invoicing_mode_weekly/i18n/account_invoice_mode_weekly.pot new file mode 100644 index 00000000000..b2874e11c7e --- /dev/null +++ b/partner_invoicing_mode_weekly/i18n/account_invoice_mode_weekly.pot @@ -0,0 +1,155 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_mode_weekly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly Invoicing Options" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_company +msgid "Companies" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_partner +msgid "Contact" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Day of the week to execute the invoicing." +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__display_name +msgid "Display Name" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__4 +msgid "Friday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.actions.server,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice_ir_actions_server +#: model:ir.cron,cron_name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +#: model:ir.cron,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +msgid "Generate Weekly Invoices" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_users__invoicing_mode +msgid "Invoicing Mode" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Invoicing Weekly" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Last executed on" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Last execution of weekly invoicing." +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__0 +msgid "Monday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__5 +msgid "Saturday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__6 +msgid "Sunday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__3 +msgid "Thursday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__1 +msgid "Tuesday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__2 +msgid "Wednesday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_partner__invoicing_mode__weekly +msgid "Weekly" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Weekly Invoicing Day" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly invoicing day" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Weekly last execution" +msgstr "" diff --git a/partner_invoicing_mode_weekly/i18n/ca.po b/partner_invoicing_mode_weekly/i18n/ca.po new file mode 100644 index 00000000000..956917db1c4 --- /dev/null +++ b/partner_invoicing_mode_weekly/i18n/ca.po @@ -0,0 +1,156 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_mode_weekly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ca\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" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly Invoicing Options" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_company +msgid "Companies" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_partner +msgid "Contact" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Day of the week to execute the invoicing." +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__display_name +msgid "Display Name" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__4 +msgid "Friday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.actions.server,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice_ir_actions_server +#: model:ir.cron,cron_name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +#: model:ir.cron,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +msgid "Generate Weekly Invoices" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_users__invoicing_mode +msgid "Invoicing Mode" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Invoicing Weekly" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Last executed on" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Last execution of weekly invoicing." +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__0 +msgid "Monday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__5 +msgid "Saturday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__6 +msgid "Sunday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__3 +msgid "Thursday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__1 +msgid "Tuesday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__2 +msgid "Wednesday" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_partner__invoicing_mode__weekly +msgid "Weekly" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Weekly Invoicing Day" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly invoicing day" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Weekly last execution" +msgstr "" diff --git a/partner_invoicing_mode_weekly/i18n/es.po b/partner_invoicing_mode_weekly/i18n/es.po new file mode 100644 index 00000000000..5141887a0e9 --- /dev/null +++ b/partner_invoicing_mode_weekly/i18n/es.po @@ -0,0 +1,158 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_mode_weekly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-24 12:28+0000\n" +"Last-Translator: Anna Martínez \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: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly Invoicing Options" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_company +msgid "Companies" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_partner +msgid "Contact" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Day of the week to execute the invoicing." +msgstr "Día de la semana para ejecutar la facturación." + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__display_name +msgid "Display Name" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__4 +msgid "Friday" +msgstr "Viernes" + +#. module: account_invoice_mode_weekly +#: model:ir.actions.server,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice_ir_actions_server +#: model:ir.cron,cron_name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +#: model:ir.cron,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +msgid "Generate Weekly Invoices" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_users__invoicing_mode +msgid "Invoicing Mode" +msgstr "Modo de facturación" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Invoicing Weekly" +msgstr "Semanalmente" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Last executed on" +msgstr "Última ejecución en" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Last execution of weekly invoicing." +msgstr "Última ejecución de la facturación semanal." + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__0 +msgid "Monday" +msgstr "Lunes" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__5 +msgid "Saturday" +msgstr "Sábado" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__6 +msgid "Sunday" +msgstr "Domingo" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__3 +msgid "Thursday" +msgstr "Jueves" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__1 +msgid "Tuesday" +msgstr "Martes" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__2 +msgid "Wednesday" +msgstr "Miercoles" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_partner__invoicing_mode__weekly +msgid "Weekly" +msgstr "Semanalmente" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Weekly Invoicing Day" +msgstr "Día de la facturación semanal" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly invoicing day" +msgstr "Día de la facturación semanal" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Weekly last execution" +msgstr "Última ejecución semanal" diff --git a/partner_invoicing_mode_weekly/i18n/fr.po b/partner_invoicing_mode_weekly/i18n/fr.po new file mode 100644 index 00000000000..000f1bee419 --- /dev/null +++ b/partner_invoicing_mode_weekly/i18n/fr.po @@ -0,0 +1,159 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_mode_weekly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-06-28 08:02+0000\n" +"PO-Revision-Date: 2021-06-28 08:02+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly Invoicing Options" +msgstr "" +"Options pour la facturation hebdomadaire" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_company +msgid "Companies" +msgstr "Sociétés" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_config_settings +msgid "Config Settings" +msgstr "Paramètres de config" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_partner +msgid "Contact" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Day of the week to execute the invoicing." +msgstr "Jour de la semaine pour exécuter la facturation." + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__4 +msgid "Friday" +msgstr "Vendredi" + +#. module: account_invoice_mode_weekly +#: model:ir.actions.server,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice_ir_actions_server +#: model:ir.cron,cron_name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +#: model:ir.cron,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +msgid "Generate Weekly Invoices" +msgstr "Générer les factures hebdomadaires" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_users__invoicing_mode +msgid "Invoicing Mode" +msgstr "Mode de facturation" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Invoicing Weekly" +msgstr "Facturation hebdomadaire" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Last executed on" +msgstr "Dernière exécution le" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Last execution of weekly invoicing." +msgstr "Dernière exécution de la facturation hebdomadaire" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__0 +msgid "Monday" +msgstr "Lundi" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_sale_order +msgid "Sales Order" +msgstr "Bon de commande" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__5 +msgid "Saturday" +msgstr "Samedi" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__6 +msgid "Sunday" +msgstr "Dimanche" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__3 +msgid "Thursday" +msgstr "Jeudi" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__1 +msgid "Tuesday" +msgstr "Mardi" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__2 +msgid "Wednesday" +msgstr "Mercredi" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_partner__invoicing_mode__weekly +msgid "Weekly" +msgstr "Hebdomadaire" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Weekly Invoicing Day" +msgstr "Jour de facturation hebdomadaire" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly invoicing day" +msgstr "Jour de facturation hebdomadaire" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Weekly last execution" +msgstr "Dernière exécution hebdomadaire" diff --git a/partner_invoicing_mode_weekly/i18n/nl.po b/partner_invoicing_mode_weekly/i18n/nl.po new file mode 100644 index 00000000000..7c03c659df2 --- /dev/null +++ b/partner_invoicing_mode_weekly/i18n/nl.po @@ -0,0 +1,158 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_mode_weekly +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-01-28 00:48+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\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.3.2\n" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly Invoicing Options" +msgstr "Weekelijkse Facturatie Opties" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_company +msgid "Companies" +msgstr "Bedrijven" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_config_settings +msgid "Config Settings" +msgstr "Instellingen" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_res_partner +msgid "Contact" +msgstr "Contact" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Day of the week to execute the invoicing." +msgstr "Dag van de week waarop te factureren." + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__display_name +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__display_name +msgid "Display Name" +msgstr "Weergavenaam" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__4 +msgid "Friday" +msgstr "Vrijdag" + +#. module: account_invoice_mode_weekly +#: model:ir.actions.server,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice_ir_actions_server +#: model:ir.cron,cron_name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +#: model:ir.cron,name:account_invoice_mode_weekly.ir_cron_generate_weekly_invoice +msgid "Generate Weekly Invoices" +msgstr "Genereer weekelijkse facturen" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__id +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order__id +msgid "ID" +msgstr "ID" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner__invoicing_mode +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_users__invoicing_mode +msgid "Invoicing Mode" +msgstr "Factuur mode" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Invoicing Weekly" +msgstr "Wekelijkse facturatie" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_partner____last_update +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_sale_order____last_update +msgid "Last Modified on" +msgstr "Laatst bijgewerkt op" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Last executed on" +msgstr "Laatst uitgevoerd op" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,help:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Last execution of weekly invoicing." +msgstr "Laatste wekelijkse facturatie uitgevoerd." + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__0 +msgid "Monday" +msgstr "Maandag" + +#. module: account_invoice_mode_weekly +#: model:ir.model,name:account_invoice_mode_weekly.model_sale_order +msgid "Sales Order" +msgstr "Verkooporder" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__5 +msgid "Saturday" +msgstr "Zaterdag" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__6 +msgid "Sunday" +msgstr "Zondag" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__3 +msgid "Thursday" +msgstr "Donderdag" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__1 +msgid "Tuesday" +msgstr "Dinsdag" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_company__invoicing_mode_weekly_day_todo__2 +msgid "Wednesday" +msgstr "Woensdag" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields.selection,name:account_invoice_mode_weekly.selection__res_partner__invoicing_mode__weekly +msgid "Weekly" +msgstr "Wekelijks" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_day_todo +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__res_invoicing_mode_weekly_day_todo +msgid "Weekly Invoicing Day" +msgstr "Wekelijkse facturatie dag" + +#. module: account_invoice_mode_weekly +#: model_terms:ir.ui.view,arch_db:account_invoice_mode_weekly.res_config_settings_view_form +msgid "Weekly invoicing day" +msgstr "Wekelijkse facturatie dag" + +#. module: account_invoice_mode_weekly +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_company__invoicing_mode_weekly_last_execution +#: model:ir.model.fields,field_description:account_invoice_mode_weekly.field_res_config_settings__invoicing_mode_weekly_last_execution +msgid "Weekly last execution" +msgstr "Laatste weekelijkse uitvoering" diff --git a/partner_invoicing_mode_weekly/models/__init__.py b/partner_invoicing_mode_weekly/models/__init__.py new file mode 100644 index 00000000000..ea64a69d2e0 --- /dev/null +++ b/partner_invoicing_mode_weekly/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_weekly/models/res_company.py b/partner_invoicing_mode_weekly/models/res_company.py new file mode 100644 index 00000000000..9a8c69de92d --- /dev/null +++ b/partner_invoicing_mode_weekly/models/res_company.py @@ -0,0 +1,28 @@ +# Copyright 2021 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_weekly_day_todo = fields.Selection( + selection=[ + ("0", "Monday"), + ("1", "Tuesday"), + ("2", "Wednesday"), + ("3", "Thursday"), + ("4", "Friday"), + ("5", "Saturday"), + ("6", "Sunday"), + ], + default="0", + string="Weekly Invoicing Day", + help="Day of the week to execute the invoicing.", + ) + invoicing_mode_weekly_last_execution = fields.Datetime( + string="Weekly last execution", + help="Last execution of weekly invoicing.", + readonly=True, + ) diff --git a/partner_invoicing_mode_weekly/models/res_config_settings.py b/partner_invoicing_mode_weekly/models/res_config_settings.py new file mode 100644 index 00000000000..6da13dd2570 --- /dev/null +++ b/partner_invoicing_mode_weekly/models/res_config_settings.py @@ -0,0 +1,16 @@ +# Copyright 2021 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_weekly_day_todo = fields.Selection( + related="company_id.invoicing_mode_weekly_day_todo", readonly=False + ) + invoicing_mode_weekly_last_execution = fields.Datetime( + related="company_id.invoicing_mode_weekly_last_execution", + readonly=True, + ) diff --git a/partner_invoicing_mode_weekly/models/res_partner.py b/partner_invoicing_mode_weekly/models/res_partner.py new file mode 100644 index 00000000000..15c07ef0afa --- /dev/null +++ b/partner_invoicing_mode_weekly/models/res_partner.py @@ -0,0 +1,13 @@ +# Copyright 2021 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=[("weekly", "Weekly")], + ondelete={"weekly": "set default"}, + ) diff --git a/partner_invoicing_mode_weekly/models/sale_order.py b/partner_invoicing_mode_weekly/models/sale_order.py new file mode 100644 index 00000000000..de2dadfd093 --- /dev/null +++ b/partner_invoicing_mode_weekly/models/sale_order.py @@ -0,0 +1,41 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import api, models +from odoo.fields import Datetime + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + @api.model + def cron_generate_weekly_invoices(self): + company_ids = self._get_companies_weekly_invoicing() + if company_ids: + self.generate_invoices( + company_ids, + invoicing_mode="weekly", + last_execution_field="invoicing_mode_weekly_last_execution", + ) + + @api.model + def generate_weekly_invoices(self, companies=None): + # TODO: Kept former function for backward compatibility. To remove + # in further version. + return self.generate_invoices( + companies, + invoicing_mode="weekly", + last_execution_field="invoicing_mode_weekly_last_execution", + ) + + @api.model + def _get_companies_weekly_invoicing(self): + """Get company ids for which today is weekly invoicing day.""" + today = Datetime.now() + domain = [ + "|", + ("invoicing_mode_weekly_last_execution", "<", today), + ("invoicing_mode_weekly_last_execution", "=", False), + ("invoicing_mode_weekly_day_todo", "=", today.weekday()), + ] + return self.env["res.company"].search(domain) diff --git a/partner_invoicing_mode_weekly/readme/CONTRIBUTORS.rst b/partner_invoicing_mode_weekly/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..408cf443dc0 --- /dev/null +++ b/partner_invoicing_mode_weekly/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* `Camptocamp `_: + + * Julien Coux + +* `ACSONE SA/NV `_: + + * Denis Roussel diff --git a/partner_invoicing_mode_weekly/readme/CREDITS.rst b/partner_invoicing_mode_weekly/readme/CREDITS.rst new file mode 100644 index 00000000000..f5cc070c78e --- /dev/null +++ b/partner_invoicing_mode_weekly/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Camptocamp diff --git a/partner_invoicing_mode_weekly/readme/DESCRIPTION.rst b/partner_invoicing_mode_weekly/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..e71c8dfdbbc --- /dev/null +++ b/partner_invoicing_mode_weekly/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module allows to select a weekly invoicing mode for a customer. +It is based on `account_invoice_base_invoicing_mode`. +When this mode is selected for a customer, the customer will be automatically +invoiced diff --git a/partner_invoicing_mode_weekly/static/description/icon.png b/partner_invoicing_mode_weekly/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/partner_invoicing_mode_weekly/static/description/icon.png differ diff --git a/partner_invoicing_mode_weekly/static/description/index.html b/partner_invoicing_mode_weekly/static/description/index.html new file mode 100644 index 00000000000..f1fc21a00c0 --- /dev/null +++ b/partner_invoicing_mode_weekly/static/description/index.html @@ -0,0 +1,436 @@ + + + + + + +Account Invoice Mode Weekly + + + +
+

Account Invoice Mode Weekly

+ + +

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

+

This module allows to select a weekly invoicing mode for a customer. +It is based on account_invoice_base_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 smashing 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_weekly/tests/__init__.py b/partner_invoicing_mode_weekly/tests/__init__.py new file mode 100644 index 00000000000..f802317a68c --- /dev/null +++ b/partner_invoicing_mode_weekly/tests/__init__.py @@ -0,0 +1,2 @@ +from . import test_invoice_mode_weekly +from . import test_invoice_mode_weekly_is_it_today diff --git a/partner_invoicing_mode_weekly/tests/test_invoice_mode_weekly.py b/partner_invoicing_mode_weekly/tests/test_invoice_mode_weekly.py new file mode 100644 index 00000000000..5c679b00b21 --- /dev/null +++ b/partner_invoicing_mode_weekly/tests/test_invoice_mode_weekly.py @@ -0,0 +1,138 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) +from freezegun import freeze_time + +from odoo import fields, tools +from odoo.tests.common import TransactionCase +from odoo.tools import relativedelta + +from odoo.addons.partner_invoicing_mode.tests.common import CommonPartnerInvoicingMode +from odoo.addons.queue_job.tests.common import trap_jobs + + +class TestInvoiceModeWeekly(CommonPartnerInvoicingMode, TransactionCase): + + _invoicing_mode = "weekly" + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.cron = cls.env.ref( + "partner_invoicing_mode_weekly.ir_cron_generate_weekly_invoice" + ) + + 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._confirm_and_deliver(self.so1) + self.so2.payment_term_id = self.pt2.id + self._confirm_and_deliver(self.so2) + with tools.mute_logger("odoo.addons.queue_job.models.base"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_weekly_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._confirm_and_deliver(self.so1) + self._confirm_and_deliver(self.so2) + with tools.mute_logger("odoo.addons.queue_job.models.base"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_weekly_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 = "weekly" + self.partner.one_invoice_per_order = True + self._confirm_and_deliver(self.so1) + self._confirm_and_deliver(self.so2) + with tools.mute_logger("odoo.addons.queue_job.models.base"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_weekly_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 = "weekly" + self.so2.partner_id = self.partner2 + self.so2.partner_invoice_id = self.partner2 + self.so2.partner_shipping_id = self.partner2 + self._confirm_and_deliver(self.so1) + self._confirm_and_deliver(self.so2) + with tools.mute_logger("odoo.addons.queue_job.models.base"): + self.SaleOrder.with_context( + test_queue_job_no_delay=True + ).generate_weekly_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") + + @freeze_time("2023-05-10") + def test_cron(self): + # Today is Wednesday + self.env.company.invoicing_mode_weekly_last_execution = ( + fields.Datetime.now() - relativedelta(days=10) + ) + self.env.company.invoicing_mode_weekly_day_todo = "2" + self.partner.invoicing_mode = "weekly" + self.so2.partner_id = self.partner2 + self.so2.partner_invoice_id = self.partner2 + self.so2.partner_shipping_id = self.partner2 + self._confirm_and_deliver(self.so1) + self._confirm_and_deliver(self.so2) + with trap_jobs() as trap: + self.env["sale.order"].cron_generate_weekly_invoices() + trap.assert_jobs_count(2) + trap.assert_enqueued_job( + self.env["sale.order"]._generate_invoices_by_partner, + args=(self.so1.ids,), + kwargs={}, + ) + with trap_jobs() as trap_invoice: + for job in trap.enqueued_jobs: + if job.args == (self.so1.ids,): + job.perform() + trap_invoice.assert_jobs_count(1) + trap_invoice.assert_enqueued_job( + self.so1.invoice_ids._validate_invoice, + args=(), + kwargs={}, + ) + trap_invoice.enqueued_jobs[0].perform() + + with trap_jobs() as trap_invoice: + for job in trap.enqueued_jobs: + if job.args == (self.so2.ids,): + job.perform() + trap_invoice.assert_jobs_count(1) + trap_invoice.assert_enqueued_job( + self.so2.invoice_ids._validate_invoice, + args=(), + kwargs={}, + ) + trap_invoice.enqueued_jobs[0].perform() + + 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_weekly/tests/test_invoice_mode_weekly_is_it_today.py b/partner_invoicing_mode_weekly/tests/test_invoice_mode_weekly_is_it_today.py new file mode 100644 index 00000000000..2c877201f5d --- /dev/null +++ b/partner_invoicing_mode_weekly/tests/test_invoice_mode_weekly_is_it_today.py @@ -0,0 +1,45 @@ +# Copyright 2021 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 TestInvoiceModeWeekly(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.company = cls.env.company + cls.SaleOrder = cls.env["sale.order"] + + def test_late_invoicing_for_last_week(self): + """Check that last week invoicing will be done if missed.""" + company = self.env.company + company.invoicing_mode_weekly_day_todo = "4" # Friday + company.invoicing_mode_weekly_last_execution = "2020-07-02" + self.assertTrue(self.env.company) + with freeze_time("2020-07-03"): + res = self.SaleOrder._get_companies_weekly_invoicing() + self.assertTrue(res) + company.invoicing_mode_weekly_last_execution = "2020-07-04" + with freeze_time("2020-07-03"): + res = self.SaleOrder._get_companies_weekly_invoicing() + self.assertFalse(res) + + def test_no_invoicing_done_yet(self): + """Check when is the first weekly invoicing done. + + When weekly invoicing has never been done, it will not be run + for the previous week. + """ + company = self.env.company + company.invoicing_mode_weekly_day_todo = "0" # Monday + company.invoicing_mode_weekly_last_execution = None + self.assertTrue(self.env.company) + with freeze_time("2020-06-07"): + res = self.SaleOrder._get_companies_weekly_invoicing() + self.assertFalse(res) + with freeze_time("2020-06-08"): + res = self.SaleOrder._get_companies_weekly_invoicing() + self.assertTrue(res) diff --git a/partner_invoicing_mode_weekly/views/res_config_settings_views.xml b/partner_invoicing_mode_weekly/views/res_config_settings_views.xml new file mode 100644 index 00000000000..214f6d7e64c --- /dev/null +++ b/partner_invoicing_mode_weekly/views/res_config_settings_views.xml @@ -0,0 +1,42 @@ + + + + + res.config.settings + +
+
+
+
+
+ Weekly Invoicing Options +
+
+
+
+
+
+
+
+
+
+ + + diff --git a/setup/partner_invoicing_mode_weekly/odoo/addons/partner_invoicing_mode_weekly b/setup/partner_invoicing_mode_weekly/odoo/addons/partner_invoicing_mode_weekly new file mode 120000 index 00000000000..7cec696dbdb --- /dev/null +++ b/setup/partner_invoicing_mode_weekly/odoo/addons/partner_invoicing_mode_weekly @@ -0,0 +1 @@ +../../../../partner_invoicing_mode_weekly \ No newline at end of file diff --git a/setup/partner_invoicing_mode_weekly/setup.py b/setup/partner_invoicing_mode_weekly/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/partner_invoicing_mode_weekly/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000000..43915335d19 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-partner-invoicing-mode @ git+https://github.com/OCA/account-invoicing@refs/pull/1515/head#subdirectory=setup/partner_invoicing_mode