odoo-addon-product-pricelist-margin 16.0.1.0.0.3__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.
- odoo/addons/product_pricelist_margin/README.rst +4 -1
- odoo/addons/product_pricelist_margin/__manifest__.py +1 -1
- odoo/addons/product_pricelist_margin/models/product_pricelist_item.py +13 -8
- odoo/addons/product_pricelist_margin/readme/CONTRIBUTORS.rst +1 -0
- odoo/addons/product_pricelist_margin/readme/DESCRIPTION.rst +2 -0
- odoo/addons/product_pricelist_margin/static/description/index.html +5 -3
- odoo/addons/product_pricelist_margin/tests/test_margin.py +13 -2
- {odoo_addon_product_pricelist_margin-16.0.1.0.0.3.dist-info → odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info}/METADATA +5 -2
- {odoo_addon_product_pricelist_margin-16.0.1.0.0.3.dist-info → odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info}/RECORD +11 -11
- {odoo_addon_product_pricelist_margin-16.0.1.0.0.3.dist-info → odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info}/WHEEL +0 -0
- {odoo_addon_product_pricelist_margin-16.0.1.0.0.3.dist-info → odoo_addon_product_pricelist_margin-16.0.1.0.1.dist-info}/top_level.txt +0 -0
|
@@ -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:
|
|
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.
|
|
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)",
|
|
@@ -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
|
|
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
|
-
|
|
46
|
-
item.product_tmpl_id,
|
|
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,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:
|
|
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&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
|
|
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 <<a class="reference external" href="mailto:chien@trobz.com">chien@trobz.com</a>></li>
|
|
418
|
+
<li>Telmo Santos <<a class="reference external" href="mailto:telmo.santos@camptocamp.com">telmo.santos@camptocamp.com</a>></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
|
|
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,
|
|
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.
|
|
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:
|
|
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,23 +1,23 @@
|
|
|
1
|
-
odoo/addons/product_pricelist_margin/README.rst,sha256=
|
|
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=
|
|
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
5
|
odoo/addons/product_pricelist_margin/i18n/it.po,sha256=lTPFm7mzokdhWkjvk6ppiwvKLvyGvj1JpVIX-vnNwlU,2117
|
|
6
6
|
odoo/addons/product_pricelist_margin/i18n/product_pricelist_margin.pot,sha256=DzN3dyKPk91lOR4KZ1inU3xEA_0r5Mt2NRvqmve-KMo,1507
|
|
7
7
|
odoo/addons/product_pricelist_margin/i18n/product_pricelist_margins.pot,sha256=QxKxHYMfnmBCm-hgu9q0w-VZ1GL95TPJYI697El79BI,1598
|
|
8
8
|
odoo/addons/product_pricelist_margin/models/__init__.py,sha256=5O-ZCP4vtIwGNcyevX6dEHWtAgA-rVUcHEiBf70zr4o,37
|
|
9
|
-
odoo/addons/product_pricelist_margin/models/product_pricelist_item.py,sha256=
|
|
10
|
-
odoo/addons/product_pricelist_margin/readme/CONTRIBUTORS.rst,sha256=
|
|
11
|
-
odoo/addons/product_pricelist_margin/readme/DESCRIPTION.rst,sha256=
|
|
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
|
|
12
12
|
odoo/addons/product_pricelist_margin/readme/USAGE.rst,sha256=4bnXuUc-k5UL0X22YiBwpNooPMjqgcu2ZA3BBVJfN5E,172
|
|
13
13
|
odoo/addons/product_pricelist_margin/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
14
|
-
odoo/addons/product_pricelist_margin/static/description/index.html,sha256=
|
|
14
|
+
odoo/addons/product_pricelist_margin/static/description/index.html,sha256=zuz2EDiwb1TWhqgVH6aYINNZMjk01Pf5aGR1hEJrdb8,13316
|
|
15
15
|
odoo/addons/product_pricelist_margin/static/description/pricelist_item.png,sha256=HRwmmahzytnJiRoDziaVM_c6HKmXKxXpRlC_gYaoJ1M,50455
|
|
16
16
|
odoo/addons/product_pricelist_margin/tests/__init__.py,sha256=UKD8x1fiapNCuRoRZroT8v_O7QHI1P4GHKEjteEq41E,26
|
|
17
|
-
odoo/addons/product_pricelist_margin/tests/test_margin.py,sha256=
|
|
17
|
+
odoo/addons/product_pricelist_margin/tests/test_margin.py,sha256=Vx1Ypqh_ddNzXijJZpHMQNBfIc0MnNH52ZR4EKv_q08,1929
|
|
18
18
|
odoo/addons/product_pricelist_margin/views/product_pricelist_item_views.xml,sha256=XwqCnck9dfZGt50odzC_DaAkrCZObYtSmg0xKtvv2zE,1929
|
|
19
19
|
odoo/addons/product_pricelist_margin/views/product_pricelist_views.xml,sha256=g74Tkw7zVoa6CNJEpgLLkDaLHiFArB7kdJnfjX4GAXg,1650
|
|
20
|
-
odoo_addon_product_pricelist_margin-16.0.1.0.
|
|
21
|
-
odoo_addon_product_pricelist_margin-16.0.1.0.
|
|
22
|
-
odoo_addon_product_pricelist_margin-16.0.1.0.
|
|
23
|
-
odoo_addon_product_pricelist_margin-16.0.1.0.
|
|
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,,
|
|
File without changes
|