Skip to content

Commit

Permalink
[REF] remove contributors for totally refactored code.
Browse files Browse the repository at this point in the history
[REM] Remove useless 'Price To Weight Field' on the pos.config. (sale price is lst_price).
[REF] Adapt js code to new PoS framework.
[REF] Move barcode.rule 'data' into 'demo'
  • Loading branch information
legalsylvain committed Jul 2, 2024
1 parent 16d9819 commit 45f8195
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 260 deletions.
56 changes: 22 additions & 34 deletions pos_price_to_weight/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Point of Sale - Price to Weight
: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/12.0/pos_price_to_weight
: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-12-0/pos-12-0-pos_price_to_weight
: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=12.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -33,47 +33,47 @@ 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
* '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
* '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,
* '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
* '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:: https://raw.githubusercontent.com/OCA/pos/12.0/pos_price_to_weight/static/description/barcode_rule.png
:width: 800 px

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

Samples
**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
* On the product we so set '0212345000007' in the barcode field.

.. image:: https://raw.githubusercontent.com/OCA/pos/12.0/pos_price_to_weight/static/description/pos_test_1.png
:width: 800 px
* 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

if {NNNDD} is 00810, the price is so 8,10€ and 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_1.png

.. image:: https://raw.githubusercontent.com/OCA/pos/12.0/pos_price_to_weight/static/description/pos_test_2.png
:width: 800 px
* 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**

Expand All @@ -86,26 +86,15 @@ Configuration
* Go to Point of Sale > Configuration > Barcode Nomenclatures
* Edit your barcode rules, according to your barcodes settings

* Go to Point of Sale > Configuration > Point of Sale
* Select the 'Unit Price' field that will be used to convert the price to weight.

.. image:: https://raw.githubusercontent.com/OCA/pos/12.0/pos_price_to_weight/static/description/pos_config_form.png
:width: 800 px

**Note:**

By default, this is the field ``list_price`` that will be used.
If you want to use a custom field, it should be loaded in the javascript file calling

``models.load_fields("product.product", ['my_custom_field']);``
.. 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 <https://github.com/OCA/pos/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 <https://github.com/OCA/pos/issues/new?body=module:%20pos_price_to_weight%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_price_to_weight%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -122,7 +111,6 @@ Contributors
~~~~~~~~~~~~

* Sylvain LE GAL <https://twitter.com/legalsylvain>
* Druidoo <https://www.druidoo.io>

Other credits
~~~~~~~~~~~~~
Expand All @@ -142,6 +130,6 @@ 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 <https://github.com/OCA/pos/tree/12.0/pos_price_to_weight>`_ project on GitHub.
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_price_to_weight>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
18 changes: 9 additions & 9 deletions pos_price_to_weight/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>)
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
# 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).

Expand All @@ -11,16 +11,16 @@
"author": "La Louve, GRAP, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": [
"point_of_sale",
],
"data": [
"data/barcode_rule.xml",
"views/assets.xml",
"views/view_pos_config.xml",
],
"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,
}
25 changes: 0 additions & 25 deletions pos_price_to_weight/data/barcode_rule.xml

This file was deleted.

21 changes: 21 additions & 0 deletions pos_price_to_weight/demo/barcode_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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="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>

</odoo>
1 change: 0 additions & 1 deletion pos_price_to_weight/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import barcode_rule
from . import pos_config
4 changes: 3 additions & 1 deletion pos_price_to_weight/models/barcode_rule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (C) 2017-Today: La Louve (<http://www.lalouve.net/>)
# 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).

Expand All @@ -9,5 +10,6 @@ class BarcodeRule(models.Model):
_inherit = "barcode.rule"

type = fields.Selection(
selection_add=[("price_to_weight", "Priced Product (Computed Weight)")]
selection_add=[("price_to_weight", "Priced Product (Computed Weight)")],
ondelete={"price_to_weight": "cascade"},
)
23 changes: 0 additions & 23 deletions pos_price_to_weight/models/pos_config.py

This file was deleted.

13 changes: 1 addition & 12 deletions pos_price_to_weight/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
* Go to Point of Sale > Configuration > Barcode Nomenclatures
* Edit your barcode rules, according to your barcodes settings

* Go to Point of Sale > Configuration > Point of Sale
* Select the 'Unit Price' field that will be used to convert the price to weight.

.. image:: ../static/description/pos_config_form.png
:width: 800 px

**Note:**

By default, this is the field ``list_price`` that will be used.
If you want to use a custom field, it should be loaded in the javascript file calling

``models.load_fields("product.product", ['my_custom_field']);``
.. figure:: ../static/description/barcode_rule.png
1 change: 0 additions & 1 deletion pos_price_to_weight/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* Sylvain LE GAL <https://twitter.com/legalsylvain>
* Druidoo <https://www.druidoo.io>
32 changes: 16 additions & 16 deletions pos_price_to_weight/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@ 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
* '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
* '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,
* '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
* '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
**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
* 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

.. image:: ../static/description/pos_test_1.png
:width: 800 px
.. figure:: ../static/description/pos_test_1.png

if {NNNDD} is 00810, the price is so 8,10€ and the according quantity is
8,10€ / 1,5 €/kg = 5,400 kg
* 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

.. image:: ../static/description/pos_test_2.png
:width: 800 px
.. figure:: ../static/description/pos_test_2.png
Loading

0 comments on commit 45f8195

Please sign in to comment.