diff --git a/pos_to_weight_by_product_uom/README.rst b/pos_to_weight_by_product_uom/README.rst new file mode 100644 index 00000000..7c08cb7d --- /dev/null +++ b/pos_to_weight_by_product_uom/README.rst @@ -0,0 +1,117 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============== +Pos to weight by product +============== + +Motivation +============ + +At the moment, when we create a new product and choose the unity of measure **kg**, +we have to tick the checkbox 'To Weigh With Scale' in the Point of Sale part. + +We want to speed the process of creating a new product, avoiding filling manually this parameter. + +Brief presentation +============ + +This module adds the field **'To weigh'** in UOM categories (set to **false** by default). + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_categ_toweigh.png + :alt: Categories of unities of measure + :width: 900 + + +**→** This field affects every unities contained in this category. + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_toweigh.png + :alt: Unities of measure with field 'To weigh' + :width: 900 + +**→** **AND** it is linked with the parameter **to_weight** in product.template used for example in the Point of Sale app. + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh_checked.png + :alt: Change the field 'to weigh' for every product + :width: 300 + +Installation +============ + +To install this module, you need to : + +* install the official apps : Sales Management and Point of Sale +* install this module with the installation button +* active settings "Allow using different units of measure" in Settings > Configuration > Sales > Quotations and Sales Orders > Product Features + +How to use this module +============= + +* [Category UOM] During the creation of a category, tick the box 'To weigh'. + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_categ_change_toweigh.png + :alt: Change the field 'To weigh' for every category + :width: 400 + +* [Category UOM] You can set every product existing with the new 'To weigh' parameter + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_categ_button_toweigh.png + :alt: Set 'to weigh' in each product of this category + :width: 900 + +* [UOM] You **CAN'T** change 'To weigh' for one UOM → You have to change in Category and affect all UOM of this category. + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_change_toweigh.png + :alt: Can't change the field 'to weigh' for one unity of measure + :width: 900 + +* [Product] **However**, you're able to change this field for a specific product (in tab Sales). + +.. image:: /pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh.png + :alt: Change the field 'to weigh' for every product + :width: 300 + +Usage +===== + +* To use this module, you need to go to (link not avalaible yet): + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} + + +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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Quentin Dupont, GRAP (http://www.grap.coop/) +* Sylvain Legal, GRAP (http://www.grap.coop/) + +Do not contact contributors directly about support or help with technical issues. + +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 https://odoo-community.org. diff --git a/pos_to_weight_by_product_uom/__init__.py b/pos_to_weight_by_product_uom/__init__.py new file mode 100644 index 00000000..b44d7659 --- /dev/null +++ b/pos_to_weight_by_product_uom/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/pos_to_weight_by_product_uom/__openerp__.py b/pos_to_weight_by_product_uom/__openerp__.py new file mode 100644 index 00000000..b73fe260 --- /dev/null +++ b/pos_to_weight_by_product_uom/__openerp__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Copyright 2017, Grap +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Pos to weight by product uom", + "summary": "Module summary", + "version": "8.0.1.0.0", + "category": "Uncategorized", + "website": "https://github.com/OCA/pos", + "author": "GRAP, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "external_dependencies": { + "python": [], + "bin": [], + }, + "depends": [ + "product", + ], + "data": [ + 'views/pos_to_weight.xml', + ], + 'demo': [ + 'demo/product_uom_categ_demo.xml', + 'demo/product_uom_demo.xml' + ] +} diff --git a/pos_to_weight_by_product_uom/demo/product_uom_categ_demo.xml b/pos_to_weight_by_product_uom/demo/product_uom_categ_demo.xml new file mode 100644 index 00000000..644af6af --- /dev/null +++ b/pos_to_weight_by_product_uom/demo/product_uom_categ_demo.xml @@ -0,0 +1,12 @@ + + + + + + + Demo - New Category To Weigh + True + + + diff --git a/pos_to_weight_by_product_uom/demo/product_uom_demo.xml b/pos_to_weight_by_product_uom/demo/product_uom_demo.xml new file mode 100644 index 00000000..2b310585 --- /dev/null +++ b/pos_to_weight_by_product_uom/demo/product_uom_demo.xml @@ -0,0 +1,11 @@ + + + + + + Demo - New Uom To Weigh + + + + \ No newline at end of file diff --git a/pos_to_weight_by_product_uom/i18n/fr.po b/pos_to_weight_by_product_uom/i18n/fr.po new file mode 100644 index 00000000..cffbab3b --- /dev/null +++ b/pos_to_weight_by_product_uom/i18n/fr.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_to_weight_by_product_uom +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-13 12:19+0000\n" +"PO-Revision-Date: 2017-11-13 12:19+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_to_weight_by_product_uom +#: model:product.uom.categ,name:pos_to_weight_by_product_uom.product_uom_categ_to_weigh +msgid "Demo - New Category To Weigh" +msgstr "Demo - Nouvelle Catégorie à peser" + +#. module: pos_to_weight_by_product_uom +#: model:product.uom,name:pos_to_weight_by_product_uom.product_uom_to_weigh +msgid "Demo - New Uom To Weigh" +msgstr "Demo - Nouvelle UdM à peser" + +#. module: pos_to_weight_by_product_uom +#: model:ir.model,name:pos_to_weight_by_product_uom.model_product_template +msgid "Product Template" +msgstr "Modèle d'article" + +#. module: pos_to_weight_by_product_uom +#: model:ir.model,name:pos_to_weight_by_product_uom.model_product_uom +msgid "Product Unit of Measure" +msgstr "Unité de mesure d'article" + +#. module: pos_to_weight_by_product_uom +#: model:ir.model,name:pos_to_weight_by_product_uom.model_product_uom_categ +msgid "Product uom categ" +msgstr "Catégorie d'UdM d'article" + +#. module: pos_to_weight_by_product_uom +#: field:product.uom,to_weigh:0 +#: field:product.uom.categ,to_weigh:0 +msgid "To weigh" +msgstr "À peser" + diff --git a/pos_to_weight_by_product_uom/models/__init__.py b/pos_to_weight_by_product_uom/models/__init__.py new file mode 100644 index 00000000..a64cf628 --- /dev/null +++ b/pos_to_weight_by_product_uom/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import product_template +from . import product_uom +from . import product_uom_categ diff --git a/pos_to_weight_by_product_uom/models/product_template.py b/pos_to_weight_by_product_uom/models/product_template.py new file mode 100644 index 00000000..25cb4d4e --- /dev/null +++ b/pos_to_weight_by_product_uom/models/product_template.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2017, Grap +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openerp import api, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + @api.multi + def onchange_uom(self, uom_id, uom_po_id): + res = super(ProductTemplate, self).onchange_uom(uom_id, uom_po_id) + if uom_id: + if res.get('value', False): + res['value']['to_weight'] =\ + self.env['product.uom'].browse(uom_id).to_weigh + return res diff --git a/pos_to_weight_by_product_uom/models/product_uom.py b/pos_to_weight_by_product_uom/models/product_uom.py new file mode 100644 index 00000000..ed419245 --- /dev/null +++ b/pos_to_weight_by_product_uom/models/product_uom.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Copyright 2017, Grap +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openerp import fields, models + + +class ProductUom(models.Model): + _inherit = 'product.uom' + + to_weigh = fields.Boolean( + related='category_id.to_weigh', + readonly=True) diff --git a/pos_to_weight_by_product_uom/models/product_uom_categ.py b/pos_to_weight_by_product_uom/models/product_uom_categ.py new file mode 100644 index 00000000..1eeea92f --- /dev/null +++ b/pos_to_weight_by_product_uom/models/product_uom_categ.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2017, Grap +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openerp import fields, models, api + + +class ProductUomCateg(models.Model): + _inherit = 'product.uom.categ' + + to_weigh = fields.Boolean('To weigh', default=False) + + @api.multi + def action_recompute_to_weigh(self): + for categ in self: + domain = [('uom_id.category_id', '=', categ.id)] + products = self.env['product.template'].search(domain) + products.write({'to_weight': categ.to_weigh}) diff --git a/pos_to_weight_by_product_uom/static/description/icon.png b/pos_to_weight_by_product_uom/static/description/icon.png new file mode 100644 index 00000000..f1cbe7ba Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/icon.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_categ_button_toweigh.png b/pos_to_weight_by_product_uom/static/description/uom_categ_button_toweigh.png new file mode 100644 index 00000000..6755ecc4 Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_categ_button_toweigh.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_categ_change_toweigh.png b/pos_to_weight_by_product_uom/static/description/uom_categ_change_toweigh.png new file mode 100644 index 00000000..17debba6 Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_categ_change_toweigh.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_categ_toweigh.png b/pos_to_weight_by_product_uom/static/description/uom_categ_toweigh.png new file mode 100644 index 00000000..87c321ed Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_categ_toweigh.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_change_toweigh.png b/pos_to_weight_by_product_uom/static/description/uom_change_toweigh.png new file mode 100644 index 00000000..d4ea0e03 Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_change_toweigh.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh.png b/pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh.png new file mode 100644 index 00000000..08866567 Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh_checked.png b/pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh_checked.png new file mode 100644 index 00000000..ca95eb88 Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_pos_change_toweigh_checked.png differ diff --git a/pos_to_weight_by_product_uom/static/description/uom_toweigh.png b/pos_to_weight_by_product_uom/static/description/uom_toweigh.png new file mode 100644 index 00000000..b7a18141 Binary files /dev/null and b/pos_to_weight_by_product_uom/static/description/uom_toweigh.png differ diff --git a/pos_to_weight_by_product_uom/views/pos_to_weight.xml b/pos_to_weight_by_product_uom/views/pos_to_weight.xml new file mode 100644 index 00000000..5ccb4493 --- /dev/null +++ b/pos_to_weight_by_product_uom/views/pos_to_weight.xml @@ -0,0 +1,54 @@ + + + + + + + + + product.uom.categ + + + + +