From d149b4d4f6ef84db5c82d7d39e63c273e86dff2b Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Tue, 4 Aug 2015 14:52:40 +0200 Subject: [PATCH 01/13] rename packaging_extended to packaging_uom --- packaging_uom/README.rst | 63 ++++++++++++++ packaging_uom/__init__.py | 3 + packaging_uom/__openerp__.py | 36 ++++++++ packaging_uom/models/__init__.py | 3 + packaging_uom/models/product_packaging.py | 47 +++++++++++ packaging_uom/tests/__init__.py | 3 + packaging_uom/tests/test_packaging.py | 82 +++++++++++++++++++ .../views/product_packaging_views.xml | 45 ++++++++++ 8 files changed, 282 insertions(+) create mode 100644 packaging_uom/README.rst create mode 100755 packaging_uom/__init__.py create mode 100755 packaging_uom/__openerp__.py create mode 100755 packaging_uom/models/__init__.py create mode 100644 packaging_uom/models/product_packaging.py create mode 100644 packaging_uom/tests/__init__.py create mode 100644 packaging_uom/tests/test_packaging.py create mode 100644 packaging_uom/views/product_packaging_views.xml diff --git a/packaging_uom/README.rst b/packaging_uom/README.rst new file mode 100644 index 000000000..b9991eb7c --- /dev/null +++ b/packaging_uom/README.rst @@ -0,0 +1,63 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Packaging Extended +=========== + +This module was written to use unit of measure instead of quantity by package +in the definition of packaging. +The goal is to ease the use of packaging in sale and purchase. + +Installation +============ + +To install this module, you need to: + +* Click on install button + +Configuration +============= + +To configure this module, you need to: + +* on product packaging define the unit of measure to use. + +Usage +===== + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 + +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 +`here `_. + + +Credits +======= + +Contributors +------------ + +* Laetitia Gangloff +* Laurent Mignon + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file diff --git a/packaging_uom/__init__.py b/packaging_uom/__init__.py new file mode 100755 index 000000000..cde864bae --- /dev/null +++ b/packaging_uom/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/packaging_uom/__openerp__.py b/packaging_uom/__openerp__.py new file mode 100755 index 000000000..04c546571 --- /dev/null +++ b/packaging_uom/__openerp__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Authors: Laetitia Gangloff +# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + "name": "Packaging Extended", + "version": "0.1", + 'author': "Acsone, Odoo Community Association (OCA)", + "category": "Other", + "website": "http://www.acsone.eu", + 'summary': "Use uom in package", + "depends": ["product", + ], + "data": ["views/product_packaging_views.xml", + ], + "license": "AGPL-3", + "installable": True, + "application": False, +} diff --git a/packaging_uom/models/__init__.py b/packaging_uom/models/__init__.py new file mode 100755 index 000000000..87ac1c911 --- /dev/null +++ b/packaging_uom/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import product_packaging diff --git a/packaging_uom/models/product_packaging.py b/packaging_uom/models/product_packaging.py new file mode 100644 index 000000000..7eb394459 --- /dev/null +++ b/packaging_uom/models/product_packaging.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Authors: Laetitia Gangloff +# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +from openerp import api, fields, models + + +class ProductPackaging(models.Model): + _inherit = 'product.packaging' + + uom_id = fields.Many2one('product.uom', 'Unit of Measure', required=True, + help="It must be in the same category than " + "the default unit of measure.") + uom_categ_domain_id = fields.Many2one( + related='product_tmpl_id.uom_id.category_id', + comodel_name='product.uom.categ') + qty = fields.Float(compute="_compute_qty", store=True, readonly=True) + + @api.one + @api.depends('uom_id', 'product_tmpl_id.uom_id') + def _compute_qty(self): + """ + Compute the quantity by package based on uom + """ + if self.uom_id and self.product_tmpl_id: + self.qty = self.env['product.uom']._compute_qty_obj( + self.uom_id, 1, self.product_tmpl_id.uom_id) + else: + self.qty = 0 diff --git a/packaging_uom/tests/__init__.py b/packaging_uom/tests/__init__.py new file mode 100644 index 000000000..c8a922e42 --- /dev/null +++ b/packaging_uom/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_packaging diff --git a/packaging_uom/tests/test_packaging.py b/packaging_uom/tests/test_packaging.py new file mode 100644 index 000000000..105dd32d7 --- /dev/null +++ b/packaging_uom/tests/test_packaging.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Authors: Laetitia Gangloff +# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import openerp.tests.common as common + + +class TestPackaging(common.TransactionCase): + + def setUp(self): + super(TestPackaging, self).setUp() + + def test_compute_quantity_by_package(self): + """ Create a packagings with uom product_uom_dozen on + * product_product_35 (uom is product_uom_dozen) + * product_product_34 (uom is product_uom_unit) + Result should be : + * product_product_35 -> qty by package : 1 + * product_product_34 -> qty by package : 12 + Create product_uom_24 + Update product_product_35 to set this new uom + Result should be : + * product_product_35 -> qty by package : 0.5 + Update product_package_34 to set this new uom + Result should be : + * product_product_34 -> qty by package : 24 + Create product_uom 6 + Update product_product_35 to set this new uom + Result should be : + * product_product_35 -> qty by package : 2 + Update product_package_34 to set this new uom + Result should be : + * product_product_34 -> qty by package : 6 + """ + packaging_obj = self.env['product.packaging'] + product_packaging_35 = packaging_obj.create( + {'product_tmpl_id': self.env.ref('product.product_product_35' + ).product_tmpl_id.id, + 'uom_id': self.env.ref('product.product_uom_dozen').id}) + self.assertAlmostEqual(product_packaging_35.qty, 1) + product_packaging_34 = packaging_obj.create( + {'product_tmpl_id': self.env.ref('product.product_product_34' + ).product_tmpl_id.id, + 'uom_id': self.env.ref('product.product_uom_dozen').id}) + self.assertAlmostEqual(product_packaging_34.qty, 12) + product_uom_24 = self.env['product.uom'].create( + {'category_id': self.env.ref('product.product_uom_categ_unit').id, + 'name': 'Double Dozens', + 'factor_inv': 24, + 'uom_type': 'bigger' + }) + self.env.ref('product.product_product_35').uom_id = product_uom_24 + self.assertAlmostEqual(product_packaging_35.qty, 0.5) + product_packaging_34.uom_id = product_uom_24 + self.assertAlmostEqual(product_packaging_34.qty, 24) + product_uom_6 = self.env['product.uom'].create( + {'category_id': self.env.ref('product.product_uom_categ_unit').id, + 'name': 'Demi Dozens', + 'factor_inv': 6, + 'uom_type': 'bigger' + }) + self.env.ref('product.product_product_35').uom_id = product_uom_6 + self.assertAlmostEqual(product_packaging_35.qty, 2) + product_packaging_34.uom_id = product_uom_6 + self.assertAlmostEqual(product_packaging_34.qty, 6) diff --git a/packaging_uom/views/product_packaging_views.xml b/packaging_uom/views/product_packaging_views.xml new file mode 100644 index 000000000..ba53d764e --- /dev/null +++ b/packaging_uom/views/product_packaging_views.xml @@ -0,0 +1,45 @@ + + + + + + product.template.common.form (packaging_uom) + product.template + + + + + {'default_product_tmpl_id': id, + 'tree_view_ref':'product.product_packaging_tree_view_product', + 'form_view_ref': 'product.product_packaging_form_view_without_product'} + + + + + + product.packaging.form.view.without.product (packaging_uom) + product.packaging + + + + + + + + + + + + product.packaging.form.view (packaging_uom) + product.packaging + + + + + + + + + + + From 74ea81012484ab3fab08fcdb6105f524de1ddab9 Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Mon, 10 Aug 2015 15:14:23 +0200 Subject: [PATCH 02/13] purchase_packaging : compute price_unit with the new uom / packaging_management : update readme --- packaging_uom/README.rst | 4 ++-- packaging_uom/__openerp__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging_uom/README.rst b/packaging_uom/README.rst index b9991eb7c..8e626e7a8 100644 --- a/packaging_uom/README.rst +++ b/packaging_uom/README.rst @@ -1,8 +1,8 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 -Packaging Extended -=========== +Packaging UOM +============= This module was written to use unit of measure instead of quantity by package in the definition of packaging. diff --git a/packaging_uom/__openerp__.py b/packaging_uom/__openerp__.py index 04c546571..31de96b1f 100755 --- a/packaging_uom/__openerp__.py +++ b/packaging_uom/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## { - "name": "Packaging Extended", + "name": "Packaging UOM", "version": "0.1", 'author': "Acsone, Odoo Community Association (OCA)", "category": "Other", From 7a368c40d365c627489575f935317f3461787836 Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Wed, 18 Nov 2015 15:51:07 +0100 Subject: [PATCH 03/13] correct product creation with packaging --- packaging_uom/models/product_packaging.py | 10 +++++++++- packaging_uom/views/product_packaging_views.xml | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packaging_uom/models/product_packaging.py b/packaging_uom/models/product_packaging.py index 7eb394459..2d4b78518 100644 --- a/packaging_uom/models/product_packaging.py +++ b/packaging_uom/models/product_packaging.py @@ -26,11 +26,19 @@ from openerp import api, fields, models class ProductPackaging(models.Model): _inherit = 'product.packaging' + @api.model + def _default_uom_categ_domain_id(self): + uom_id = self.env.context.get("get_uom_categ_from_uom") + if not uom_id: + return self.env['product.uom.categ'] + uom = self.env['product.uom'].browse(uom_id) + return uom.category_id.id + uom_id = fields.Many2one('product.uom', 'Unit of Measure', required=True, help="It must be in the same category than " "the default unit of measure.") uom_categ_domain_id = fields.Many2one( - related='product_tmpl_id.uom_id.category_id', + default=_default_uom_categ_domain_id, comodel_name='product.uom.categ') qty = fields.Float(compute="_compute_qty", store=True, readonly=True) diff --git a/packaging_uom/views/product_packaging_views.xml b/packaging_uom/views/product_packaging_views.xml index ba53d764e..b94af7963 100644 --- a/packaging_uom/views/product_packaging_views.xml +++ b/packaging_uom/views/product_packaging_views.xml @@ -9,7 +9,7 @@ - {'default_product_tmpl_id': id, + {'get_uom_categ_from_uom': uom_id, 'tree_view_ref':'product.product_packaging_tree_view_product', 'form_view_ref': 'product.product_packaging_form_view_without_product'} @@ -22,7 +22,7 @@ - + From 4e2dcba532d5f36f8ccabbacf2dc92d0e9bb0175 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Thu, 9 Mar 2017 17:07:44 +0100 Subject: [PATCH 04/13] [MIG] packaging_uom, purchase_packaging, sale_packaging: Migrated to 10.0 --- packaging_uom/README.rst | 23 +++-- packaging_uom/__init__.py | 3 +- packaging_uom/__manifest__.py | 18 ++++ packaging_uom/__openerp__.py | 36 -------- packaging_uom/models/__init__.py | 2 + packaging_uom/models/product_packaging.py | 48 ++++------ packaging_uom/static/description/icon.png | Bin 0 -> 9455 bytes packaging_uom/tests/__init__.py | 4 +- packaging_uom/tests/test_packaging.py | 82 ------------------ packaging_uom/tests/test_product_packaging.py | 71 +++++++++++++++ .../views/product_packaging_views.xml | 71 +++++++-------- 11 files changed, 158 insertions(+), 200 deletions(-) create mode 100755 packaging_uom/__manifest__.py delete mode 100755 packaging_uom/__openerp__.py create mode 100644 packaging_uom/static/description/icon.png delete mode 100644 packaging_uom/tests/test_packaging.py create mode 100644 packaging_uom/tests/test_product_packaging.py diff --git a/packaging_uom/README.rst b/packaging_uom/README.rst index 8e626e7a8..ced4575d5 100644 --- a/packaging_uom/README.rst +++ b/packaging_uom/README.rst @@ -1,5 +1,6 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 Packaging UOM ============= @@ -25,22 +26,26 @@ To configure this module, you need to: Usage ===== -For further information, please visit: - -* https://www.odoo.com/forum/help-1 +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/153/10.0 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 -`here `_. - +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. Credits ======= +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ diff --git a/packaging_uom/__init__.py b/packaging_uom/__init__.py index cde864bae..239921736 100755 --- a/packaging_uom/__init__.py +++ b/packaging_uom/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- - +# Copyright 2015-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models diff --git a/packaging_uom/__manifest__.py b/packaging_uom/__manifest__.py new file mode 100755 index 000000000..61bba0786 --- /dev/null +++ b/packaging_uom/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2015-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Packaging UOM", + "version": "10.0.1.0.0", + "author": 'ACSONE SA/NV, ' + 'Odoo Community Association (OCA)', + "category": "Warehouse", + "website": "http://www.acsone.eu", + 'summary': "Use uom in package", + "depends": ["product", + ], + "data": ["views/product_packaging_views.xml", + ], + "license": "AGPL-3", + "installable": True, +} diff --git a/packaging_uom/__openerp__.py b/packaging_uom/__openerp__.py deleted file mode 100755 index 31de96b1f..000000000 --- a/packaging_uom/__openerp__.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Authors: Laetitia Gangloff -# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -{ - "name": "Packaging UOM", - "version": "0.1", - 'author': "Acsone, Odoo Community Association (OCA)", - "category": "Other", - "website": "http://www.acsone.eu", - 'summary': "Use uom in package", - "depends": ["product", - ], - "data": ["views/product_packaging_views.xml", - ], - "license": "AGPL-3", - "installable": True, - "application": False, -} diff --git a/packaging_uom/models/__init__.py b/packaging_uom/models/__init__.py index 87ac1c911..5296fa85a 100755 --- a/packaging_uom/models/__init__.py +++ b/packaging_uom/models/__init__.py @@ -1,3 +1,5 @@ # -*- coding: utf-8 -*- +# Copyright 2015-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import product_packaging diff --git a/packaging_uom/models/product_packaging.py b/packaging_uom/models/product_packaging.py index 2d4b78518..c98a2e28e 100644 --- a/packaging_uom/models/product_packaging.py +++ b/packaging_uom/models/product_packaging.py @@ -1,26 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Authors: Laetitia Gangloff -# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - - -from openerp import api, fields, models +# Copyright 2015-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models class ProductPackaging(models.Model): @@ -34,13 +15,22 @@ class ProductPackaging(models.Model): uom = self.env['product.uom'].browse(uom_id) return uom.category_id.id - uom_id = fields.Many2one('product.uom', 'Unit of Measure', required=True, - help="It must be in the same category than " - "the default unit of measure.") + uom_id = fields.Many2one( + 'product.uom', + 'Unit of Measure', + required=True, + help="It must be in the same category than " + "the default unit of measure." + ) uom_categ_domain_id = fields.Many2one( default=_default_uom_categ_domain_id, - comodel_name='product.uom.categ') - qty = fields.Float(compute="_compute_qty", store=True, readonly=True) + comodel_name='product.uom.categ' + ) + qty = fields.Float( + compute="_compute_qty", + store=True, + readonly=True + ) @api.one @api.depends('uom_id', 'product_tmpl_id.uom_id') @@ -49,7 +39,7 @@ class ProductPackaging(models.Model): Compute the quantity by package based on uom """ if self.uom_id and self.product_tmpl_id: - self.qty = self.env['product.uom']._compute_qty_obj( - self.uom_id, 1, self.product_tmpl_id.uom_id) + self.qty = self.uom_id._compute_quantity( + 1, to_unit=self.product_tmpl_id.uom_id) else: self.qty = 0 diff --git a/packaging_uom/static/description/icon.png b/packaging_uom/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R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index c8a922e42..a7d7d468e 100644 --- a/packaging_uom/tests/__init__.py +++ b/packaging_uom/tests/__init__.py @@ -1,3 +1,5 @@ # -*- coding: utf-8 -*- +# Copyright 2015-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import test_packaging +from . import test_product_packaging diff --git a/packaging_uom/tests/test_packaging.py b/packaging_uom/tests/test_packaging.py deleted file mode 100644 index 105dd32d7..000000000 --- a/packaging_uom/tests/test_packaging.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Authors: Laetitia Gangloff -# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import openerp.tests.common as common - - -class TestPackaging(common.TransactionCase): - - def setUp(self): - super(TestPackaging, self).setUp() - - def test_compute_quantity_by_package(self): - """ Create a packagings with uom product_uom_dozen on - * product_product_35 (uom is product_uom_dozen) - * product_product_34 (uom is product_uom_unit) - Result should be : - * product_product_35 -> qty by package : 1 - * product_product_34 -> qty by package : 12 - Create product_uom_24 - Update product_product_35 to set this new uom - Result should be : - * product_product_35 -> qty by package : 0.5 - Update product_package_34 to set this new uom - Result should be : - * product_product_34 -> qty by package : 24 - Create product_uom 6 - Update product_product_35 to set this new uom - Result should be : - * product_product_35 -> qty by package : 2 - Update product_package_34 to set this new uom - Result should be : - * product_product_34 -> qty by package : 6 - """ - packaging_obj = self.env['product.packaging'] - product_packaging_35 = packaging_obj.create( - {'product_tmpl_id': self.env.ref('product.product_product_35' - ).product_tmpl_id.id, - 'uom_id': self.env.ref('product.product_uom_dozen').id}) - self.assertAlmostEqual(product_packaging_35.qty, 1) - product_packaging_34 = packaging_obj.create( - {'product_tmpl_id': self.env.ref('product.product_product_34' - ).product_tmpl_id.id, - 'uom_id': self.env.ref('product.product_uom_dozen').id}) - self.assertAlmostEqual(product_packaging_34.qty, 12) - product_uom_24 = self.env['product.uom'].create( - {'category_id': self.env.ref('product.product_uom_categ_unit').id, - 'name': 'Double Dozens', - 'factor_inv': 24, - 'uom_type': 'bigger' - }) - self.env.ref('product.product_product_35').uom_id = product_uom_24 - self.assertAlmostEqual(product_packaging_35.qty, 0.5) - product_packaging_34.uom_id = product_uom_24 - self.assertAlmostEqual(product_packaging_34.qty, 24) - product_uom_6 = self.env['product.uom'].create( - {'category_id': self.env.ref('product.product_uom_categ_unit').id, - 'name': 'Demi Dozens', - 'factor_inv': 6, - 'uom_type': 'bigger' - }) - self.env.ref('product.product_product_35').uom_id = product_uom_6 - self.assertAlmostEqual(product_packaging_35.qty, 2) - product_packaging_34.uom_id = product_uom_6 - self.assertAlmostEqual(product_packaging_34.qty, 6) diff --git a/packaging_uom/tests/test_product_packaging.py b/packaging_uom/tests/test_product_packaging.py new file mode 100644 index 000000000..00b7d628b --- /dev/null +++ b/packaging_uom/tests/test_product_packaging.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# Copyright 2015-2017 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import odoo.tests.common as common + + +class TestProductPackaging(common.TransactionCase): + + def setUp(self): + super(TestProductPackaging, self).setUp() + self.uom_unit = self.env.ref('product.product_uom_unit') + self.uom_dozen = self.env.ref('product.product_uom_dozen') + self.product_tmpl_dozen = self.env[ + 'product.template'].new( + {'uom_id': self.uom_dozen}) + self.product_tmpl_unit = self.env[ + 'product.template'].new( + {'uom_id': self.uom_unit}) + + def test_compute_quantity_by_package(self): + """ Create a packagings with uom product_uom_dozen on + * product_tmpl_dozen (uom is product_uom_dozen) + * product_tmpl_unit (uom is product_uom_unit) + Result should be : + * product_tmpl_dozen -> qty by package : 1 + * product_tmpl_unit -> qty by package : 12 + Create product_uom_24 + Update product_tmpl_dozen to set this new uom + Result should be : + * product_tmpl_dozen -> qty by package : 0.5 + Update product_package_unit to set this new uom + Result should be : + * product_packaging_unit -> qty by package : 24 + Create product_uom 6 + Update product_tmpl_dozen to set this new uom + Result should be : + * product_packaging_dozen -> qty by package : 2 + Update product_packaging_unit to set this new uom + Result should be : + * product_packaging_unit -> qty by package : 6 + """ + + packaging_obj = self.env['product.packaging'] + product_packaging_dozen = packaging_obj.new( + {'product_tmpl_id': self.product_tmpl_dozen, + 'uom_id': self.uom_dozen}) + self.assertAlmostEqual(product_packaging_dozen.qty, 1) + product_packaging_unit = packaging_obj.new( + {'product_tmpl_id': self.product_tmpl_unit, + 'uom_id': self.uom_dozen}) + self.assertAlmostEqual(product_packaging_unit.qty, 12) + product_uom_24 = self.env['product.uom'].create( + {'category_id': self.env.ref('product.product_uom_categ_unit').id, + 'name': 'Double Dozens', + 'factor_inv': 24, + 'uom_type': 'bigger' + }) + self.product_tmpl_dozen.uom_id = product_uom_24 + self.assertAlmostEqual(product_packaging_dozen.qty, 0.5) + product_packaging_unit.uom_id = product_uom_24 + self.assertAlmostEqual(product_packaging_unit.qty, 24) + product_uom_6 = self.env['product.uom'].create( + {'category_id': self.env.ref('product.product_uom_categ_unit').id, + 'name': 'Demi Dozens', + 'factor_inv': 6, + 'uom_type': 'bigger' + }) + self.product_tmpl_dozen.uom_id = product_uom_6 + self.assertAlmostEqual(product_packaging_dozen.qty, 2) + product_packaging_unit.uom_id = product_uom_6 + self.assertAlmostEqual(product_packaging_unit.qty, 6) diff --git a/packaging_uom/views/product_packaging_views.xml b/packaging_uom/views/product_packaging_views.xml index b94af7963..1f3b1dd9c 100644 --- a/packaging_uom/views/product_packaging_views.xml +++ b/packaging_uom/views/product_packaging_views.xml @@ -1,45 +1,32 @@ - - + + + + product.template.common.form (packaging_uom) + product.template + + + + + + + + + + + - - product.template.common.form (packaging_uom) - product.template - - - - - {'get_uom_categ_from_uom': uom_id, - 'tree_view_ref':'product.product_packaging_tree_view_product', - 'form_view_ref': 'product.product_packaging_form_view_without_product'} - + + product.packaging.form.view (packaging_uom) + product.packaging + + + + + - - - - product.packaging.form.view.without.product (packaging_uom) - product.packaging - - - - - - - - - - - - product.packaging.form.view (packaging_uom) - product.packaging - - - - - - - - - - - + + + From 41af45de9af4fbd099fc478b72e6ffe3df0ac3dd Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Tue, 18 Apr 2017 11:16:47 +0200 Subject: [PATCH 05/13] [IMP] packaging_uom: declare 'inverse' method on qty This change is required to make the code working with existing addons without breaking tets. By declaring an invers on qty, we are able to assign/create the required uom to the package based on the expected qty --- packaging_uom/models/product_packaging.py | 43 +++++++++++++++++-- .../views/product_packaging_views.xml | 2 +- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/packaging_uom/models/product_packaging.py b/packaging_uom/models/product_packaging.py index c98a2e28e..20586ee41 100644 --- a/packaging_uom/models/product_packaging.py +++ b/packaging_uom/models/product_packaging.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # Copyright 2015-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError class ProductPackaging(models.Model): @@ -18,9 +19,9 @@ class ProductPackaging(models.Model): uom_id = fields.Many2one( 'product.uom', 'Unit of Measure', - required=True, help="It must be in the same category than " - "the default unit of measure." + "the default unit of measure.", + required=False ) uom_categ_domain_id = fields.Many2one( default=_default_uom_categ_domain_id, @@ -28,6 +29,7 @@ class ProductPackaging(models.Model): ) qty = fields.Float( compute="_compute_qty", + inverse="_inverse_qty", store=True, readonly=True ) @@ -43,3 +45,38 @@ class ProductPackaging(models.Model): 1, to_unit=self.product_tmpl_id.uom_id) else: self.qty = 0 + + @api.one + def _inverse_qty(self): + """ + The inverse method is defined to make the code compatible with + existing modules and to not break tests... + :return: + """ + category_id = self.product_tmpl_id.uom_id.category_id + uom_id = self.uom_id.search([ + ("factor", "=", 1.0 / self.qty), + ('category_id', '=', category_id.id)]) + if not uom_id: + uom_id = self.uom_id .create({ + 'name': "%s %s" % (category_id.name, self.qty), + 'category_id': category_id.id, + 'rounding': self.product_tmpl_id.uom_id.rounding, + 'uom_type': 'bigger', + 'factor_inv': self.qty, + 'active': True + }) + self.uom_id = uom_id + + @api.multi + @api.constrains + def _check_uom_id(self): + """ Check uom_id is not null + + Since the field can be computed by the inverse method on 'qty', + it's no more possible to add a sql constrains on the column uom_id. + """ + for rec in self: + if not rec.uom_id: + raise ValidationError(_("The field Unit of Measure is " + "required")) diff --git a/packaging_uom/views/product_packaging_views.xml b/packaging_uom/views/product_packaging_views.xml index 1f3b1dd9c..31a271220 100644 --- a/packaging_uom/views/product_packaging_views.xml +++ b/packaging_uom/views/product_packaging_views.xml @@ -25,7 +25,7 @@ - + From 77870ee252595962f32e478b316ac4b2d111fdeb Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 20 Apr 2017 14:27:53 +0200 Subject: [PATCH 06/13] [IMP] Adds the glue which fill in the product packaging in stock When a sale order is confirmed and product packaging is filled in sale order line(s), the information is propagated through procurement orders and stock moves. This is conditioned by a parameter on procurement rule. --- packaging_uom/models/product_packaging.py | 46 ++++++------- packaging_uom/tests/test_product_packaging.py | 66 +++++++++++++++---- 2 files changed, 78 insertions(+), 34 deletions(-) diff --git a/packaging_uom/models/product_packaging.py b/packaging_uom/models/product_packaging.py index 20586ee41..ab8422cb6 100644 --- a/packaging_uom/models/product_packaging.py +++ b/packaging_uom/models/product_packaging.py @@ -34,42 +34,44 @@ class ProductPackaging(models.Model): readonly=True ) - @api.one + @api.multi @api.depends('uom_id', 'product_tmpl_id.uom_id') def _compute_qty(self): """ Compute the quantity by package based on uom """ - if self.uom_id and self.product_tmpl_id: - self.qty = self.uom_id._compute_quantity( - 1, to_unit=self.product_tmpl_id.uom_id) - else: - self.qty = 0 + for packaging in self: + if packaging.uom_id and packaging.product_tmpl_id: + packaging.qty = packaging.uom_id._compute_quantity( + 1, to_unit=packaging.product_tmpl_id.uom_id) + else: + packaging.qty = 0 - @api.one + @api.multi def _inverse_qty(self): """ The inverse method is defined to make the code compatible with existing modules and to not break tests... :return: """ - category_id = self.product_tmpl_id.uom_id.category_id - uom_id = self.uom_id.search([ - ("factor", "=", 1.0 / self.qty), - ('category_id', '=', category_id.id)]) - if not uom_id: - uom_id = self.uom_id .create({ - 'name': "%s %s" % (category_id.name, self.qty), - 'category_id': category_id.id, - 'rounding': self.product_tmpl_id.uom_id.rounding, - 'uom_type': 'bigger', - 'factor_inv': self.qty, - 'active': True - }) - self.uom_id = uom_id + for packaging in self: + category_id = packaging.product_tmpl_id.uom_id.category_id + uom_id = packaging.uom_id.search([ + ("factor", "=", 1.0 / self.qty), + ('category_id', '=', category_id.id)]) + if not uom_id: + uom_id = packaging.uom_id.create({ + 'name': "%s %s" % (category_id.name, packaging.qty), + 'category_id': category_id.id, + 'rounding': packaging.product_tmpl_id.uom_id.rounding, + 'uom_type': 'bigger', + 'factor_inv': packaging.qty, + 'active': True + }) + packaging.uom_id = uom_id @api.multi - @api.constrains + @api.constrains('uom_id') def _check_uom_id(self): """ Check uom_id is not null diff --git a/packaging_uom/tests/test_product_packaging.py b/packaging_uom/tests/test_product_packaging.py index 00b7d628b..ad1af7c83 100644 --- a/packaging_uom/tests/test_product_packaging.py +++ b/packaging_uom/tests/test_product_packaging.py @@ -2,6 +2,7 @@ # Copyright 2015-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import odoo.tests.common as common +from odoo.exceptions import ValidationError class TestProductPackaging(common.TransactionCase): @@ -10,12 +11,13 @@ class TestProductPackaging(common.TransactionCase): super(TestProductPackaging, self).setUp() self.uom_unit = self.env.ref('product.product_uom_unit') self.uom_dozen = self.env.ref('product.product_uom_dozen') - self.product_tmpl_dozen = self.env[ - 'product.template'].new( - {'uom_id': self.uom_dozen}) - self.product_tmpl_unit = self.env[ - 'product.template'].new( - {'uom_id': self.uom_unit}) + self.product_tmpl_dozen = self.env['product.template'].create( + {'name': 'PRODUCT DOZEN', + 'uom_id': self.uom_dozen.id}) + self.product_tmpl_unit = self.env['product.template'].create( + {'name': 'PRODUCT UNIT', + 'uom_id': self.uom_unit.id} + ) def test_compute_quantity_by_package(self): """ Create a packagings with uom product_uom_dozen on @@ -41,14 +43,22 @@ class TestProductPackaging(common.TransactionCase): """ packaging_obj = self.env['product.packaging'] - product_packaging_dozen = packaging_obj.new( - {'product_tmpl_id': self.product_tmpl_dozen, - 'uom_id': self.uom_dozen}) + product_packaging_dozen = packaging_obj.create( + {'name': 'PACKAGING 1', + 'product_tmpl_id': self.product_tmpl_dozen.id, + 'uom_id': self.uom_dozen.id}) self.assertAlmostEqual(product_packaging_dozen.qty, 1) - product_packaging_unit = packaging_obj.new( - {'product_tmpl_id': self.product_tmpl_unit, - 'uom_id': self.uom_dozen}) + product_packaging_unit = packaging_obj.with_context( + get_uom_categ_from_uom=self.uom_dozen.category_id.id).create( + {'name': 'PACKAGING 2', + 'product_tmpl_id': self.product_tmpl_unit.id, + 'uom_id': self.uom_dozen.id}) self.assertAlmostEqual(product_packaging_unit.qty, 12) + self.assertEqual( + self.uom_dozen.category_id, + product_packaging_unit.uom_categ_domain_id, + 'The UOM domain is not well set' + ) product_uom_24 = self.env['product.uom'].create( {'category_id': self.env.ref('product.product_uom_categ_unit').id, 'name': 'Double Dozens', @@ -69,3 +79,35 @@ class TestProductPackaging(common.TransactionCase): self.assertAlmostEqual(product_packaging_dozen.qty, 2) product_packaging_unit.uom_id = product_uom_6 self.assertAlmostEqual(product_packaging_unit.qty, 6) + # Set Packaging Quantity + product_packaging_dozen.qty = 1 + self.assertEquals( + self.uom_unit, + product_packaging_dozen.uom_id + ) + # Try to set null on uom + with self.assertRaises(ValidationError): + product_packaging_dozen.uom_id = None + + # Define a new packaging unit + uom_524 = self.env['product.uom'].search([ + ('category_id', '=', + product_packaging_dozen.product_tmpl_id.uom_id.category_id.id), + ('name', + '=', + '%s %s' % + (product_packaging_dozen.product_tmpl_id.uom_id.category_id.name, + float(524))) + ]) + self.assertEqual(0, len(uom_524)) + product_packaging_dozen.qty = 524 + uom_524 = self.env['product.uom'].search([ + ('category_id', '=', + product_packaging_dozen.product_tmpl_id.uom_id.category_id.id), + ('name', + '=', + '%s %s' % + (product_packaging_dozen.product_tmpl_id.uom_id.category_id.name, + float(524))) + ]) + self.assertEqual(1, len(uom_524)) From d3b049e176c6d26d35d2268d06e15c603374d104 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sat, 2 Dec 2017 14:28:21 +0100 Subject: [PATCH 07/13] OCA Transbot updated translations from Transifex --- packaging_uom/i18n/de.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/es.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/fi.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/fr.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/hr_HR.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/it.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/nl.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/pt.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/pt_BR.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/sl.po | 51 +++++++++++++++++++++++++++++++++++++ 10 files changed, 510 insertions(+) create mode 100644 packaging_uom/i18n/de.po create mode 100644 packaging_uom/i18n/es.po create mode 100644 packaging_uom/i18n/fi.po create mode 100644 packaging_uom/i18n/fr.po create mode 100644 packaging_uom/i18n/hr_HR.po create mode 100644 packaging_uom/i18n/it.po create mode 100644 packaging_uom/i18n/nl.po create mode 100644 packaging_uom/i18n/pt.po create mode 100644 packaging_uom/i18n/pt_BR.po create mode 100644 packaging_uom/i18n/sl.po diff --git a/packaging_uom/i18n/de.po b/packaging_uom/i18n/de.po new file mode 100644 index 000000000..6cdd8ea05 --- /dev/null +++ b/packaging_uom/i18n/de.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Maßeinheit" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/es.po b/packaging_uom/i18n/es.po new file mode 100644 index 000000000..796ff539b --- /dev/null +++ b/packaging_uom/i18n/es.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Unidad de medida" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/fi.po b/packaging_uom/i18n/fi.po new file mode 100644 index 000000000..08516d6a8 --- /dev/null +++ b/packaging_uom/i18n/fi.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fi\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Mittayksikkö" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/fr.po b/packaging_uom/i18n/fr.po new file mode 100644 index 000000000..dbe4b76e7 --- /dev/null +++ b/packaging_uom/i18n/fr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Unité de mesure" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/hr_HR.po b/packaging_uom/i18n/hr_HR.po new file mode 100644 index 000000000..632dc3ffe --- /dev/null +++ b/packaging_uom/i18n/hr_HR.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/hr_HR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr_HR\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" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Jedinica mjere" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/it.po b/packaging_uom/i18n/it.po new file mode 100644 index 000000000..46bf774fc --- /dev/null +++ b/packaging_uom/i18n/it.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Unità di misura" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/nl.po b/packaging_uom/i18n/nl.po new file mode 100644 index 000000000..a4afd0e2b --- /dev/null +++ b/packaging_uom/i18n/nl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Maateenheid" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/pt.po b/packaging_uom/i18n/pt.po new file mode 100644 index 000000000..d329a3454 --- /dev/null +++ b/packaging_uom/i18n/pt.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Unidade de Medida" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/pt_BR.po b/packaging_uom/i18n/pt_BR.po new file mode 100644 index 000000000..cfb1c4fd6 --- /dev/null +++ b/packaging_uom/i18n/pt_BR.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Unidade de Medida" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" diff --git a/packaging_uom/i18n/sl.po b/packaging_uom/i18n/sl.po new file mode 100644 index 000000000..f532446df --- /dev/null +++ b/packaging_uom/i18n/sl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"PO-Revision-Date: 2017-11-30 03:52+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Enota mere" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" From df4e9623a82b92581933b8eef9a1f084a8157252 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Sat, 3 Mar 2018 15:43:37 +0100 Subject: [PATCH 08/13] OCA Transbot updated translations from Transifex --- packaging_uom/i18n/cs_CZ.po | 51 +++++++++++++++++++++++++++++++++++++ packaging_uom/i18n/es.po | 14 +++++----- packaging_uom/i18n/hr.po | 51 +++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 packaging_uom/i18n/cs_CZ.po create mode 100644 packaging_uom/i18n/hr.po diff --git a/packaging_uom/i18n/cs_CZ.po b/packaging_uom/i18n/cs_CZ.po new file mode 100644 index 000000000..eb23cdd7c --- /dev/null +++ b/packaging_uom/i18n/cs_CZ.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2018-02-27 11:37+0000\n" +"Last-Translator: Lukáš Spurný , 2018\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/teams/23907/cs_CZ/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: cs_CZ\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "Konfigurace" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "Musí být ve stejné kategorii, než je výchozí měrná jednotka." + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "Obal" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "Je vyžadována polní jednotka měření" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Měrná jednotka" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "Identifikátor domény Uom categ" diff --git a/packaging_uom/i18n/es.po b/packaging_uom/i18n/es.po index 796ff539b..fe8f2d58b 100644 --- a/packaging_uom/i18n/es.po +++ b/packaging_uom/i18n/es.po @@ -4,13 +4,14 @@ # # Translators: # OCA Transbot , 2017 +# enjolras , 2018 msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" -"PO-Revision-Date: 2017-11-30 03:52+0000\n" -"Last-Translator: OCA Transbot , 2017\n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2018-02-27 11:37+0000\n" +"Last-Translator: enjolras , 2018\n" "Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -21,24 +22,25 @@ msgstr "" #. module: packaging_uom #: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom msgid "Configurations" -msgstr "" +msgstr "Configuraciones" #. module: packaging_uom #: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id msgid "It must be in the same category than the default unit of measure." msgstr "" +"Debe estar en la misma categoría que la unidad de medida predeterminada." #. module: packaging_uom #: model:ir.model,name:packaging_uom.model_product_packaging #: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom msgid "Packaging" -msgstr "" +msgstr "Empaquetado" #. module: packaging_uom #: code:addons/packaging_uom/models/product_packaging.py:83 #, python-format msgid "The field Unit of Measure is required" -msgstr "" +msgstr "El campo Unidad de medida es obligatorio" #. module: packaging_uom #: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id diff --git a/packaging_uom/i18n/hr.po b/packaging_uom/i18n/hr.po new file mode 100644 index 000000000..0a5e096b5 --- /dev/null +++ b/packaging_uom/i18n/hr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +# Translators: +# Bole , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2018-02-27 11:37+0000\n" +"Last-Translator: Bole , 2018\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr\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" + +#. module: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "Postavke" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "Mora biti u istoj kategoriji u kojoj je i glavna jedinica mjere" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "Pakiranje" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "Polje jedinica mjere je obavezno" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "Jedinica mjere" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "Domena kategorije jedinice mjere" From 1bf4ab0877a97a99b988a760b4655a19554cb450 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 14 Jun 2018 22:55:28 +0200 Subject: [PATCH 09/13] [10.0][PYLINT] packaging_uom, sale_packaging, purchase_packaging --- packaging_uom/README.rst | 3 +- packaging_uom/__init__.py | 0 packaging_uom/__manifest__.py | 12 ++-- packaging_uom/models/__init__.py | 0 packaging_uom/tests/test_product_packaging.py | 57 ++++++++++--------- 5 files changed, 39 insertions(+), 33 deletions(-) mode change 100755 => 100644 packaging_uom/__init__.py mode change 100755 => 100644 packaging_uom/__manifest__.py mode change 100755 => 100644 packaging_uom/models/__init__.py diff --git a/packaging_uom/README.rst b/packaging_uom/README.rst index ced4575d5..0a8e16cdd 100644 --- a/packaging_uom/README.rst +++ b/packaging_uom/README.rst @@ -65,4 +65,5 @@ 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. -To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file +To contribute to this module, please visit http://odoo-community.org. + diff --git a/packaging_uom/__init__.py b/packaging_uom/__init__.py old mode 100755 new mode 100644 diff --git a/packaging_uom/__manifest__.py b/packaging_uom/__manifest__.py old mode 100755 new mode 100644 index 61bba0786..58db7c5e1 --- a/packaging_uom/__manifest__.py +++ b/packaging_uom/__manifest__.py @@ -3,16 +3,18 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Packaging UOM", - "version": "10.0.1.0.0", + "version": "10.0.1.0.1", "author": 'ACSONE SA/NV, ' 'Odoo Community Association (OCA)', "category": "Warehouse", "website": "http://www.acsone.eu", 'summary': "Use uom in package", - "depends": ["product", - ], - "data": ["views/product_packaging_views.xml", - ], + "depends": [ + "product", + ], + "data": [ + "views/product_packaging_views.xml", + ], "license": "AGPL-3", "installable": True, } diff --git a/packaging_uom/models/__init__.py b/packaging_uom/models/__init__.py old mode 100755 new mode 100644 diff --git a/packaging_uom/tests/test_product_packaging.py b/packaging_uom/tests/test_product_packaging.py index ad1af7c83..20752440e 100644 --- a/packaging_uom/tests/test_product_packaging.py +++ b/packaging_uom/tests/test_product_packaging.py @@ -11,13 +11,14 @@ class TestProductPackaging(common.TransactionCase): super(TestProductPackaging, self).setUp() self.uom_unit = self.env.ref('product.product_uom_unit') self.uom_dozen = self.env.ref('product.product_uom_dozen') - self.product_tmpl_dozen = self.env['product.template'].create( - {'name': 'PRODUCT DOZEN', - 'uom_id': self.uom_dozen.id}) - self.product_tmpl_unit = self.env['product.template'].create( - {'name': 'PRODUCT UNIT', - 'uom_id': self.uom_unit.id} - ) + self.product_tmpl_dozen = self.env['product.template'].create({ + 'name': 'PRODUCT DOZEN', + 'uom_id': self.uom_dozen.id, + }) + self.product_tmpl_unit = self.env['product.template'].create({ + 'name': 'PRODUCT UNIT', + 'uom_id': self.uom_unit.id, + }) def test_compute_quantity_by_package(self): """ Create a packagings with uom product_uom_dozen on @@ -43,38 +44,40 @@ class TestProductPackaging(common.TransactionCase): """ packaging_obj = self.env['product.packaging'] - product_packaging_dozen = packaging_obj.create( - {'name': 'PACKAGING 1', - 'product_tmpl_id': self.product_tmpl_dozen.id, - 'uom_id': self.uom_dozen.id}) + product_packaging_dozen = packaging_obj.create({ + 'name': 'PACKAGING 1', + 'product_tmpl_id': self.product_tmpl_dozen.id, + 'uom_id': self.uom_dozen.id, + }) self.assertAlmostEqual(product_packaging_dozen.qty, 1) product_packaging_unit = packaging_obj.with_context( - get_uom_categ_from_uom=self.uom_dozen.category_id.id).create( - {'name': 'PACKAGING 2', - 'product_tmpl_id': self.product_tmpl_unit.id, - 'uom_id': self.uom_dozen.id}) + get_uom_categ_from_uom=self.uom_dozen.category_id.id).create({ + 'name': 'PACKAGING 2', + 'product_tmpl_id': self.product_tmpl_unit.id, + 'uom_id': self.uom_dozen.id, + }) self.assertAlmostEqual(product_packaging_unit.qty, 12) self.assertEqual( self.uom_dozen.category_id, product_packaging_unit.uom_categ_domain_id, 'The UOM domain is not well set' ) - product_uom_24 = self.env['product.uom'].create( - {'category_id': self.env.ref('product.product_uom_categ_unit').id, - 'name': 'Double Dozens', - 'factor_inv': 24, - 'uom_type': 'bigger' - }) + product_uom_24 = self.env['product.uom'].create({ + 'category_id': self.env.ref('product.product_uom_categ_unit').id, + 'name': 'Double Dozens', + 'factor_inv': 24, + 'uom_type': 'bigger', + }) self.product_tmpl_dozen.uom_id = product_uom_24 self.assertAlmostEqual(product_packaging_dozen.qty, 0.5) product_packaging_unit.uom_id = product_uom_24 self.assertAlmostEqual(product_packaging_unit.qty, 24) - product_uom_6 = self.env['product.uom'].create( - {'category_id': self.env.ref('product.product_uom_categ_unit').id, - 'name': 'Demi Dozens', - 'factor_inv': 6, - 'uom_type': 'bigger' - }) + product_uom_6 = self.env['product.uom'].create({ + 'category_id': self.env.ref('product.product_uom_categ_unit').id, + 'name': 'Demi Dozens', + 'factor_inv': 6, + 'uom_type': 'bigger', + }) self.product_tmpl_dozen.uom_id = product_uom_6 self.assertAlmostEqual(product_packaging_dozen.qty, 2) product_packaging_unit.uom_id = product_uom_6 From cfd1c74bf419aff4ea1cda1b9661ace22685f2cf Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 18 Jun 2018 09:53:43 +0000 Subject: [PATCH 10/13] [UPD] Update packaging_uom.pot --- packaging_uom/i18n/cs_CZ.po | 7 +++-- packaging_uom/i18n/de.po | 4 +-- packaging_uom/i18n/es.po | 4 +-- packaging_uom/i18n/fi.po | 4 +-- packaging_uom/i18n/fr.po | 4 +-- packaging_uom/i18n/hr.po | 7 +++-- packaging_uom/i18n/hr_HR.po | 10 +++--- packaging_uom/i18n/it.po | 4 +-- packaging_uom/i18n/nl.po | 4 +-- packaging_uom/i18n/packaging_uom.pot | 47 ++++++++++++++++++++++++++++ packaging_uom/i18n/pt.po | 4 +-- packaging_uom/i18n/pt_BR.po | 7 +++-- packaging_uom/i18n/sl.po | 7 +++-- 13 files changed, 83 insertions(+), 30 deletions(-) create mode 100644 packaging_uom/i18n/packaging_uom.pot diff --git a/packaging_uom/i18n/cs_CZ.po b/packaging_uom/i18n/cs_CZ.po index eb23cdd7c..56e9e057a 100644 --- a/packaging_uom/i18n/cs_CZ.po +++ b/packaging_uom/i18n/cs_CZ.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # Lukáš Spurný , 2018 msgid "" @@ -11,11 +11,12 @@ msgstr "" "POT-Creation-Date: 2018-02-27 11:37+0000\n" "PO-Revision-Date: 2018-02-27 11:37+0000\n" "Last-Translator: Lukáš Spurný , 2018\n" -"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/teams/23907/cs_CZ/)\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" +"teams/23907/cs_CZ/)\n" +"Language: cs_CZ\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: cs_CZ\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/de.po b/packaging_uom/i18n/de.po index 6cdd8ea05..0662ae3ed 100644 --- a/packaging_uom/i18n/de.po +++ b/packaging_uom/i18n/de.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/es.po b/packaging_uom/i18n/es.po index fe8f2d58b..8e0a8e8f1 100644 --- a/packaging_uom/i18n/es.po +++ b/packaging_uom/i18n/es.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 # enjolras , 2018 @@ -13,10 +13,10 @@ msgstr "" "PO-Revision-Date: 2018-02-27 11:37+0000\n" "Last-Translator: enjolras , 2018\n" "Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/fi.po b/packaging_uom/i18n/fi.po index 08516d6a8..d0f208b6d 100644 --- a/packaging_uom/i18n/fi.po +++ b/packaging_uom/i18n/fi.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" +"Language: fi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: fi\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/fr.po b/packaging_uom/i18n/fr.po index dbe4b76e7..9a510e637 100644 --- a/packaging_uom/i18n/fr.po +++ b/packaging_uom/i18n/fr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/hr.po b/packaging_uom/i18n/hr.po index 0a5e096b5..9d9f137cd 100644 --- a/packaging_uom/i18n/hr.po +++ b/packaging_uom/i18n/hr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # Bole , 2018 msgid "" @@ -12,11 +12,12 @@ msgstr "" "PO-Revision-Date: 2018-02-27 11:37+0000\n" "Last-Translator: Bole , 2018\n" "Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: hr\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" +"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" #. module: packaging_uom #: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom diff --git a/packaging_uom/i18n/hr_HR.po b/packaging_uom/i18n/hr_HR.po index 632dc3ffe..9a1749d9b 100644 --- a/packaging_uom/i18n/hr_HR.po +++ b/packaging_uom/i18n/hr_HR.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -11,12 +11,14 @@ msgstr "" "POT-Creation-Date: 2017-11-30 03:52+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" -"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/hr_HR/)\n" +"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/" +"hr_HR/)\n" +"Language: hr_HR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: hr_HR\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" +"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" #. module: packaging_uom #: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom diff --git a/packaging_uom/i18n/it.po b/packaging_uom/i18n/it.po index 46bf774fc..6bca1570c 100644 --- a/packaging_uom/i18n/it.po +++ b/packaging_uom/i18n/it.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: it\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/nl.po b/packaging_uom/i18n/nl.po index a4afd0e2b..adebd419d 100644 --- a/packaging_uom/i18n/nl.po +++ b/packaging_uom/i18n/nl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" +"Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: nl\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/packaging_uom.pot b/packaging_uom/i18n/packaging_uom.pot new file mode 100644 index 000000000..c7c65ebd8 --- /dev/null +++ b/packaging_uom/i18n/packaging_uom.pot @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * packaging_uom +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.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: packaging_uom +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Configurations" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,help:packaging_uom.field_product_packaging_uom_id +msgid "It must be in the same category than the default unit of measure." +msgstr "" + +#. module: packaging_uom +#: model:ir.model,name:packaging_uom.model_product_packaging +#: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom +msgid "Packaging" +msgstr "" + +#. module: packaging_uom +#: code:addons/packaging_uom/models/product_packaging.py:83 +#, python-format +msgid "The field Unit of Measure is required" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_id +msgid "Unit of Measure" +msgstr "" + +#. module: packaging_uom +#: model:ir.model.fields,field_description:packaging_uom.field_product_packaging_uom_categ_domain_id +msgid "Uom categ domain id" +msgstr "" + diff --git a/packaging_uom/i18n/pt.po b/packaging_uom/i18n/pt.po index d329a3454..30e35a438 100644 --- a/packaging_uom/i18n/pt.po +++ b/packaging_uom/i18n/pt.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,10 +12,10 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n" +"Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: pt\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/pt_BR.po b/packaging_uom/i18n/pt_BR.po index cfb1c4fd6..ed922ffe9 100644 --- a/packaging_uom/i18n/pt_BR.po +++ b/packaging_uom/i18n/pt_BR.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -11,11 +11,12 @@ msgstr "" "POT-Creation-Date: 2017-11-30 03:52+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" -"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: packaging_uom diff --git a/packaging_uom/i18n/sl.po b/packaging_uom/i18n/sl.po index f532446df..17d207fb1 100644 --- a/packaging_uom/i18n/sl.po +++ b/packaging_uom/i18n/sl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * packaging_uom -# +# # Translators: # OCA Transbot , 2017 msgid "" @@ -12,11 +12,12 @@ msgstr "" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: sl\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" #. module: packaging_uom #: model:ir.ui.view,arch_db:packaging_uom.product_template_view_form_inherit_packaging_uom From b2deac9acf784231bda231fcf40ffcb4103c342d Mon Sep 17 00:00:00 2001 From: Thomas Binsfeld Date: Wed, 17 Apr 2019 15:10:10 +0200 Subject: [PATCH 11/13] [BACKPORT] Packaging UOM from 10.0 to 9.0 --- packaging_uom/README.rst | 72 +-- packaging_uom/__init__.py | 3 - .../{__manifest__.py => __openerp__.py} | 2 +- packaging_uom/i18n/cs_CZ.po | 4 +- packaging_uom/i18n/de.po | 4 +- packaging_uom/i18n/es.po | 4 +- packaging_uom/i18n/fi.po | 4 +- packaging_uom/i18n/fr.po | 4 +- packaging_uom/i18n/hr.po | 4 +- packaging_uom/i18n/hr_HR.po | 4 +- packaging_uom/i18n/it.po | 4 +- packaging_uom/i18n/nl.po | 4 +- packaging_uom/i18n/packaging_uom.pot | 6 +- packaging_uom/i18n/pt.po | 4 +- packaging_uom/i18n/pt_BR.po | 4 +- packaging_uom/i18n/sl.po | 4 +- packaging_uom/models/__init__.py | 4 - packaging_uom/models/product_packaging.py | 10 +- packaging_uom/readme/CONFIGURE.rst | 3 + packaging_uom/readme/CONTRIBUTORS.rst | 2 + packaging_uom/readme/DESCRIPTION.rst | 3 + packaging_uom/readme/INSTALLATION.rst | 3 + packaging_uom/static/description/index.html | 430 ++++++++++++++++++ packaging_uom/tests/__init__.py | 4 - packaging_uom/tests/test_product_packaging.py | 6 +- .../views/product_packaging_views.xml | 5 +- 26 files changed, 526 insertions(+), 75 deletions(-) rename packaging_uom/{__manifest__.py => __openerp__.py} (94%) create mode 100644 packaging_uom/readme/CONFIGURE.rst create mode 100644 packaging_uom/readme/CONTRIBUTORS.rst create mode 100644 packaging_uom/readme/DESCRIPTION.rst create mode 100644 packaging_uom/readme/INSTALLATION.rst create mode 100644 packaging_uom/static/description/index.html diff --git a/packaging_uom/README.rst b/packaging_uom/README.rst index 0a8e16cdd..497a35ad7 100644 --- a/packaging_uom/README.rst +++ b/packaging_uom/README.rst @@ -1,20 +1,38 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - +============= Packaging UOM ============= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fserver--auth-lightgray.png?logo=github + :target: https://github.com/OCA/server-auth/tree/9.0/packaging_uom + :alt: OCA/server-auth +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-auth-9-0/server-auth-9-0-packaging_uom + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/251/9.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module was written to use unit of measure instead of quantity by package in the definition of packaging. The goal is to ease the use of packaging in sale and purchase. -Installation -============ +**Table of contents** -To install this module, you need to: - -* Click on install button +.. contents:: + :local: Configuration ============= @@ -23,47 +41,43 @@ To configure this module, you need to: * on product packaging define the unit of measure to use. -Usage -===== - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/153/10.0 - 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. +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 ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* ACSONE SA/NV Contributors ------------- +~~~~~~~~~~~~ * Laetitia Gangloff * Laurent Mignon -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit http://odoo-community.org. +This module is part of the `OCA/server-auth `_ project on GitHub. +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/packaging_uom/__init__.py b/packaging_uom/__init__.py index 239921736..0650744f6 100644 --- a/packaging_uom/__init__.py +++ b/packaging_uom/__init__.py @@ -1,4 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2015-2017 ACSONE SA/NV () -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models diff --git a/packaging_uom/__manifest__.py b/packaging_uom/__openerp__.py similarity index 94% rename from packaging_uom/__manifest__.py rename to packaging_uom/__openerp__.py index 58db7c5e1..188beafb2 100644 --- a/packaging_uom/__manifest__.py +++ b/packaging_uom/__openerp__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Packaging UOM", - "version": "10.0.1.0.1", + "version": "9.0.1.0.0", "author": 'ACSONE SA/NV, ' 'Odoo Community Association (OCA)', "category": "Warehouse", diff --git a/packaging_uom/i18n/cs_CZ.po b/packaging_uom/i18n/cs_CZ.po index 56e9e057a..78f2844f6 100644 --- a/packaging_uom/i18n/cs_CZ.po +++ b/packaging_uom/i18n/cs_CZ.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2018-02-27 11:37+0000\n" "Last-Translator: Lukáš Spurný , 2018\n" "Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" @@ -36,7 +36,7 @@ msgid "Packaging" msgstr "Obal" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "Je vyžadována polní jednotka měření" diff --git a/packaging_uom/i18n/de.po b/packaging_uom/i18n/de.po index 0662ae3ed..cb6e5c7ea 100644 --- a/packaging_uom/i18n/de.po +++ b/packaging_uom/i18n/de.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" @@ -35,7 +35,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/es.po b/packaging_uom/i18n/es.po index 8e0a8e8f1..de593bc7a 100644 --- a/packaging_uom/i18n/es.po +++ b/packaging_uom/i18n/es.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2018-02-27 11:37+0000\n" "Last-Translator: enjolras , 2018\n" "Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" @@ -37,7 +37,7 @@ msgid "Packaging" msgstr "Empaquetado" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "El campo Unidad de medida es obligatorio" diff --git a/packaging_uom/i18n/fi.po b/packaging_uom/i18n/fi.po index d0f208b6d..4cb29484b 100644 --- a/packaging_uom/i18n/fi.po +++ b/packaging_uom/i18n/fi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" @@ -35,7 +35,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/fr.po b/packaging_uom/i18n/fr.po index 9a510e637..fde354c39 100644 --- a/packaging_uom/i18n/fr.po +++ b/packaging_uom/i18n/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" @@ -35,7 +35,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/hr.po b/packaging_uom/i18n/hr.po index 9d9f137cd..2c22669c2 100644 --- a/packaging_uom/i18n/hr.po +++ b/packaging_uom/i18n/hr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2018-02-27 11:37+0000\n" "Last-Translator: Bole , 2018\n" "Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" @@ -36,7 +36,7 @@ msgid "Packaging" msgstr "Pakiranje" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "Polje jedinica mjere je obavezno" diff --git a/packaging_uom/i18n/hr_HR.po b/packaging_uom/i18n/hr_HR.po index 9a1749d9b..7baeffd1c 100644 --- a/packaging_uom/i18n/hr_HR.po +++ b/packaging_uom/i18n/hr_HR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/" @@ -37,7 +37,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/it.po b/packaging_uom/i18n/it.po index 6bca1570c..4d40da272 100644 --- a/packaging_uom/i18n/it.po +++ b/packaging_uom/i18n/it.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" @@ -35,7 +35,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/nl.po b/packaging_uom/i18n/nl.po index adebd419d..d221ce651 100644 --- a/packaging_uom/i18n/nl.po +++ b/packaging_uom/i18n/nl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" @@ -35,7 +35,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/packaging_uom.pot b/packaging_uom/i18n/packaging_uom.pot index c7c65ebd8..02ce2e20b 100644 --- a/packaging_uom/i18n/packaging_uom.pot +++ b/packaging_uom/i18n/packaging_uom.pot @@ -4,8 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" +"Project-Id-Version: Odoo Server 9.0c\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" +"PO-Revision-Date: 2019-04-17 13:12+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -30,7 +32,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/pt.po b/packaging_uom/i18n/pt.po index 30e35a438..cc090322f 100644 --- a/packaging_uom/i18n/pt.po +++ b/packaging_uom/i18n/pt.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n" @@ -35,7 +35,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/pt_BR.po b/packaging_uom/i18n/pt_BR.po index ed922ffe9..722d7e26c 100644 --- a/packaging_uom/i18n/pt_BR.po +++ b/packaging_uom/i18n/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" @@ -36,7 +36,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/i18n/sl.po b/packaging_uom/i18n/sl.po index 17d207fb1..e21bdf363 100644 --- a/packaging_uom/i18n/sl.po +++ b/packaging_uom/i18n/sl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-11-30 03:52+0000\n" +"POT-Creation-Date: 2019-04-17 13:12+0000\n" "PO-Revision-Date: 2017-11-30 03:52+0000\n" "Last-Translator: OCA Transbot , 2017\n" "Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" @@ -36,7 +36,7 @@ msgid "Packaging" msgstr "" #. module: packaging_uom -#: code:addons/packaging_uom/models/product_packaging.py:83 +#: code:addons/packaging_uom/models/product_packaging.py:85 #, python-format msgid "The field Unit of Measure is required" msgstr "" diff --git a/packaging_uom/models/__init__.py b/packaging_uom/models/__init__.py index 5296fa85a..2c4d9a88a 100644 --- a/packaging_uom/models/__init__.py +++ b/packaging_uom/models/__init__.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2015-2017 ACSONE SA/NV () -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - from . import product_packaging diff --git a/packaging_uom/models/product_packaging.py b/packaging_uom/models/product_packaging.py index ab8422cb6..27d38cffd 100644 --- a/packaging_uom/models/product_packaging.py +++ b/packaging_uom/models/product_packaging.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # Copyright 2015-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, _ -from odoo.exceptions import ValidationError +from openerp import api, fields, models, _ +from openerp.exceptions import ValidationError class ProductPackaging(models.Model): @@ -42,8 +42,10 @@ class ProductPackaging(models.Model): """ for packaging in self: if packaging.uom_id and packaging.product_tmpl_id: - packaging.qty = packaging.uom_id._compute_quantity( - 1, to_unit=packaging.product_tmpl_id.uom_id) + packaging.qty = self.env['product.uom']._compute_qty_obj( + packaging.uom_id, + 1, + to_unit=packaging.product_tmpl_id.uom_id) else: packaging.qty = 0 diff --git a/packaging_uom/readme/CONFIGURE.rst b/packaging_uom/readme/CONFIGURE.rst new file mode 100644 index 000000000..62b9f0aa9 --- /dev/null +++ b/packaging_uom/readme/CONFIGURE.rst @@ -0,0 +1,3 @@ +To configure this module, you need to: + +* on product packaging define the unit of measure to use. diff --git a/packaging_uom/readme/CONTRIBUTORS.rst b/packaging_uom/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..3d6d548f9 --- /dev/null +++ b/packaging_uom/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Laetitia Gangloff +* Laurent Mignon diff --git a/packaging_uom/readme/DESCRIPTION.rst b/packaging_uom/readme/DESCRIPTION.rst new file mode 100644 index 000000000..6fec11b73 --- /dev/null +++ b/packaging_uom/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module was written to use unit of measure instead of quantity by package +in the definition of packaging. +The goal is to ease the use of packaging in sale and purchase. diff --git a/packaging_uom/readme/INSTALLATION.rst b/packaging_uom/readme/INSTALLATION.rst new file mode 100644 index 000000000..e90899f4a --- /dev/null +++ b/packaging_uom/readme/INSTALLATION.rst @@ -0,0 +1,3 @@ +To install this module, you need to: + +* Click on install button diff --git a/packaging_uom/static/description/index.html b/packaging_uom/static/description/index.html new file mode 100644 index 000000000..e151d57e3 --- /dev/null +++ b/packaging_uom/static/description/index.html @@ -0,0 +1,430 @@ + + + + + + +Packaging UOM + + + +
+

Packaging UOM

+ + +

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

This module was written to use unit of measure instead of quantity by package +in the definition of packaging. +The goal is to ease the use of packaging in sale and purchase.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  • on product packaging define the unit of measure to use.
  • +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

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/server-auth project on GitHub.

+

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

+
+
+
+ + diff --git a/packaging_uom/tests/__init__.py b/packaging_uom/tests/__init__.py index a7d7d468e..a10ba7b6f 100644 --- a/packaging_uom/tests/__init__.py +++ b/packaging_uom/tests/__init__.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -# Copyright 2015-2017 ACSONE SA/NV () -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - from . import test_product_packaging diff --git a/packaging_uom/tests/test_product_packaging.py b/packaging_uom/tests/test_product_packaging.py index 20752440e..c8946b40c 100644 --- a/packaging_uom/tests/test_product_packaging.py +++ b/packaging_uom/tests/test_product_packaging.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # Copyright 2015-2017 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import odoo.tests.common as common -from odoo.exceptions import ValidationError +import openerp.tests.common as common +from openerp.exceptions import ValidationError class TestProductPackaging(common.TransactionCase): @@ -14,10 +14,12 @@ class TestProductPackaging(common.TransactionCase): self.product_tmpl_dozen = self.env['product.template'].create({ 'name': 'PRODUCT DOZEN', 'uom_id': self.uom_dozen.id, + 'tracking': 'none', }) self.product_tmpl_unit = self.env['product.template'].create({ 'name': 'PRODUCT UNIT', 'uom_id': self.uom_unit.id, + 'tracking': 'none', }) def test_compute_quantity_by_package(self): diff --git a/packaging_uom/views/product_packaging_views.xml b/packaging_uom/views/product_packaging_views.xml index 31a271220..0e9891b93 100644 --- a/packaging_uom/views/product_packaging_views.xml +++ b/packaging_uom/views/product_packaging_views.xml @@ -7,14 +7,15 @@ product.template - + + - + From 7b5d073b3a596cbf52363d108f485ca024c71aeb Mon Sep 17 00:00:00 2001 From: Thomas Binsfeld Date: Wed, 17 Apr 2019 15:10:32 +0200 Subject: [PATCH 12/13] [REF] Gitignore: .eggs --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 890ff0109..7f2d43821 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ var/ *.egg-info/ .installed.cfg *.egg +*.eggs # Installer logs pip-log.txt From 26a0276a4aa7a677d1a41d4adc61483af60fe59c Mon Sep 17 00:00:00 2001 From: Thomas Binsfeld Date: Wed, 17 Apr 2019 15:11:11 +0200 Subject: [PATCH 13/13] [BACKPORT] Packaging UOM to v9: setup --- setup/packaging_uom/odoo_addons/__init__.py | 1 + setup/packaging_uom/odoo_addons/packaging_uom | 1 + setup/packaging_uom/setup.py | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 setup/packaging_uom/odoo_addons/__init__.py create mode 120000 setup/packaging_uom/odoo_addons/packaging_uom create mode 100644 setup/packaging_uom/setup.py diff --git a/setup/packaging_uom/odoo_addons/__init__.py b/setup/packaging_uom/odoo_addons/__init__.py new file mode 100644 index 000000000..de40ea7ca --- /dev/null +++ b/setup/packaging_uom/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/packaging_uom/odoo_addons/packaging_uom b/setup/packaging_uom/odoo_addons/packaging_uom new file mode 120000 index 000000000..917499ffa --- /dev/null +++ b/setup/packaging_uom/odoo_addons/packaging_uom @@ -0,0 +1 @@ +../../../packaging_uom \ No newline at end of file diff --git a/setup/packaging_uom/setup.py b/setup/packaging_uom/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/packaging_uom/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)