OCA-git-bot
5 years ago
22 changed files with 386 additions and 0 deletions
-
1pos_price_to_weight/__init__.py
-
25pos_price_to_weight/__manifest__.py
-
23pos_price_to_weight/data/barcode_rule.xml
-
18pos_price_to_weight/demo/product_product.xml
-
36pos_price_to_weight/i18n/ca.po
-
36pos_price_to_weight/i18n/es.po
-
37pos_price_to_weight/i18n/fr.po
-
36pos_price_to_weight/i18n/it.po
-
32pos_price_to_weight/i18n/pos_price_to_weight.pot
-
1pos_price_to_weight/models/__init__.py
-
13pos_price_to_weight/models/barcode_rule.py
-
2pos_price_to_weight/readme/CONFIGURE.rst
-
2pos_price_to_weight/readme/CONTRIBUTORS.rst
-
1pos_price_to_weight/readme/CREDITS.rst
-
46pos_price_to_weight/readme/DESCRIPTION.rst
-
BINpos_price_to_weight/static/description/barcode_rule.png
-
BINpos_price_to_weight/static/description/icon.png
-
BINpos_price_to_weight/static/description/pos_test_1.png
-
BINpos_price_to_weight/static/description/pos_test_2.png
-
38pos_price_to_weight/static/src/js/models.js
-
24pos_price_to_weight/static/src/js/screens.js
-
15pos_price_to_weight/views/assets.xml
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,25 @@ |
|||
# Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>) |
|||
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>) |
|||
# @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': '12.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': 'http://www.lalouve.net/', |
|||
'license': 'AGPL-3', |
|||
'depends': [ |
|||
'point_of_sale', |
|||
], |
|||
'data': [ |
|||
'data/barcode_rule.xml', |
|||
'views/assets.xml', |
|||
], |
|||
'demo': [ |
|||
'demo/product_product.xml', |
|||
], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2017 - 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> |
|||
|
|||
<data noupdate="1"> |
|||
|
|||
<record id="rule_price_to_weight" model="barcode.rule"> |
|||
<field name="name">Price Barcodes (Computed Weight) 2 Decimals</field> |
|||
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature"/> |
|||
<field name="type">price_to_weight</field> |
|||
<field name="pattern">02.....{NNNDD}</field> |
|||
<field name="sequence">15</field> |
|||
<field name="encoding">ean13</field> |
|||
</record> |
|||
|
|||
</data> |
|||
|
|||
</odoo> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- |
|||
Copyright (C) 2017 - 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> |
|||
|
|||
<record id="product_price_to_weight_barcode" model="product.product"> |
|||
<field name="name">Apples (with Price To Weight Barcode)</field> |
|||
<field name="barcode">0212345000007</field> |
|||
<field name="list_price">1.50</field> |
|||
<field name="uom_id" ref="uom.product_uom_kgm"/> |
|||
<field name="uom_po_id" ref="uom.product_uom_kgm"/> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,36 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_price_to_weight |
|||
# |
|||
# Translators: |
|||
# OCA Transbot <transbot@odoo-community.org>, 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: 2018-01-20 15:54+0000\n" |
|||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\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" |
|||
|
|||
#. 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 |
|||
#: code:addons/pos_price_to_weight/models/barcode_rule.py:13 |
|||
#, python-format |
|||
msgid "Priced Product (Computed Weight)" |
|||
msgstr "Producte amb preu (pes automatitzat)" |
|||
|
|||
#. module: pos_price_to_weight |
|||
#: model:ir.model,name:pos_price_to_weight.model_barcode_rule |
|||
msgid "barcode.rule" |
|||
msgstr "barcode.rule" |
@ -0,0 +1,36 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_price_to_weight |
|||
# |
|||
# Translators: |
|||
# enjolras <yo@miguelrevilla.com>, 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: 2018-03-01 02:01+0000\n" |
|||
"Last-Translator: enjolras <yo@miguelrevilla.com>, 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" |
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
|||
|
|||
#. 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 |
|||
#: code:addons/pos_price_to_weight/models/barcode_rule.py:13 |
|||
#, python-format |
|||
msgid "Priced Product (Computed Weight)" |
|||
msgstr "Producto con precio (precio calculado)" |
|||
|
|||
#. module: pos_price_to_weight |
|||
#: model:ir.model,name:pos_price_to_weight.model_barcode_rule |
|||
msgid "barcode.rule" |
|||
msgstr "barcode.rule" |
@ -0,0 +1,37 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_price_to_weight |
|||
# |
|||
# Translators: |
|||
# Quentin THEURET <odoo@kerpeo.com>, 2018 |
|||
# OCA Transbot <transbot@odoo-community.org>, 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: 2018-03-01 02:01+0000\n" |
|||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\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" |
|||
|
|||
#. 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 Pois)" |
|||
|
|||
#. module: pos_price_to_weight |
|||
#: code:addons/pos_price_to_weight/models/barcode_rule.py:13 |
|||
#, python-format |
|||
msgid "Priced Product (Computed Weight)" |
|||
msgstr "Prix du produit (Poid calculé)" |
|||
|
|||
#. module: pos_price_to_weight |
|||
#: model:ir.model,name:pos_price_to_weight.model_barcode_rule |
|||
msgid "barcode.rule" |
|||
msgstr "barcode.rule" |
@ -0,0 +1,36 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_price_to_weight |
|||
# |
|||
# Translators: |
|||
# Francesco Fresta <franco.fresta@gmail.com>, 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: 2018-03-01 02:01+0000\n" |
|||
"Last-Translator: Francesco Fresta <franco.fresta@gmail.com>, 2018\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" |
|||
|
|||
#. 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 |
|||
#: code:addons/pos_price_to_weight/models/barcode_rule.py:13 |
|||
#, python-format |
|||
msgid "Priced Product (Computed Weight)" |
|||
msgstr "" |
|||
|
|||
#. module: pos_price_to_weight |
|||
#: model:ir.model,name:pos_price_to_weight.model_barcode_rule |
|||
msgid "barcode.rule" |
|||
msgstr "barcode.rule" |
@ -0,0 +1,32 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_price_to_weight |
|||
# |
|||
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: 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 |
|||
#: code:addons/pos_price_to_weight/models/barcode_rule.py:13 |
|||
#, python-format |
|||
msgid "Priced Product (Computed Weight)" |
|||
msgstr "" |
|||
|
|||
#. module: pos_price_to_weight |
|||
#: model:ir.model,name:pos_price_to_weight.model_barcode_rule |
|||
msgid "barcode.rule" |
|||
msgstr "" |
|||
|
@ -0,0 +1 @@ |
|||
from . import barcode_rule |
@ -0,0 +1,13 @@ |
|||
# Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import models, fields |
|||
|
|||
|
|||
class BarcodeRule(models.Model): |
|||
_inherit = 'barcode.rule' |
|||
|
|||
type = fields.Selection(selection_add=[ |
|||
('price_to_weight', 'Priced Product (Computed Weight)') |
|||
]) |
@ -0,0 +1,2 @@ |
|||
* Go to 'Point of Sale' / 'Configuration' / 'Barcode Nomenclatures' |
|||
* Edit your barcode rules, according to your barcodes settings |
@ -0,0 +1,2 @@ |
|||
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
|||
* Druidoo <https://www.druidoo.io> |
@ -0,0 +1 @@ |
|||
Icon parts come from http://icons8.com |
@ -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. |
|||
|
|||
.. image:: ../static/description/barcode_rule.png |
|||
:width: 800 px |
|||
|
|||
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 |
|||
|
|||
if {NNNDD} is 00265, the price is so 2,65€ and the according quantity is |
|||
2,65€ / 1,5 €/kg = 1,767 kg |
|||
|
|||
.. image:: ../static/description/pos_test_1.png |
|||
:width: 800 px |
|||
|
|||
if {NNNDD} is 00810, the price is so 8,10€ and the according quantity is |
|||
8,10€ / 1,5 €/kg = 5,400 kg |
|||
|
|||
.. image:: ../static/description/pos_test_2.png |
|||
:width: 800 px |
After Width: 887 | Height: 225 | Size: 18 KiB |
After Width: 128 | Height: 128 | Size: 7.7 KiB |
After Width: 632 | Height: 209 | Size: 26 KiB |
After Width: 637 | Height: 217 | Size: 27 KiB |
@ -0,0 +1,38 @@ |
|||
///*
|
|||
// Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>)
|
|||
// @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.models', function (require) { |
|||
"use strict"; |
|||
|
|||
var models = require('point_of_sale.models'); |
|||
|
|||
var _super_PosModel = models.PosModel.prototype; |
|||
|
|||
models.PosModel = models.PosModel.extend({ |
|||
|
|||
scan_product: function(parsed_code) { |
|||
if (! (parsed_code.type === 'price_to_weight')){ |
|||
// Normal behaviour
|
|||
return _super_PosModel.scan_product.apply(this, [parsed_code]); |
|||
} |
|||
// Compute quantity, based on price and unit price
|
|||
var selectedOrder = this.get_order(); |
|||
var product = this.db.get_product_by_barcode(parsed_code.base_code); |
|||
if(!product){ |
|||
return false; |
|||
} |
|||
var quantity = 0; |
|||
var price = parseFloat(parsed_code.value) || 0; |
|||
if (price !== 0 && product.price !== 0){ |
|||
quantity = price / product.price; |
|||
} |
|||
selectedOrder.add_product(product, {quantity: quantity, merge: false}); |
|||
return true; |
|||
}, |
|||
|
|||
}); |
|||
}); |
@ -0,0 +1,24 @@ |
|||
/* |
|||
Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>)
|
|||
@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.screens', function (require) { |
|||
"use strict"; |
|||
|
|||
var screens = require('point_of_sale.screens'); |
|||
|
|||
screens.ScreenWidget.include({ |
|||
show: function(){ |
|||
this._super(); |
|||
var self = this; |
|||
this.pos.barcode_reader.set_action_callback({ |
|||
'price_to_weight': _.bind(self.barcode_product_action, self), |
|||
}); |
|||
}, |
|||
}); |
|||
|
|||
return screens; |
|||
}); |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>) |
|||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
--> |
|||
|
|||
<odoo> |
|||
<template id="assets_frontend" inherit_id="point_of_sale.assets"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/pos_price_to_weight/static/src/js/screens.js"/> |
|||
<script type="text/javascript" src="/pos_price_to_weight/static/src/js/models.js"/> |
|||
</xpath> |
|||
</template> |
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue