odoo-addon-product-pricelist-margin 16.0.1.0.0.1__py3-none-any.whl → 16.0.1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ Product Pricelist Margin
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:f7a304e2acd01b42ff2f6e9de3dfa6a6ee4519e2beeddba42b49fad5e8d7d0b6
10
+ !! source digest: sha256:dc8510564853288111a4571a059483243935dbb40389835c1fec35080582945e
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -29,6 +29,8 @@ Product Pricelist Margin
29
29
  |badge1| |badge2| |badge3| |badge4| |badge5|
30
30
 
31
31
  This module shows the product's cost and margin from the pricelists.
32
+ The margin is calculated as the difference between the price and the cost, expressed as a percentage of the price.
33
+ The price is based on the computation applied from the current pricelist item. This allows the user to make price simulations while editing the pricelist item.
32
34
 
33
35
  **Table of contents**
34
36
 
@@ -67,6 +69,7 @@ Contributors
67
69
  ~~~~~~~~~~~~
68
70
 
69
71
  * Nguyen Minh Chien <chien@trobz.com>
72
+ * Telmo Santos <telmo.santos@camptocamp.com>
70
73
 
71
74
  Maintainers
72
75
  ~~~~~~~~~~~
@@ -3,7 +3,7 @@
3
3
  {
4
4
  "name": "Product Pricelist Margin",
5
5
  "summary": "This module shows the product's cost and margin from the pricelists.",
6
- "version": "16.0.1.0.0",
6
+ "version": "16.0.1.0.1",
7
7
  "category": "Product",
8
8
  "website": "https://github.com/OCA/product-attribute",
9
9
  "author": "Camptocamp, Odoo Community Association (OCA)",
@@ -0,0 +1,53 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * product_pricelist_margin
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 16.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "PO-Revision-Date: 2025-05-14 12:23+0000\n"
10
+ "Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11
+ "Language-Team: none\n"
12
+ "Language: it\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: \n"
16
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Weblate 5.10.4\n"
18
+
19
+ #. module: product_pricelist_margin
20
+ #: model:ir.model.fields,field_description:product_pricelist_margin.field_product_pricelist_item__cost
21
+ msgid "Cost"
22
+ msgstr "Costo"
23
+
24
+ #. module: product_pricelist_margin
25
+ #: model:ir.model.fields,help:product_pricelist_margin.field_product_pricelist_item__cost
26
+ msgid ""
27
+ "In Standard Price & AVCO: value of the product (automatically computed in AVCO).\n"
28
+ " In FIFO: value of the next unit that will leave the stock (automatically computed).\n"
29
+ " Used to value the product when the purchase cost is not known (e.g. inventory adjustment).\n"
30
+ " Used to compute margins on sale orders."
31
+ msgstr ""
32
+ "Nei prezzi standard & costi medi: valore del prodotto (calcolato "
33
+ "automaticamente nei costi medi).\n"
34
+ " In FIFO: valore dell'unità successiva che lascerà il magazzino ("
35
+ "calcolato automaticamente).\n"
36
+ " Utilizzato per valutare il prodotto quando il costo di acquisto non "
37
+ "è noto (es. rettifiche di inventario).\n"
38
+ " Utilizzato per calcolare i margini negli ordini di vendita."
39
+
40
+ #. module: product_pricelist_margin
41
+ #: model:ir.model.fields,field_description:product_pricelist_margin.field_product_pricelist_item__margin
42
+ msgid "Margin"
43
+ msgstr "Margine"
44
+
45
+ #. module: product_pricelist_margin
46
+ #: model:ir.model.fields,field_description:product_pricelist_margin.field_product_pricelist_item__margin_percent
47
+ msgid "Margin (%)"
48
+ msgstr "Margine (%)"
49
+
50
+ #. module: product_pricelist_margin
51
+ #: model:ir.model,name:product_pricelist_margin.model_product_pricelist_item
52
+ msgid "Pricelist Rule"
53
+ msgstr "Regola listino prezzi"
@@ -2,7 +2,7 @@
2
2
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
3
 
4
4
  from odoo import api, fields, models
5
- from odoo.tools.float_utils import float_is_zero
5
+ from odoo.tools.float_utils import float_is_zero, float_round
6
6
 
7
7
 
8
8
  class ProductPricelistItem(models.Model):
@@ -37,17 +37,21 @@ class ProductPricelistItem(models.Model):
37
37
  )
38
38
  def _compute_margin(self):
39
39
  for item in self:
40
- if item.applied_on not in ("1_product", "0_product_variant"):
40
+ if (
41
+ item.applied_on not in ("1_product", "0_product_variant")
42
+ or not item.product_tmpl_id
43
+ ):
41
44
  item.margin = 0
42
45
  item.margin_percent = 0
43
46
  continue
44
47
 
45
- price_rule = item.pricelist_id._compute_price_rule(
46
- item.product_tmpl_id, item.min_quantity
48
+ price = item._compute_price(
49
+ item.product_tmpl_id,
50
+ item.min_quantity,
51
+ item.product_tmpl_id.uom_id,
52
+ fields.Datetime.now(),
47
53
  )
48
54
 
49
- price = price_rule.get(item.product_tmpl_id.id, [0])[0]
50
-
51
55
  if float_is_zero(price, precision_digits=item.currency_id.rounding):
52
56
  item.margin = 0
53
57
  item.margin_percent = 0
@@ -70,6 +74,7 @@ class ProductPricelistItem(models.Model):
70
74
  )
71
75
 
72
76
  item.margin = price_vat_excl - cost
73
- item.margin_percent = (
74
- price_vat_excl and (item.margin / price_vat_excl) * 100
77
+ item.margin_percent = float_round(
78
+ price_vat_excl and (item.margin / price_vat_excl) * 100,
79
+ self.env["decimal.precision"].precision_get("Product Unit of Measure"),
75
80
  )
@@ -1 +1,2 @@
1
1
  * Nguyen Minh Chien <chien@trobz.com>
2
+ * Telmo Santos <telmo.santos@camptocamp.com>
@@ -1 +1,3 @@
1
1
  This module shows the product's cost and margin from the pricelists.
2
+ The margin is calculated as the difference between the price and the cost, expressed as a percentage of the price.
3
+ The price is based on the computation applied from the current pricelist item. This allows the user to make price simulations while editing the pricelist item.
@@ -1,4 +1,3 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
3
  <head>
@@ -368,10 +367,12 @@ ul.auto-toc {
368
367
  !! This file is generated by oca-gen-addon-readme !!
369
368
  !! changes will be overwritten. !!
370
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
371
- !! source digest: sha256:f7a304e2acd01b42ff2f6e9de3dfa6a6ee4519e2beeddba42b49fad5e8d7d0b6
370
+ !! source digest: sha256:dc8510564853288111a4571a059483243935dbb40389835c1fec35080582945e
372
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
373
372
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/16.0/product_pricelist_margin"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_pricelist_margin"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
374
- <p>This module shows the product’s cost and margin from the pricelists.</p>
373
+ <p>This module shows the product’s cost and margin from the pricelists.
374
+ The margin is calculated as the difference between the price and the cost, expressed as a percentage of the price.
375
+ The price is based on the computation applied from the current pricelist item. This allows the user to make price simulations while editing the pricelist item.</p>
375
376
  <p><strong>Table of contents</strong></p>
376
377
  <div class="contents local topic" id="contents">
377
378
  <ul class="simple">
@@ -414,6 +415,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
414
415
  <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
415
416
  <ul class="simple">
416
417
  <li>Nguyen Minh Chien &lt;<a class="reference external" href="mailto:chien&#64;trobz.com">chien&#64;trobz.com</a>&gt;</li>
418
+ <li>Telmo Santos &lt;<a class="reference external" href="mailto:telmo.santos&#64;camptocamp.com">telmo.santos&#64;camptocamp.com</a>&gt;</li>
417
419
  </ul>
418
420
  </div>
419
421
  <div class="section" id="maintainers">
@@ -37,7 +37,18 @@ class TestMargin(BaseCommon):
37
37
  )
38
38
  cls.env.ref("product.group_sale_pricelist").users |= cls.env.user
39
39
 
40
- def test_margin_computation_compute_price(self):
40
+ def test_margin_with_fixed_price_computation(self):
41
41
  self.assertEqual(self.line.cost, 20.0)
42
42
  self.assertEqual(self.line.margin, (35 - 20))
43
- self.assertEqual(self.line.margin_percent, ((35 - 20) / 35) * 100)
43
+ self.assertEqual(self.line.margin_percent, 42.86)
44
+
45
+ # Copy production and test that margin is computed based on current item
46
+ # => self.line should not impact margin of new_line
47
+ new_line = self.line.copy()
48
+ new_line.fixed_price = 40
49
+ self.assertEqual(new_line.margin, (40 - 20))
50
+ self.assertEqual(new_line.margin_percent, 50.00)
51
+
52
+ def test_margin_with_discount_computation(self):
53
+ self.line.write({"compute_price": "percentage", "percent_price": 0.5})
54
+ self.assertAlmostEqual(self.line.margin_percent, 49.75)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-product_pricelist_margin
3
- Version: 16.0.1.0.0.1
3
+ Version: 16.0.1.0.1
4
4
  Summary: This module shows the product's cost and margin from the pricelists.
5
5
  Home-page: https://github.com/OCA/product-attribute
6
6
  Author: Camptocamp, Odoo Community Association (OCA)
@@ -22,7 +22,7 @@ Product Pricelist Margin
22
22
  !! This file is generated by oca-gen-addon-readme !!
23
23
  !! changes will be overwritten. !!
24
24
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
- !! source digest: sha256:f7a304e2acd01b42ff2f6e9de3dfa6a6ee4519e2beeddba42b49fad5e8d7d0b6
25
+ !! source digest: sha256:dc8510564853288111a4571a059483243935dbb40389835c1fec35080582945e
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
27
 
28
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -44,6 +44,8 @@ Product Pricelist Margin
44
44
  |badge1| |badge2| |badge3| |badge4| |badge5|
45
45
 
46
46
  This module shows the product's cost and margin from the pricelists.
47
+ The margin is calculated as the difference between the price and the cost, expressed as a percentage of the price.
48
+ The price is based on the computation applied from the current pricelist item. This allows the user to make price simulations while editing the pricelist item.
47
49
 
48
50
  **Table of contents**
49
51
 
@@ -82,6 +84,7 @@ Contributors
82
84
  ~~~~~~~~~~~~
83
85
 
84
86
  * Nguyen Minh Chien <chien@trobz.com>
87
+ * Telmo Santos <telmo.santos@camptocamp.com>
85
88
 
86
89
  Maintainers
87
90
  ~~~~~~~~~~~
@@ -1,22 +1,23 @@
1
- odoo/addons/product_pricelist_margin/README.rst,sha256=3WTwkbV6M6C77XZlLZ7gS5lTpR5Ou_qnoFtiVr9m2Dg,3202
1
+ odoo/addons/product_pricelist_margin/README.rst,sha256=BcsJ3TPYSRpDhD-yJuFWLvp98E8KKVk1zD0gL5Gd6QQ,3523
2
2
  odoo/addons/product_pricelist_margin/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
3
- odoo/addons/product_pricelist_margin/__manifest__.py,sha256=dTIJ_RF8CZ5Fl0EFQ8CJF1EG4zUrkDTssgCYvfCvyQ0,572
3
+ odoo/addons/product_pricelist_margin/__manifest__.py,sha256=G6BMwEWHZTWBaTf-Pq0Uf4pvhsms5JAxybc203MfQrU,572
4
4
  odoo/addons/product_pricelist_margin/i18n/fr.pot,sha256=gvpSUOzdZfnw8PARtbfaNK7NQDhjpU9tD0AJbOlao0E,1643
5
+ odoo/addons/product_pricelist_margin/i18n/it.po,sha256=lTPFm7mzokdhWkjvk6ppiwvKLvyGvj1JpVIX-vnNwlU,2117
5
6
  odoo/addons/product_pricelist_margin/i18n/product_pricelist_margin.pot,sha256=DzN3dyKPk91lOR4KZ1inU3xEA_0r5Mt2NRvqmve-KMo,1507
6
7
  odoo/addons/product_pricelist_margin/i18n/product_pricelist_margins.pot,sha256=QxKxHYMfnmBCm-hgu9q0w-VZ1GL95TPJYI697El79BI,1598
7
8
  odoo/addons/product_pricelist_margin/models/__init__.py,sha256=5O-ZCP4vtIwGNcyevX6dEHWtAgA-rVUcHEiBf70zr4o,37
8
- odoo/addons/product_pricelist_margin/models/product_pricelist_item.py,sha256=c0osh3rUUh7uf6vwew1cz6h3A3lJ3enhR_1FAQfGBE4,2177
9
- odoo/addons/product_pricelist_margin/readme/CONTRIBUTORS.rst,sha256=UJyDuCaB8tf9geXoaMc1oLOtC48nG131wx1ettF4BLY,38
10
- odoo/addons/product_pricelist_margin/readme/DESCRIPTION.rst,sha256=ssHn8TRsMaxSSCph4gwLkihlh0vaMI650tE4gy7G0rQ,69
9
+ odoo/addons/product_pricelist_margin/models/product_pricelist_item.py,sha256=y3icC18RpgYPo0gV2vUOltdg9jVTFebK-60i6GDYZMA,2375
10
+ odoo/addons/product_pricelist_margin/readme/CONTRIBUTORS.rst,sha256=jvDfnckW-vngwHGeEIW97ZhIYuxfHPHtWAWFERWpixg,82
11
+ odoo/addons/product_pricelist_margin/readme/DESCRIPTION.rst,sha256=IOTdecfoQQvTae_K2oXH8t3SiYN2RsI1fkKnron4M_8,344
11
12
  odoo/addons/product_pricelist_margin/readme/USAGE.rst,sha256=4bnXuUc-k5UL0X22YiBwpNooPMjqgcu2ZA3BBVJfN5E,172
12
13
  odoo/addons/product_pricelist_margin/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
13
- odoo/addons/product_pricelist_margin/static/description/index.html,sha256=aqsB6YmT-1teJG3r4TWtdf6KoV798SGokeuxUIDGg88,12938
14
+ odoo/addons/product_pricelist_margin/static/description/index.html,sha256=zuz2EDiwb1TWhqgVH6aYINNZMjk01Pf5aGR1hEJrdb8,13316
14
15
  odoo/addons/product_pricelist_margin/static/description/pricelist_item.png,sha256=HRwmmahzytnJiRoDziaVM_c6HKmXKxXpRlC_gYaoJ1M,50455
15
16
  odoo/addons/product_pricelist_margin/tests/__init__.py,sha256=UKD8x1fiapNCuRoRZroT8v_O7QHI1P4GHKEjteEq41E,26
16
- odoo/addons/product_pricelist_margin/tests/test_margin.py,sha256=EN04IOflZKUauVt0DbJT5onuVhBnJCyQ_qDBCuCsHMQ,1424
17
+ odoo/addons/product_pricelist_margin/tests/test_margin.py,sha256=Vx1Ypqh_ddNzXijJZpHMQNBfIc0MnNH52ZR4EKv_q08,1929
17
18
  odoo/addons/product_pricelist_margin/views/product_pricelist_item_views.xml,sha256=XwqCnck9dfZGt50odzC_DaAkrCZObYtSmg0xKtvv2zE,1929
18
19
  odoo/addons/product_pricelist_margin/views/product_pricelist_views.xml,sha256=g74Tkw7zVoa6CNJEpgLLkDaLHiFArB7kdJnfjX4GAXg,1650
19
- odoo_addon_product_pricelist_margin-16.0.1.0.0.1.dist-info/METADATA,sha256=FVznmIq7eMU_hSofHzfslYWt1xOVfFGO1NbKi6rzdJw,3776
20
- odoo_addon_product_pricelist_margin-16.0.1.0.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
21
- odoo_addon_product_pricelist_margin-16.0.1.0.0.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
22
- odoo_addon_product_pricelist_margin-16.0.1.0.0.1.dist-info/RECORD,,
20
+ odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info/METADATA,sha256=q9Cm4FJGtI1qPl3OIy4Tvro-JpGtnxFaHvq8nUmvsbg,4095
21
+ odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
22
+ odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
23
+ odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info/RECORD,,