diff --git a/pos_barcode_tare/models/pos_config.py b/pos_barcode_tare/models/pos_config.py
index c6756101..380cfbfb 100644
--- a/pos_barcode_tare/models/pos_config.py
+++ b/pos_barcode_tare/models/pos_config.py
@@ -9,3 +9,12 @@ class PosConfig(models.Model):
'Show tare label button',
help="Print tare labels with this POS"
)
+
+ iface_tare_barcode_sequence_id = fields.Integer(
+ 'Barcode nomenclature sequence ID',
+ default=36,
+ required=True,
+ help="""The nomenclature ID gives barcode pattern.
+ It can be found in POS Barcode Nomenclatures. The expected barcode
+ pattern is 21.....{NNDDD}"""
+ )
diff --git a/pos_barcode_tare/readme/DESCRIPTION.rst b/pos_barcode_tare/readme/DESCRIPTION.rst
index 81f22d95..a3142610 100644
--- a/pos_barcode_tare/readme/DESCRIPTION.rst
+++ b/pos_barcode_tare/readme/DESCRIPTION.rst
@@ -1,24 +1,30 @@
-This add-on enables POS to read and print tare barcodes. We print a barcode tare label to sell loose goods in a Bring Your Own Container (BYOC) scheme.
+This add-on enables POS to read and print tare barcodes. We print a barcode tare label to sell loose goods in a Bring Your Own pot (BYOC) scheme.
-The BYOC scheme has four steps:
- 1. The cashier weighs the container and sticks the tare bar code onto the customer's pot.
- 2. The customer takes the desired quantity of the goods s-he wants to buy.
- 3. The cashier weighs the filled container and goods, and POS gives the corresponding price.
- 4. The cashier scans the tare bar code, and POS removes the container's weight from the latest product of the order.
+The BYOC scheme has five steps:
+ 1. The cashier weighs the pot and sticks the tare barcode onto the customer's pot.
+ 2. The customer go and put loose goods into the labeled pot.
+ 3. The cashier weighs the pot with loose goods inside. POS computes the price including the pot.
+ 4. The cashier scans the tare barcode. POS get the pot weight from the barcode. POS subtracts the pot weight from the weight of the latest product. POS sets the billable price for the loose goods.
+ 5. The customer pays.
This add-on adds a news screen to POS to print (web) the tare barcode labels. This add-on enables POS to read a tare barcode. Reading a barcode makes POS adjust the weight of the latest article in the order list. The new weight is equal to the total weight minus the tare weight. The price is updated accordingly to the weight change.
POS home screen is now:
+
.. image:: ../static/description/POS_with_button.png
The label screen is:
+
.. image:: ../static/description/null_weight.png
When we read a weight the impression button is enabled
+
.. image:: ../static/description/ready_to_print.png
A barcode label looks like:
+
.. image:: ../static/description/label.png
Zoom on the action widget:
-.. image:: ../static/description/zoom_action_widget.png
\ No newline at end of file
+
+.. image:: ../static/description/zoom_action_widget.png
diff --git a/pos_barcode_tare/readme/ROADMAP.rst b/pos_barcode_tare/readme/ROADMAP.rst
index 2a5f2573..4144c08f 100644
--- a/pos_barcode_tare/readme/ROADMAP.rst
+++ b/pos_barcode_tare/readme/ROADMAP.rst
@@ -1,2 +1 @@
-- Use barcode nomenclature instead of hardcoded barcode prefix 21.
-- Add french translation.
\ No newline at end of file
+- Add french translation.
diff --git a/pos_barcode_tare/readme/USAGE.rst b/pos_barcode_tare/readme/USAGE.rst
index efe92154..3708b1f3 100644
--- a/pos_barcode_tare/readme/USAGE.rst
+++ b/pos_barcode_tare/readme/USAGE.rst
@@ -1 +1,5 @@
-Install this add-on and configure the point of sale where you want to be able to use the tare barecode. The label printing is done using web print. To streamline the label printing it is advised to use the silent printing mode (firefox) or the kiosk printing (chrome).
+Install this add-on and configure the point of sale where you want to be able to use the tare barecode. Setup the default barcode sequence ID according to your barcode nomenclature. The label printing is done using web print. To streamline the label printing it is advised to use the silent printing mode (firefox) or the kiosk printing (chrome).
+
+The command line to start a chrome base browser in kiosk mode with silent printing looks like:
+
+``chromium-browser --use-system-default-printer --kiosk --kiosk-printing http://localhost:8069/``
diff --git a/pos_barcode_tare/static/description/POS_with_button.png b/pos_barcode_tare/static/description/POS_with_button.png
index 6a3c8921..58c7396d 100644
Binary files a/pos_barcode_tare/static/description/POS_with_button.png and b/pos_barcode_tare/static/description/POS_with_button.png differ
diff --git a/pos_barcode_tare/static/description/null_weight.png b/pos_barcode_tare/static/description/null_weight.png
index 31de08cc..df7f9199 100644
Binary files a/pos_barcode_tare/static/description/null_weight.png and b/pos_barcode_tare/static/description/null_weight.png differ
diff --git a/pos_barcode_tare/static/description/ready_to_print.png b/pos_barcode_tare/static/description/ready_to_print.png
index 252f3f58..4ff7866d 100644
Binary files a/pos_barcode_tare/static/description/ready_to_print.png and b/pos_barcode_tare/static/description/ready_to_print.png differ
diff --git a/pos_barcode_tare/static/description/zoom_action_widget.png b/pos_barcode_tare/static/description/zoom_action_widget.png
index 48636dd1..c00add3f 100644
Binary files a/pos_barcode_tare/static/description/zoom_action_widget.png and b/pos_barcode_tare/static/description/zoom_action_widget.png differ
diff --git a/pos_barcode_tare/static/src/js/pos_barcode_tare.js b/pos_barcode_tare/static/src/js/pos_barcode_tare.js
index dcbb2d3a..0437c844 100644
--- a/pos_barcode_tare/static/src/js/pos_barcode_tare.js
+++ b/pos_barcode_tare/static/src/js/pos_barcode_tare.js
@@ -74,10 +74,15 @@ odoo.define('pos_barcode_tare.screens', function (require) {
next_screen: 'products',
previous_screen: 'products',
default_tare_value_kg: 0.0,
+ weight_barcode_prefix: null,
show: function () {
this._super();
var self = this;
+ // Fetch the barcode prefix from POS barcode parser rules.
+ this.weight_barcode_prefix = this.get_barcode_prefix(
+ this.pos.config.iface_tare_barcode_sequence_id);
+ // Setup the proxy
var queue = this.pos.proxy_queue;
// The pooling of the scale starts here.
queue.schedule(function () {
@@ -90,6 +95,24 @@ odoo.define('pos_barcode_tare.screens', function (require) {
this.render_receipt();
this.lock_screen(true);
},
+ get_barcode_prefix: function (barcode_sequence_id) {
+ var self = this;
+ var barcode_pattern = self.get_barcode_pattern(barcode_sequence_id);
+ return barcode_pattern.substr(0, 2);
+ },
+ get_barcode_pattern: function (barcode_sequence_id) {
+ var self = this;
+ var rules = self.get_barcode_rules();
+ var rule = rules.filter(
+ function (r) {
+ return r.sequence === barcode_sequence_id;
+ })[0];
+ return rule.pattern;
+ },
+ get_barcode_rules: function () {
+ var self = this;
+ return self.pos.barcode_reader.barcode_parser.nomenclature.rules;
+ },
set_weight: function (weight) {
if (weight > 0) {
this.weight = weight;
@@ -124,7 +147,6 @@ odoo.define('pos_barcode_tare.screens', function (require) {
// grams. Here the weight is 12.345kg. The last digit of the barcode
// is a checksum, here symbolized by x.
var padding_size = 5;
- var default_weight_prefix_id = "21";
var void_product_id = '0'.repeat(padding_size);
var weight_in_gram = weight * 10e2;
// Weight has to be padded with zeros.
@@ -132,8 +154,8 @@ odoo.define('pos_barcode_tare.screens', function (require) {
var padded_weight = weight_with_padding.substr(
weight_with_padding.length - padding_size);
// Builds the barcode data (ie. all but the checksum).
- var barcode_data = default_weight_prefix_id.concat(void_product_id,
- padded_weight);
+ var barcode_data = this.weight_barcode_prefix
+ .concat(void_product_id, padded_weight);
// Compute checksum and concat with barcode data to get the actual
// barcode.
var checksum = this.ean13_checksum(barcode_data);
diff --git a/pos_barcode_tare/views/pos_config_view.xml b/pos_barcode_tare/views/pos_config_view.xml
index ffce7377..924ecd05 100644
--- a/pos_barcode_tare/views/pos_config_view.xml
+++ b/pos_barcode_tare/views/pos_config_view.xml
@@ -9,6 +9,7 @@
+