diff --git a/sale_order_partner_invoice_period/README.rst b/sale_order_partner_invoice_period/README.rst new file mode 100644 index 0000000..ce8f8e7 --- /dev/null +++ b/sale_order_partner_invoice_period/README.rst @@ -0,0 +1,60 @@ +====================== +Partner Invoice Period +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a939bca2525b4823de1a42085310d7c9a30bc7fe9b2d1e5aef8d17bc1ab30e36 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-solvosci%2Fslv--sale-lightgray.png?logo=github + :target: https://github.com/solvosci/slv-sale/tree/17.0/sale_order_partner_invoice_period + :alt: solvosci/slv-sale + +|badge1| |badge2| |badge3| + +Adds a selector of period to invoice directions. + +**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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Solvos + +Contributors +~~~~~~~~~~~~ + +* Dante Pereyra + +Maintainers +~~~~~~~~~~~ + +This module is part of the `solvosci/slv-sale `_ project on GitHub. + +You are welcome to contribute. diff --git a/sale_order_partner_invoice_period/__init__.py b/sale_order_partner_invoice_period/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/sale_order_partner_invoice_period/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_order_partner_invoice_period/__manifest__.py b/sale_order_partner_invoice_period/__manifest__.py new file mode 100644 index 0000000..22c4300 --- /dev/null +++ b/sale_order_partner_invoice_period/__manifest__.py @@ -0,0 +1,20 @@ +# © 2024 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html +{ + "name": "Partner Invoice Period", + "summary": """ Adds selection of period to invoice direction """, + "author": "Solvos", + "license": "LGPL-3", + "version": "17.0.1.0.0", + "category": "Sales/Sales", + "website": "https://github.com/solvosci/slv-sale", + "depends": [ + "sale" + ], + "data": [ + "views/res_partner_view.xml", + "views/sale_order_view.xml", + "views/res_config_settings.xml" + ], + 'installable': True, +} diff --git a/sale_order_partner_invoice_period/i18n/es.po b/sale_order_partner_invoice_period/i18n/es.po new file mode 100644 index 0000000..61c49f3 --- /dev/null +++ b/sale_order_partner_invoice_period/i18n/es.po @@ -0,0 +1,69 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_partner_invoice_period +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-22 10:06+0000\n" +"PO-Revision-Date: 2024-11-22 10:06+0000\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: sale_order_partner_invoice_period +#: model:ir.model,name:sale_order_partner_invoice_period.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__daily +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__daily +msgid "Daily" +msgstr "Diario" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__fortnightly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__fortnightly +msgid "Fortnightly" +msgstr "Quincenal" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields,field_description:sale_order_partner_invoice_period.field_res_partner__invoice_period +#: model:ir.model.fields,field_description:sale_order_partner_invoice_period.field_res_users__invoice_period +#: model:ir.model.fields,field_description:sale_order_partner_invoice_period.field_sale_order__partner_invoice_period +msgid "Invoice Period" +msgstr "Periodo de facturación" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__monthly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__monthly +msgid "Monthly" +msgstr "Mensual" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__quarterly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__quarterly +msgid "Quarterly" +msgstr "Trimestral" + +#. module: sale_order_partner_invoice_period +#: model:ir.model,name:sale_order_partner_invoice_period.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__weekly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__weekly +msgid "Weekly" +msgstr "Semanal" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__yearly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__yearly +msgid "Yearly" +msgstr "Anual" diff --git a/sale_order_partner_invoice_period/i18n/sale_order_partner_invoice_period.pot b/sale_order_partner_invoice_period/i18n/sale_order_partner_invoice_period.pot new file mode 100644 index 0000000..436de38 --- /dev/null +++ b/sale_order_partner_invoice_period/i18n/sale_order_partner_invoice_period.pot @@ -0,0 +1,69 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_partner_invoice_period +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-22 10:06+0000\n" +"PO-Revision-Date: 2024-11-22 10:06+0000\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: sale_order_partner_invoice_period +#: model:ir.model,name:sale_order_partner_invoice_period.model_res_partner +msgid "Contact" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__daily +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__daily +msgid "Daily" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__fortnightly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__fortnightly +msgid "Fortnightly" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields,field_description:sale_order_partner_invoice_period.field_res_partner__invoice_period +#: model:ir.model.fields,field_description:sale_order_partner_invoice_period.field_res_users__invoice_period +#: model:ir.model.fields,field_description:sale_order_partner_invoice_period.field_sale_order__partner_invoice_period +msgid "Invoice Period" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__monthly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__monthly +msgid "Monthly" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__quarterly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__quarterly +msgid "Quarterly" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model,name:sale_order_partner_invoice_period.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__weekly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__weekly +msgid "Weekly" +msgstr "" + +#. module: sale_order_partner_invoice_period +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__res_partner__invoice_period__yearly +#: model:ir.model.fields.selection,name:sale_order_partner_invoice_period.selection__sale_order__partner_invoice_period__yearly +msgid "Yearly" +msgstr "" diff --git a/sale_order_partner_invoice_period/models/__init__.py b/sale_order_partner_invoice_period/models/__init__.py new file mode 100644 index 0000000..bf130d4 --- /dev/null +++ b/sale_order_partner_invoice_period/models/__init__.py @@ -0,0 +1,3 @@ +from . import res_config_settings +from . import res_partner +from . import sale_order diff --git a/sale_order_partner_invoice_period/models/res_config_settings.py b/sale_order_partner_invoice_period/models/res_config_settings.py new file mode 100644 index 0000000..03e4aff --- /dev/null +++ b/sale_order_partner_invoice_period/models/res_config_settings.py @@ -0,0 +1,20 @@ +# © 2024 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html +from odoo import fields, models +from .res_partner import INVOICE_PERIOD_SELECTION + +class ResCompany(models.Model): + _inherit = "res.company" + + invoice_period_default = fields.Selection(INVOICE_PERIOD_SELECTION) + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + invoice_period_default = fields.Selection( + selection=INVOICE_PERIOD_SELECTION, + related='company_id.invoice_period_default', + help="Select default invoice period for new companys", + readonly=False + ) + \ No newline at end of file diff --git a/sale_order_partner_invoice_period/models/res_partner.py b/sale_order_partner_invoice_period/models/res_partner.py new file mode 100644 index 0000000..1b789b2 --- /dev/null +++ b/sale_order_partner_invoice_period/models/res_partner.py @@ -0,0 +1,27 @@ +# © 2024 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html +from odoo import models, fields, api + +INVOICE_PERIOD_SELECTION = [ + ('daily','Daily'), + ('weekly','Weekly'), + ('fortnightly','Fortnightly'), + ('monthly','Monthly'), + ('quarterly','Quarterly'), + ('yearly','Yearly') +] + +class ResPartner(models.Model): + _inherit = "res.partner" + + invoice_period = fields.Selection(INVOICE_PERIOD_SELECTION) + + @api.model + def create(self, vals): + partner = super(ResPartner, self).create(vals) + if not partner.invoice_period: + if partner.is_company: + partner.invoice_period = self.env.company.invoice_period_default + else: + partner.invoice_period = partner.parent_id.invoice_period + return partner diff --git a/sale_order_partner_invoice_period/models/sale_order.py b/sale_order_partner_invoice_period/models/sale_order.py new file mode 100644 index 0000000..6605740 --- /dev/null +++ b/sale_order_partner_invoice_period/models/sale_order.py @@ -0,0 +1,24 @@ +# © 2024 Solvos Consultoría Informática () +# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html +from odoo import models, fields, api +from .res_partner import INVOICE_PERIOD_SELECTION + +class SaleOrder(models.Model): + _inherit = "sale.order" + + partner_invoice_period = fields.Selection( + selection=INVOICE_PERIOD_SELECTION, + compute='_compute_partner_invoice_period', + string="Invoice Period", + store=True + ) + + @api.depends('partner_invoice_id.invoice_period', 'partner_invoice_id.parent_id.invoice_period') + def _compute_partner_invoice_period(self): + for order in self: + order.partner_invoice_period = ( + order.partner_invoice_id.invoice_period + or + order.partner_invoice_id.parent_id.invoice_period + ) + diff --git a/sale_order_partner_invoice_period/readme/CONTRIBUTORS.rst b/sale_order_partner_invoice_period/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..c70e05a --- /dev/null +++ b/sale_order_partner_invoice_period/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Dante Pereyra diff --git a/sale_order_partner_invoice_period/readme/DESCRIPTION.rst b/sale_order_partner_invoice_period/readme/DESCRIPTION.rst new file mode 100644 index 0000000..d677446 --- /dev/null +++ b/sale_order_partner_invoice_period/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Adds a selector of period to invoice directions. diff --git a/sale_order_partner_invoice_period/static/description/icon.png b/sale_order_partner_invoice_period/static/description/icon.png new file mode 100644 index 0000000..daa2a02 Binary files /dev/null and b/sale_order_partner_invoice_period/static/description/icon.png differ diff --git a/sale_order_partner_invoice_period/static/description/index.html b/sale_order_partner_invoice_period/static/description/index.html new file mode 100644 index 0000000..912f130 --- /dev/null +++ b/sale_order_partner_invoice_period/static/description/index.html @@ -0,0 +1,415 @@ + + + + + +Partner Invoice Period + + + +
+

Partner Invoice Period

+ + +

Beta License: LGPL-3 solvosci/slv-sale

+

Adds a selector of period to invoice directions.

+

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

+
    +
  • Solvos
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the solvosci/slv-sale project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/sale_order_partner_invoice_period/views/res_config_settings.xml b/sale_order_partner_invoice_period/views/res_config_settings.xml new file mode 100644 index 0000000..365bcc8 --- /dev/null +++ b/sale_order_partner_invoice_period/views/res_config_settings.xml @@ -0,0 +1,20 @@ + + + + + + res.config.settings.view.form.inherit.sale (in sale_order_partner_invoice_period) + + res.config.settings + + + + + + + + + + + + diff --git a/sale_order_partner_invoice_period/views/res_partner_view.xml b/sale_order_partner_invoice_period/views/res_partner_view.xml new file mode 100644 index 0000000..1c0a8fa --- /dev/null +++ b/sale_order_partner_invoice_period/views/res_partner_view.xml @@ -0,0 +1,15 @@ + + + + + res.partner.property.form.inherit (in sale_order_partner_invoice_period) + res.partner + + + + + + + + + diff --git a/sale_order_partner_invoice_period/views/sale_order_view.xml b/sale_order_partner_invoice_period/views/sale_order_view.xml new file mode 100644 index 0000000..66883df --- /dev/null +++ b/sale_order_partner_invoice_period/views/sale_order_view.xml @@ -0,0 +1,42 @@ + + + + + sale.order.form (in sale_order_partner_invoice_period) + sale.order + + + + + + + + + + + sale.order.list.select (in sale_order_partner_invoice_period) + sale.order + + + + + + + + + + + + + + sale.order.tree (in sale_order_partner_invoice_period) + sale.order + + + + + + + + +