diff --git a/oca_dependencies.txt b/oca_dependencies.txt new file mode 100644 index 00000000000..d8a2d4efc0c --- /dev/null +++ b/oca_dependencies.txt @@ -0,0 +1 @@ +product-attribute diff --git a/sale_order_secondary_unit/README.rst b/sale_order_secondary_unit/README.rst index b8fe037a0f0..a0ad715cd39 100644 --- a/sale_order_secondary_unit/README.rst +++ b/sale_order_secondary_unit/README.rst @@ -14,13 +14,13 @@ Sale Order Secondary Unit :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/sale-workflow/tree/12.0/sale_order_secondary_unit + :target: https://github.com/OCA/sale-workflow/tree/13.0/sale_order_secondary_unit :alt: OCA/sale-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_order_secondary_unit + :target: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_order_secondary_unit :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/167/12.0 + :target: https://runbot.odoo-community.org/runbot/167/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -50,7 +50,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -82,6 +82,6 @@ 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/sale-workflow `_ project on GitHub. +This module is part of the `OCA/sale-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_secondary_unit/__manifest__.py b/sale_order_secondary_unit/__manifest__.py index 5e3a4da9629..f85a865ec33 100644 --- a/sale_order_secondary_unit/__manifest__.py +++ b/sale_order_secondary_unit/__manifest__.py @@ -1,24 +1,21 @@ -# Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2018-2020 Tecnativa - Carlos Dauden # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { - 'name': 'Sale Order Secondary Unit', - 'summary': 'Sale product in a secondary unit', - 'version': '12.0.1.0.0', - 'development_status': 'Beta', - 'category': 'Sale', - 'website': 'https://github.com/OCA/sale-workflow', - 'author': 'Tecnativa, Odoo Community Association (OCA)', - 'license': 'AGPL-3', - 'application': False, - 'installable': True, - 'auto_install': True, - 'depends': [ - 'sale', - 'product_secondary_unit', - ], - 'data': [ - 'views/product_views.xml', - 'views/sale_order_views.xml', - 'report/sale_report_templates.xml', + "name": "Sale Order Secondary Unit", + "summary": "Sale product in a secondary unit", + "version": "13.0.1.0.0", + "development_status": "Beta", + "category": "Sale", + "website": "https://github.com/OCA/sale-workflow", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "auto_install": True, + "depends": ["sale", "product_secondary_unit"], + "data": [ + "views/product_views.xml", + "views/sale_order_views.xml", + "report/sale_report_templates.xml", ], } diff --git a/sale_order_secondary_unit/i18n/de.po b/sale_order_secondary_unit/i18n/de.po index 70f8516a3d0..86bc7e97d98 100644 --- a/sale_order_secondary_unit/i18n/de.po +++ b/sale_order_secondary_unit/i18n/de.po @@ -6,6 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-01-15 13:25+0000\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "Language: de\n" diff --git a/sale_order_secondary_unit/i18n/sale_order_secondary_unit.pot b/sale_order_secondary_unit/i18n/sale_order_secondary_unit.pot index 47e9d073cfc..bf660f90087 100644 --- a/sale_order_secondary_unit/i18n/sale_order_secondary_unit.pot +++ b/sale_order_secondary_unit/i18n/sale_order_secondary_unit.pot @@ -1,12 +1,14 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_order_secondary_unit +# * sale_order_secondary_unit # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2020-01-15 13:25+0000\n" +"PO-Revision-Date: 2020-01-15 13:25+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -43,4 +45,3 @@ msgstr "" #: model:ir.model.fields,field_description:sale_order_secondary_unit.field_sale_order_line__secondary_uom_id msgid "Secondary uom" msgstr "" - diff --git a/sale_order_secondary_unit/i18n/zh_CN.po b/sale_order_secondary_unit/i18n/zh_CN.po index 3151ef69529..9908328ab32 100644 --- a/sale_order_secondary_unit/i18n/zh_CN.po +++ b/sale_order_secondary_unit/i18n/zh_CN.po @@ -6,6 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-01-15 13:25+0000\n" "Last-Translator: Tony Gu \n" "Language-Team: \n" "Language: \n" diff --git a/sale_order_secondary_unit/models/product_template.py b/sale_order_secondary_unit/models/product_template.py index d3908451d30..86c1dc60c79 100644 --- a/sale_order_secondary_unit/models/product_template.py +++ b/sale_order_secondary_unit/models/product_template.py @@ -1,12 +1,11 @@ -# Copyright 2018 Tecnativa - Sergio Teruel +# Copyright 2018-2020 Tecnativa - Sergio Teruel # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import fields, models class ProductTemplate(models.Model): - _inherit = 'product.template' + _inherit = "product.template" sale_secondary_uom_id = fields.Many2one( - comodel_name='product.secondary.unit', - string='Default secondary unit for sales', + comodel_name="product.secondary.unit", string="Default secondary unit for sales" ) diff --git a/sale_order_secondary_unit/models/sale_order.py b/sale_order_secondary_unit/models/sale_order.py index b8f9b858ec4..ee386fcf105 100644 --- a/sale_order_secondary_unit/models/sale_order.py +++ b/sale_order_secondary_unit/models/sale_order.py @@ -1,66 +1,77 @@ -# Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2018-2020 Tecnativa - Carlos Dauden # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, fields, models -from odoo.addons import decimal_precision as dp from odoo.tools.float_utils import float_compare, float_round class SaleOrderLine(models.Model): - _inherit = 'sale.order.line' + _inherit = "sale.order.line" secondary_uom_qty = fields.Float( - string='Secondary Qty', - digits=dp.get_precision('Product Unit of Measure'), + string="Secondary Qty", digits="Product Unit of Measure" ) secondary_uom_id = fields.Many2one( - comodel_name='product.secondary.unit', - string='Secondary uom', - ondelete='restrict', + comodel_name="product.secondary.unit", + string="Secondary uom", + ondelete="restrict", ) - @api.onchange('secondary_uom_id', 'secondary_uom_qty') + @api.onchange("secondary_uom_id", "secondary_uom_qty") def onchange_secondary_uom(self): if not self.secondary_uom_id: return factor = self.secondary_uom_id.factor * self.product_uom.factor qty = float_round( self.secondary_uom_qty * factor, - precision_rounding=self.product_uom.rounding + precision_rounding=self.product_uom.rounding, ) - if float_compare( - self.product_uom_qty, qty, - precision_rounding=self.product_uom.rounding) != 0: + if ( + float_compare( + self.product_uom_qty, qty, precision_rounding=self.product_uom.rounding + ) + != 0 + ): self.product_uom_qty = qty - @api.onchange('product_uom_qty') + @api.onchange("product_uom_qty") def onchange_secondary_unit_product_uom_qty(self): if not self.secondary_uom_id: return factor = self.secondary_uom_id.factor * self.product_uom.factor qty = float_round( self.product_uom_qty / (factor or 1.0), - precision_rounding=self.secondary_uom_id.uom_id.rounding + precision_rounding=self.secondary_uom_id.uom_id.rounding, ) - if float_compare( - self.secondary_uom_qty, qty, - precision_rounding=self.secondary_uom_id.uom_id.rounding) != 0: + if ( + float_compare( + self.secondary_uom_qty, + qty, + precision_rounding=self.secondary_uom_id.uom_id.rounding, + ) + != 0 + ): self.secondary_uom_qty = qty - @api.onchange('product_uom') + @api.onchange("product_uom") def onchange_product_uom_for_secondary(self): if not self.secondary_uom_id: return factor = self.product_uom.factor * self.secondary_uom_id.factor qty = float_round( self.product_uom_qty / (factor or 1.0), - precision_rounding=self.product_uom.rounding + precision_rounding=self.product_uom.rounding, ) - if float_compare( - self.secondary_uom_qty, qty, - precision_rounding=self.product_uom.rounding) != 0: + if ( + float_compare( + self.secondary_uom_qty, + qty, + precision_rounding=self.product_uom.rounding, + ) + != 0 + ): self.secondary_uom_qty = qty - @api.onchange('product_id') + @api.onchange("product_id") def product_id_change(self): """ If default sales secondary unit set on product, put on secondary @@ -68,7 +79,7 @@ def product_id_change(self): that is the one that sets by default 1 on the other quantity with that purpose. """ - res = super(SaleOrderLine, self).product_id_change() + res = super().product_id_change() self.secondary_uom_id = self.product_id.sale_secondary_uom_id if self.secondary_uom_id: self.secondary_uom_qty = 1.0 diff --git a/sale_order_secondary_unit/static/description/index.html b/sale_order_secondary_unit/static/description/index.html index bcd9284f41b..f23b60ee12b 100644 --- a/sale_order_secondary_unit/static/description/index.html +++ b/sale_order_secondary_unit/static/description/index.html @@ -3,7 +3,7 @@ - + Sale Order Secondary Unit