diff --git a/pos_price_to_weight/README.rst b/pos_price_to_weight/README.rst new file mode 100644 index 0000000000..453383dbb7 --- /dev/null +++ b/pos_price_to_weight/README.rst @@ -0,0 +1,135 @@ +=============================== +Point of Sale - Price to Weight +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b0443f725649e14ed47bb43b7e7815d98a6f850cf45bffdd6f66b8eee3ac1b76 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/16.0/pos_price_to_weight + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_price_to_weight + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends Odoo Point Of Sale features, to allow to scan barcode +with price and to compute according quantity. + +In Odoo by default, there are three types of barcode rules for products. + +* 'Unit Product' (``type=product``). Scanning a product will add a unit of this + product to the current order. +* 'Priced product' (``type=price``). A price is extracted from the barcode, and + a new line with the given price and a quantity = 1 is added to the current + order. +* 'Weighted product' (``type=weight``). A weight is extracted from the barcode, + and a new line with the given weight, and a computed price + (quantity * Unit price) is added to the current order. + +This module add a new option: + +* 'Priced Product (Computed Weight)' (``type=price_to_weight``). A price is + extracted from the barcode, and a new line with the given price, and a + computed quantity (Price / Unit Price) is added to the current order. + +This module is usefull in shops with products scaled, to manage correctly +stock quantities. + +**Samples** + +* Given a product with a unit price of 1,50€ / kg + +* The barcode is 0212345{NNNDD}x where: + * 02 is the prefix of the barcode rule + * 12345 is the product number + * {NNNDD} is the price of the scaled product + * x is the control digit + +* On the product we so set '0212345000007' in the barcode field. + +* if the scanned barcode is 0212345002650: + * {NNNDD} is 00265, the price is so 2,65€ + * the according quantity is 2,65€ / 1,5 €/kg = 1,767 kg + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_price_to_weight/static/description/pos_test_1.png + +* if the scanned barcode is 0212345008102: + * {NNNDD} is 00810, the price is so 8,10€ + * the according quantity is 8,10€ / 1,5 €/kg = 5,400 kg + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_price_to_weight/static/description/pos_test_2.png + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +* Go to Point of Sale > Configuration > Barcode Nomenclatures +* Edit your barcode rules, according to your barcodes settings + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_price_to_weight/static/description/barcode_rule.png + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* La Louve +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Sylvain LE GAL + +Other credits +~~~~~~~~~~~~~ + +Icon parts come from http://icons8.com + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_price_to_weight/__init__.py b/pos_price_to_weight/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_price_to_weight/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_price_to_weight/__manifest__.py b/pos_price_to_weight/__manifest__.py new file mode 100644 index 0000000000..7b3ffc8bd7 --- /dev/null +++ b/pos_price_to_weight/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright (C) 2017-Today: La Louve () +# Copyright (C) 2019-Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Point of Sale - Price to Weight", + "version": "16.0.1.0.0", + "category": "Point Of Sale", + "summary": "Compute weight based on barcodes with prices", + "author": "La Louve, GRAP, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": ["point_of_sale"], + "data": [], + "demo": [ + "demo/barcode_rule.xml", + "demo/product_product.xml", + ], + "assets": { + "point_of_sale.assets": [ + "pos_price_to_weight/static/src/js/ProductScreen.js", + ], + }, + "installable": True, +} diff --git a/pos_price_to_weight/demo/barcode_rule.xml b/pos_price_to_weight/demo/barcode_rule.xml new file mode 100644 index 0000000000..f7b29dfdeb --- /dev/null +++ b/pos_price_to_weight/demo/barcode_rule.xml @@ -0,0 +1,21 @@ + + + + + + Price Barcodes (Computed Weight) 2 Decimals + + price_to_weight + 02.....{NNNDD} + 15 + ean13 + + + diff --git a/pos_price_to_weight/demo/product_product.xml b/pos_price_to_weight/demo/product_product.xml new file mode 100644 index 0000000000..bf7ab7267b --- /dev/null +++ b/pos_price_to_weight/demo/product_product.xml @@ -0,0 +1,19 @@ + + + + + + Apples (with Price To Weight Barcode) + 0212345000007 + 1.50 + True + True + + + + + diff --git a/pos_price_to_weight/i18n/ca.po b/pos_price_to_weight/i18n/ca.po new file mode 100644 index 0000000000..4f90ac6c36 --- /dev/null +++ b/pos_price_to_weight/i18n/ca.po @@ -0,0 +1,130 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_price_to_weight +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-20 15:54+0000\n" +"PO-Revision-Date: 2022-04-13 13:05+0000\n" +"Last-Translator: Noel estudillo \n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Alias" +msgstr "Àlies" + +#. module: pos_price_to_weight +#: model:product.product,name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "Apples (with Price To Weight Barcode)" +msgstr "Pomes (amb preu per pes de codi de barres)" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_barcode_rule +msgid "Barcode Rule" +msgstr "barcode.rule" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Cashier" +msgstr "Caixer" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Client" +msgstr "Client" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Discounted Product" +msgstr "Producte amb descompte" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_name +msgid "Field Name" +msgstr "Nom del camp" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Location" +msgstr "Ubicació" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Lot" +msgstr "Lot" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Meal Voucher Payment" +msgstr "Pagament del val de menjar" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Package" +msgstr "Paquet" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuració del punt de venda" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_id +msgid "Price To Weight Field" +msgstr "Camp Preu a Pes" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product" +msgstr "Producte amb preu" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product (Computed Weight)" +msgstr "Producte amb preu (pes automatitzat)" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Tare" +msgstr "Tara" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_barcode_rule__type +msgid "Type" +msgstr "Tipus" + +#. module: pos_price_to_weight +#: model_terms:ir.ui.view,arch_db:pos_price_to_weight.view_pos_config_form +msgid "Unit Price field used when converting scanned weight to price." +msgstr "" +"El camp Preu unitari s'utilitza quan es converteix el pes escanejat en preu." + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Unit Product" +msgstr "Producte unitari" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Weighted Product" +msgstr "Producte ponderat" + +#. module: pos_price_to_weight +#: model:product.product,uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.product,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +#: model:product.template,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "kg" +msgstr "kg" diff --git a/pos_price_to_weight/i18n/es.po b/pos_price_to_weight/i18n/es.po new file mode 100644 index 0000000000..f2e7b31994 --- /dev/null +++ b/pos_price_to_weight/i18n/es.po @@ -0,0 +1,130 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_price_to_weight +# +# Translators: +# enjolras , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-01 02:01+0000\n" +"PO-Revision-Date: 2020-07-27 11:19+0000\n" +"Last-Translator: Daniel Martinez Vila \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" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Alias" +msgstr "Alias" + +#. module: pos_price_to_weight +#: model:product.product,name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "Apples (with Price To Weight Barcode)" +msgstr "Manzanas (con código de barras de precio)" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_barcode_rule +msgid "Barcode Rule" +msgstr "Regla de código de barras" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Cashier" +msgstr "Cajero" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Client" +msgstr "Cliente" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Discounted Product" +msgstr "Producto con descuento" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_name +msgid "Field Name" +msgstr "Nombre del campo" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Location" +msgstr "Ubicación" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Lot" +msgstr "Lote" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Meal Voucher Payment" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Package" +msgstr "Paquete" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del punto de venta" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_id +msgid "Price To Weight Field" +msgstr "Campo de precio a peso" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product" +msgstr "Producto con precio" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product (Computed Weight)" +msgstr "Producto con precio (precio calculado)" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Tare" +msgstr "Tara" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_barcode_rule__type +msgid "Type" +msgstr "Tipo" + +#. module: pos_price_to_weight +#: model_terms:ir.ui.view,arch_db:pos_price_to_weight.view_pos_config_form +msgid "Unit Price field used when converting scanned weight to price." +msgstr "" +"Campo de precio unitario utilizado al convertir el peso escaneado en precio." + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Unit Product" +msgstr "Producto unitario" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Weighted Product" +msgstr "Producto ponderado" + +#. module: pos_price_to_weight +#: model:product.product,uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.product,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +#: model:product.template,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "kg" +msgstr "kg" diff --git a/pos_price_to_weight/i18n/fr.po b/pos_price_to_weight/i18n/fr.po new file mode 100644 index 0000000000..4b40f82770 --- /dev/null +++ b/pos_price_to_weight/i18n/fr.po @@ -0,0 +1,132 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_price_to_weight +# +# Translators: +# Quentin THEURET , 2018 +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-01 02:01+0000\n" +"PO-Revision-Date: 2020-06-15 11:19+0000\n" +"Last-Translator: Sylvain LE GAL \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" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Alias" +msgstr "" + +#. module: pos_price_to_weight +#: model:product.product,name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "Apples (with Price To Weight Barcode)" +msgstr "Pommes (Avec un code barre Prix vers Poids)" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_barcode_rule +#, fuzzy +msgid "Barcode Rule" +msgstr "barcode.rule" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Cashier" +msgstr "Caissier" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Client" +msgstr "Client" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Discounted Product" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_name +msgid "Field Name" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Location" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Lot" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Meal Voucher Payment" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Package" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_id +msgid "Price To Weight Field" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +#, fuzzy +msgid "Priced Product" +msgstr "Prix du produit (Poid calculé)" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product (Computed Weight)" +msgstr "Prix du produit (Poid calculé)" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Tare" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_barcode_rule__type +msgid "Type" +msgstr "" + +#. module: pos_price_to_weight +#: model_terms:ir.ui.view,arch_db:pos_price_to_weight.view_pos_config_form +msgid "Unit Price field used when converting scanned weight to price." +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Unit Product" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Weighted Product" +msgstr "" + +#. module: pos_price_to_weight +#: model:product.product,uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.product,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +#: model:product.template,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "kg" +msgstr "" diff --git a/pos_price_to_weight/i18n/it.po b/pos_price_to_weight/i18n/it.po new file mode 100644 index 0000000000..0a56693867 --- /dev/null +++ b/pos_price_to_weight/i18n/it.po @@ -0,0 +1,130 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_price_to_weight +# +# Translators: +# Francesco Fresta , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-01 02:01+0000\n" +"PO-Revision-Date: 2023-11-21 13:35+0000\n" +"Last-Translator: mymage \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" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Alias" +msgstr "Alias" + +#. module: pos_price_to_weight +#: model:product.product,name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "Apples (with Price To Weight Barcode)" +msgstr "Mele (con codice a barre prezzo a pezo)" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_barcode_rule +msgid "Barcode Rule" +msgstr "Regola codice a barre" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Cashier" +msgstr "Cassiere" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Client" +msgstr "Client" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Discounted Product" +msgstr "Prodotto scontato" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_name +msgid "Field Name" +msgstr "Nome campo" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Location" +msgstr "Ubicazione" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Lot" +msgstr "Lotto" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Meal Voucher Payment" +msgstr "Pagamento buoni pasto" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Package" +msgstr "Collo" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configurazione punto vendita" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_id +msgid "Price To Weight Field" +msgstr "Campo prezzo a peso" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product" +msgstr "Prodotto prezzato" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product (Computed Weight)" +msgstr "Prodotto prezzato (peso calcolato)" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Tare" +msgstr "Tara" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_barcode_rule__type +msgid "Type" +msgstr "Tipo" + +#. module: pos_price_to_weight +#: model_terms:ir.ui.view,arch_db:pos_price_to_weight.view_pos_config_form +msgid "Unit Price field used when converting scanned weight to price." +msgstr "" +"Campo prezzo unitario utilizzato quando si converte un peso letto in prezzo." + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Unit Product" +msgstr "Prodotto unitario" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Weighted Product" +msgstr "Prodotto pesato" + +#. module: pos_price_to_weight +#: model:product.product,uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.product,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +#: model:product.template,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "kg" +msgstr "kg" diff --git a/pos_price_to_weight/i18n/pos_price_to_weight.pot b/pos_price_to_weight/i18n/pos_price_to_weight.pot new file mode 100644 index 0000000000..b9ddc65aba --- /dev/null +++ b/pos_price_to_weight/i18n/pos_price_to_weight.pot @@ -0,0 +1,124 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_price_to_weight +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Alias" +msgstr "" + +#. module: pos_price_to_weight +#: model:product.product,name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "Apples (with Price To Weight Barcode)" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_barcode_rule +msgid "Barcode Rule" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Cashier" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Client" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Discounted Product" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_name +msgid "Field Name" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Location" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Lot" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Meal Voucher Payment" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Package" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model,name:pos_price_to_weight.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_pos_config__pos_price_to_weight_price_field_id +msgid "Price To Weight Field" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Priced Product (Computed Weight)" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Tare" +msgstr "" + +#. module: pos_price_to_weight +#: model:ir.model.fields,field_description:pos_price_to_weight.field_barcode_rule__type +msgid "Type" +msgstr "" + +#. module: pos_price_to_weight +#: model_terms:ir.ui.view,arch_db:pos_price_to_weight.view_pos_config_form +msgid "Unit Price field used when converting scanned weight to price." +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Unit Product" +msgstr "" + +#. module: pos_price_to_weight +#: selection:barcode.rule,type:0 +msgid "Weighted Product" +msgstr "" + +#. module: pos_price_to_weight +#: model:product.product,uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.product,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode +#: model:product.template,uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +#: model:product.template,weight_uom_name:pos_price_to_weight.product_price_to_weight_barcode_product_template +msgid "kg" +msgstr "" + diff --git a/pos_price_to_weight/models/__init__.py b/pos_price_to_weight/models/__init__.py new file mode 100644 index 0000000000..ba6651a1f0 --- /dev/null +++ b/pos_price_to_weight/models/__init__.py @@ -0,0 +1 @@ +from . import barcode_rule diff --git a/pos_price_to_weight/models/barcode_rule.py b/pos_price_to_weight/models/barcode_rule.py new file mode 100644 index 0000000000..f15653fbba --- /dev/null +++ b/pos_price_to_weight/models/barcode_rule.py @@ -0,0 +1,15 @@ +# Copyright (C) 2017-Today: La Louve () +# Copyright (C) 2019-Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class BarcodeRule(models.Model): + _inherit = "barcode.rule" + + type = fields.Selection( + selection_add=[("price_to_weight", "Priced Product (Computed Weight)")], + ondelete={"price_to_weight": "cascade"}, + ) diff --git a/pos_price_to_weight/readme/CONFIGURE.rst b/pos_price_to_weight/readme/CONFIGURE.rst new file mode 100644 index 0000000000..9e85c17f35 --- /dev/null +++ b/pos_price_to_weight/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +* Go to Point of Sale > Configuration > Barcode Nomenclatures +* Edit your barcode rules, according to your barcodes settings + +.. figure:: ../static/description/barcode_rule.png diff --git a/pos_price_to_weight/readme/CONTRIBUTORS.rst b/pos_price_to_weight/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..9f76a75bc1 --- /dev/null +++ b/pos_price_to_weight/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sylvain LE GAL diff --git a/pos_price_to_weight/readme/CREDITS.rst b/pos_price_to_weight/readme/CREDITS.rst new file mode 100644 index 0000000000..d8179e4627 --- /dev/null +++ b/pos_price_to_weight/readme/CREDITS.rst @@ -0,0 +1 @@ +Icon parts come from http://icons8.com diff --git a/pos_price_to_weight/readme/DESCRIPTION.rst b/pos_price_to_weight/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..bfeeb5280a --- /dev/null +++ b/pos_price_to_weight/readme/DESCRIPTION.rst @@ -0,0 +1,46 @@ +This module extends Odoo Point Of Sale features, to allow to scan barcode +with price and to compute according quantity. + +In Odoo by default, there are three types of barcode rules for products. + +* 'Unit Product' (``type=product``). Scanning a product will add a unit of this + product to the current order. +* 'Priced product' (``type=price``). A price is extracted from the barcode, and + a new line with the given price and a quantity = 1 is added to the current + order. +* 'Weighted product' (``type=weight``). A weight is extracted from the barcode, + and a new line with the given weight, and a computed price + (quantity * Unit price) is added to the current order. + +This module add a new option: + +* 'Priced Product (Computed Weight)' (``type=price_to_weight``). A price is + extracted from the barcode, and a new line with the given price, and a + computed quantity (Price / Unit Price) is added to the current order. + +This module is usefull in shops with products scaled, to manage correctly +stock quantities. + +**Samples** + +* Given a product with a unit price of 1,50€ / kg + +* The barcode is 0212345{NNNDD}x where: + * 02 is the prefix of the barcode rule + * 12345 is the product number + * {NNNDD} is the price of the scaled product + * x is the control digit + +* On the product we so set '0212345000007' in the barcode field. + +* if the scanned barcode is 0212345002650: + * {NNNDD} is 00265, the price is so 2,65€ + * the according quantity is 2,65€ / 1,5 €/kg = 1,767 kg + +.. figure:: ../static/description/pos_test_1.png + +* if the scanned barcode is 0212345008102: + * {NNNDD} is 00810, the price is so 8,10€ + * the according quantity is 8,10€ / 1,5 €/kg = 5,400 kg + +.. figure:: ../static/description/pos_test_2.png diff --git a/pos_price_to_weight/static/description/barcode_rule.png b/pos_price_to_weight/static/description/barcode_rule.png new file mode 100644 index 0000000000..e4aba69874 Binary files /dev/null and b/pos_price_to_weight/static/description/barcode_rule.png differ diff --git a/pos_price_to_weight/static/description/icon.png b/pos_price_to_weight/static/description/icon.png new file mode 100644 index 0000000000..e45fc5cba1 Binary files /dev/null and b/pos_price_to_weight/static/description/icon.png differ diff --git a/pos_price_to_weight/static/description/index.html b/pos_price_to_weight/static/description/index.html new file mode 100644 index 0000000000..fd91d33201 --- /dev/null +++ b/pos_price_to_weight/static/description/index.html @@ -0,0 +1,499 @@ + + + + + +Point of Sale - Price to Weight + + + +
+

Point of Sale - Price to Weight

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

This module extends Odoo Point Of Sale features, to allow to scan barcode +with price and to compute according quantity.

+

In Odoo by default, there are three types of barcode rules for products.

+
    +
  • ‘Unit Product’ (type=product). Scanning a product will add a unit of this +product to the current order.
  • +
  • ‘Priced product’ (type=price). A price is extracted from the barcode, and +a new line with the given price and a quantity = 1 is added to the current +order.
  • +
  • ‘Weighted product’ (type=weight). A weight is extracted from the barcode, +and a new line with the given weight, and a computed price +(quantity * Unit price) is added to the current order.
  • +
+

This module add a new option:

+
    +
  • ‘Priced Product (Computed Weight)’ (type=price_to_weight). A price is +extracted from the barcode, and a new line with the given price, and a +computed quantity (Price / Unit Price) is added to the current order.
  • +
+

This module is usefull in shops with products scaled, to manage correctly +stock quantities.

+

Samples

+
    +
  • Given a product with a unit price of 1,50€ / kg
  • +
  • +
    The barcode is 0212345{NNNDD}x where:
    +
      +
    • 02 is the prefix of the barcode rule
    • +
    • 12345 is the product number
    • +
    • {NNNDD} is the price of the scaled product
    • +
    • x is the control digit
    • +
    +
    +
    +
  • +
  • On the product we so set ‘0212345000007’ in the barcode field.
  • +
  • +
    if the scanned barcode is 0212345002650:
    +
      +
    • {NNNDD} is 00265, the price is so 2,65€
    • +
    • the according quantity is 2,65€ / 1,5 €/kg = 1,767 kg
    • +
    +
    +
    +
  • +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_price_to_weight/static/description/pos_test_1.png +
+
    +
  • +
    if the scanned barcode is 0212345008102:
    +
      +
    • {NNNDD} is 00810, the price is so 8,10€
    • +
    • the according quantity is 8,10€ / 1,5 €/kg = 5,400 kg
    • +
    +
    +
    +
  • +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_price_to_weight/static/description/pos_test_2.png +
+

Table of contents

+ +
+

Configuration

+
    +
  • Go to Point of Sale > Configuration > Barcode Nomenclatures
  • +
  • Edit your barcode rules, according to your barcodes settings
  • +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_price_to_weight/static/description/barcode_rule.png +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • La Louve
  • +
  • GRAP
  • +
+
+ +
+

Other credits

+

Icon parts come from http://icons8.com

+
+
+

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

+

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

+
+
+
+ + diff --git a/pos_price_to_weight/static/description/pos_test_1.png b/pos_price_to_weight/static/description/pos_test_1.png new file mode 100644 index 0000000000..40022e54db Binary files /dev/null and b/pos_price_to_weight/static/description/pos_test_1.png differ diff --git a/pos_price_to_weight/static/description/pos_test_2.png b/pos_price_to_weight/static/description/pos_test_2.png new file mode 100644 index 0000000000..773401d471 Binary files /dev/null and b/pos_price_to_weight/static/description/pos_test_2.png differ diff --git a/pos_price_to_weight/static/src/js/ProductScreen.js b/pos_price_to_weight/static/src/js/ProductScreen.js new file mode 100644 index 0000000000..f28bda0a02 --- /dev/null +++ b/pos_price_to_weight/static/src/js/ProductScreen.js @@ -0,0 +1,59 @@ +/* + Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) + @author: Sylvain LE GAL (https://twitter.com/legalsylvain) + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +*/ +odoo.define("pos_price_to_weight.ProductScreen", function (require) { + "use strict"; + + const ProductScreen = require("point_of_sale.ProductScreen"); + const Registries = require("point_of_sale.Registries"); + const {useBarcodeReader} = require("point_of_sale.custom_hooks"); + const NumberBuffer = require("point_of_sale.NumberBuffer"); + + const PosPriceToWeightProductScreen = (OriginalProductScreen) => + class extends OriginalProductScreen { + setup() { + super.setup(); + useBarcodeReader({ + price_to_weight: this._barcodeProductAction, + }); + } + async _barcodeProductAction(code) { + if (code.type !== "price_to_weight") { + return await super._barcodeProductAction(...arguments); + } + + // copy of the original function '_barcodeProductAction' + const product = await this._getProductByBarcode(code); + if (!product) { + return; + } + const options = await this._getAddProductOptions(product, code); + // Do not proceed on adding the product when no options is returned. + // This is consistent with _clickProduct. + if (!options) return; + // copy of the original function '_barcodeProductAction' + + // update the options depending on the type of the scanned code + + var quantity = 0; + var barcode_price = parseFloat(code.value, 10) || 0; + var product_price = product.lst_price; + + if (product_price !== 0) { + quantity = barcode_price / product_price; + } + Object.assign(options, { + quantity: quantity, + merge: false, + }); + this.currentOrder.add_product(product, options); + NumberBuffer.reset(); + } + }; + + Registries.Component.extend(ProductScreen, PosPriceToWeightProductScreen); + + return ProductScreen; +}); diff --git a/setup/pos_price_to_weight/odoo/addons/pos_price_to_weight b/setup/pos_price_to_weight/odoo/addons/pos_price_to_weight new file mode 120000 index 0000000000..b2b5503241 --- /dev/null +++ b/setup/pos_price_to_weight/odoo/addons/pos_price_to_weight @@ -0,0 +1 @@ +../../../../pos_price_to_weight \ No newline at end of file diff --git a/setup/pos_price_to_weight/setup.py b/setup/pos_price_to_weight/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_price_to_weight/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)