From 3174e5fddb4b99adddc630a3bdea00d006adff06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?=
Date: Thu, 12 Jul 2012 15:51:36 +0200
Subject: [PATCH 01/83] [MRG] From last customers devs, tests and bugfix. Most
improvements are on: - Margin modules - picking dispatch (better
warehouse handling)) - grouping PO - Filter on stock delivers
from sales (lp:c2c-addons/6.1 rev 28.3.22)
---
product_standard_margin/__init__.py | 22 ++++
product_standard_margin/__openerp__.py | 58 ++++++++++
product_standard_margin/product_std_margin.py | 106 ++++++++++++++++++
.../product_std_margin_view.xml | 21 ++++
4 files changed, 207 insertions(+)
create mode 100644 product_standard_margin/__init__.py
create mode 100644 product_standard_margin/__openerp__.py
create mode 100644 product_standard_margin/product_std_margin.py
create mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
new file mode 100644
index 000000000..4a754ba5d
--- /dev/null
+++ b/product_standard_margin/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from . import product_std_margin
+
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
new file mode 100644
index 000000000..d42d8ed97
--- /dev/null
+++ b/product_standard_margin/__openerp__.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+{'name' : 'Markup rate on product and sales',
+ 'version' : '1.0',
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Sales Management',
+ 'complexity': "normal", # easy, normal, expert
+ 'depends' : ['product_get_cost_field', 'account'],
+ 'description': """
+ Add a field on the product form that compute the standard (or theorical) margin based on the
+ current values of sale and cost price present in the product form. We take care of taxe included
+ or excluded.
+
+ It will just compute it as follow : (Sale Price without tax - Cost Price) / Sale Price without tax
+
+ Remember that this module can be used in conjonction with product_cost_incl_bom to have the
+ cost price computed from the BOM when a product has one.
+
+ WARNING:
+
+ 1) As this module will base his simple computation on sale and cost prices, it suppose
+ you have them both in the same currency (the price type must of the same currency for both of
+ them). Remember this is the default OpenERP configuration (price type of all product price
+ fields are set as the same as the company currency). We don't take care of it cause otherwise
+ we should have added a dependency on sale module.
+
+
+ """,
+ 'website': 'http://www.camptocamp.com/',
+ 'init_xml': [],
+ 'update_xml': ['product_std_margin_view.xml'],
+ 'demo_xml': [],
+ 'tests': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True}
+
+
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
new file mode 100644
index 000000000..43759d1fa
--- /dev/null
+++ b/product_standard_margin/product_std_margin.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
+# All Right Reserved
+#
+# Author : Joel Grand-Guillaume
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields
+from osv.orm import Model
+import decimal_precision as dp
+import logging
+
+class Product(Model):
+ _inherit = 'product.product'
+
+ #TODO : compute the margin with default taxes
+ def _amount_tax_excluded(self, cr, uid, ids, context=None):
+ """
+ Compute the list price total without tax (in case you are in tax included).
+ This will use the default taxes defined on the product.
+ :return dict of values:
+ {INT Product ID:
+ float price without tax
+ }
+ """
+ res = {}
+ if context is None:
+ context = {}
+ tax_obj = self.pool.get('account.tax')
+ cur_obj = self.pool.get('res.currency')
+ for prod in self.browse(cr, uid, ids):
+ price = prod.list_price
+ taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
+ res[prod.id] = taxes['total']
+ return res
+
+ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
+ """
+ Calculate the margin based on product infos. Take care of the cost_field
+ define in product_get_cost_field. So the margin will be computed based on this
+ field.
+
+ We don't take care of the product price type currency to remove the dependency on
+ the sale module. We consider the cost and sale price is in the company currency.
+
+ We take care of the default product taxes, and base our computation on total without
+ tax.
+
+ :return dict of dict of the form :
+ {INT Product ID : {
+ {'margin_absolute': float,
+ 'margin_relative': float}
+ }}
+ """
+ logger = logging.getLogger('product_standard_margin')
+ if context is None:
+ context = {}
+ res = {}
+ if not ids:
+ return res
+ for product in ids:
+ res[product] = {'margin_absolute': 0, 'margin_relative': 0}
+ for product in self.browse(cursor, user, ids):
+ cost = product.cost_price
+ sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
+ # sale = product.list_price
+ res[product.id]['standard_margin'] = sale - cost
+ if sale == 0:
+ logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
+ res[product.id]['standard_margin_rate'] = 999.
+ else:
+ res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
+ return res
+
+ _columns = {
+ 'standard_margin' : fields.function(_compute_margin,
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi ='margin',
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
+ 'standard_margin_rate' : fields.function(_compute_margin,
+ method=True,
+ string='Theorical Margin (%)',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
+ }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
new file mode 100644
index 000000000..4ee497e4d
--- /dev/null
+++ b/product_standard_margin/product_std_margin_view.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ product.markup.view.form
+ form
+ product.product
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 17a264c6dbeb7cc6b5b7db9e8f736a1ecae5973d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?=
Date: Fri, 29 Jun 2012 09:27:40 +0200
Subject: [PATCH 02/83] To ease merging the work with Alex, I already commit
part of work: [DOC] Some typo and docstring [IMP] Warning
message if no move available for dispatch creation [IMP] Start
adding relation between picking and dispatch (lp:c2c-addons/6.1 rev 28.6.4)
---
product_standard_margin/__init__.py | 22 ----
product_standard_margin/__openerp__.py | 58 ----------
product_standard_margin/product_std_margin.py | 106 ------------------
.../product_std_margin_view.xml | 21 ----
4 files changed, 207 deletions(-)
delete mode 100644 product_standard_margin/__init__.py
delete mode 100644 product_standard_margin/__openerp__.py
delete mode 100644 product_standard_margin/product_std_margin.py
delete mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
deleted file mode 100644
index 4a754ba5d..000000000
--- a/product_standard_margin/__init__.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-from . import product_std_margin
-
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
deleted file mode 100644
index d42d8ed97..000000000
--- a/product_standard_margin/__openerp__.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-{'name' : 'Markup rate on product and sales',
- 'version' : '1.0',
- 'author' : 'Camptocamp',
- 'maintainer': 'Camptocamp',
- 'category': 'Sales Management',
- 'complexity': "normal", # easy, normal, expert
- 'depends' : ['product_get_cost_field', 'account'],
- 'description': """
- Add a field on the product form that compute the standard (or theorical) margin based on the
- current values of sale and cost price present in the product form. We take care of taxe included
- or excluded.
-
- It will just compute it as follow : (Sale Price without tax - Cost Price) / Sale Price without tax
-
- Remember that this module can be used in conjonction with product_cost_incl_bom to have the
- cost price computed from the BOM when a product has one.
-
- WARNING:
-
- 1) As this module will base his simple computation on sale and cost prices, it suppose
- you have them both in the same currency (the price type must of the same currency for both of
- them). Remember this is the default OpenERP configuration (price type of all product price
- fields are set as the same as the company currency). We don't take care of it cause otherwise
- we should have added a dependency on sale module.
-
-
- """,
- 'website': 'http://www.camptocamp.com/',
- 'init_xml': [],
- 'update_xml': ['product_std_margin_view.xml'],
- 'demo_xml': [],
- 'tests': [],
- 'installable': True,
- 'auto_install': False,
- 'license': 'AGPL-3',
- 'application': True}
-
-
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
deleted file mode 100644
index 43759d1fa..000000000
--- a/product_standard_margin/product_std_margin.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
-# All Right Reserved
-#
-# Author : Joel Grand-Guillaume
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields
-from osv.orm import Model
-import decimal_precision as dp
-import logging
-
-class Product(Model):
- _inherit = 'product.product'
-
- #TODO : compute the margin with default taxes
- def _amount_tax_excluded(self, cr, uid, ids, context=None):
- """
- Compute the list price total without tax (in case you are in tax included).
- This will use the default taxes defined on the product.
- :return dict of values:
- {INT Product ID:
- float price without tax
- }
- """
- res = {}
- if context is None:
- context = {}
- tax_obj = self.pool.get('account.tax')
- cur_obj = self.pool.get('res.currency')
- for prod in self.browse(cr, uid, ids):
- price = prod.list_price
- taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
- res[prod.id] = taxes['total']
- return res
-
- def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
- """
- Calculate the margin based on product infos. Take care of the cost_field
- define in product_get_cost_field. So the margin will be computed based on this
- field.
-
- We don't take care of the product price type currency to remove the dependency on
- the sale module. We consider the cost and sale price is in the company currency.
-
- We take care of the default product taxes, and base our computation on total without
- tax.
-
- :return dict of dict of the form :
- {INT Product ID : {
- {'margin_absolute': float,
- 'margin_relative': float}
- }}
- """
- logger = logging.getLogger('product_standard_margin')
- if context is None:
- context = {}
- res = {}
- if not ids:
- return res
- for product in ids:
- res[product] = {'margin_absolute': 0, 'margin_relative': 0}
- for product in self.browse(cursor, user, ids):
- cost = product.cost_price
- sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
- # sale = product.list_price
- res[product.id]['standard_margin'] = sale - cost
- if sale == 0:
- logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
- res[product.id]['standard_margin_rate'] = 999.
- else:
- res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
- return res
-
- _columns = {
- 'standard_margin' : fields.function(_compute_margin,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi ='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
- 'standard_margin_rate' : fields.function(_compute_margin,
- method=True,
- string='Theorical Margin (%)',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
- }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
deleted file mode 100644
index 4ee497e4d..000000000
--- a/product_standard_margin/product_std_margin_view.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
- product.markup.view.form
- form
- product.product
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From a7cd6b3bd2aa952fcd751834cb8e7e3c10a6ebb7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?=
Date: Wed, 11 Jul 2012 17:13:42 +0200
Subject: [PATCH 03/83] [IMP] Rebuild the margin modules. This is the first
working version that still need strong testing (lp:c2c-addons/6.1 rev
28.6.24)
---
product_standard_margin/__init__.py | 22 +++++
product_standard_margin/__openerp__.py | 58 +++++++++++++
product_standard_margin/product_std_margin.py | 84 +++++++++++++++++++
.../product_std_margin_view.xml | 21 +++++
4 files changed, 185 insertions(+)
create mode 100644 product_standard_margin/__init__.py
create mode 100644 product_standard_margin/__openerp__.py
create mode 100644 product_standard_margin/product_std_margin.py
create mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
new file mode 100644
index 000000000..4a754ba5d
--- /dev/null
+++ b/product_standard_margin/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from . import product_std_margin
+
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
new file mode 100644
index 000000000..6640d0692
--- /dev/null
+++ b/product_standard_margin/__openerp__.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+{'name' : 'Markup rate on product and sales',
+ 'version' : '1.0',
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Sales Management',
+ 'complexity': "normal", # easy, normal, expert
+ 'depends' : ['product_get_cost_field',],
+ 'description': """
+ Add a field on the product form that compute the standard (or theorical) margin based on the
+ current values of sale and cost price present in the product form.
+
+ It will just compute it as follow : (Sale Price - Cost Price) / Sale Price
+
+ Remember that this module can be used in conjonction with product_cost_incl_bom to have the
+ cost price computed from the BOM when a product has one.
+
+ WARNING:
+
+ 1) As this module will base his simple computation on sale and cost prices, it suppose
+ you have them both in the same currency (the price type must of the same currency for both of
+ them). Remember this is the default OpenERP configuration (price type of all product price
+ fields are set as the same as the company currency). We don't take care of it cause otherwise
+ we should have added a dependency on sale module.
+
+ 2) For now we consider always the prices values are VAT excluded
+
+ """,
+ 'website': 'http://www.camptocamp.com/',
+ 'init_xml': [],
+ 'update_xml': ['product_std_margin_view.xml'],
+ 'demo_xml': [],
+ 'tests': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True}
+
+
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
new file mode 100644
index 000000000..b2ac8c43c
--- /dev/null
+++ b/product_standard_margin/product_std_margin.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
+# All Right Reserved
+#
+# Author : Joel Grand-Guillaume
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields
+from osv.orm import Model
+import decimal_precision as dp
+import logging
+
+class Product(Model):
+ _inherit = 'product.product'
+
+ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
+ """
+ Calculate the margin based on product infos. Take care of the cost_field
+ define in product_get_cost_field. So the margin will be computed based on this
+ field.
+
+ We don't take care of the product price type currency to remove the dependency on
+ the sale module. We consider the cost and sale price is in the company currency.
+
+ We don't take care of the taxes, and base our computation on the hypothesis that
+ all prices are VAT excluded.
+
+ :return dict of dict of the form :
+ {INT Product ID : {
+ {'margin_absolute': float,
+ 'margin_relative': float}
+ }}
+ """
+ logger = logging.getLogger('product_standard_margin')
+ if context is None:
+ context = {}
+ res = {}
+ if not ids:
+ return res
+ for product in ids:
+ res[product] = {'margin_absolute': 0, 'margin_relative': 0}
+ for product in self.browse(cursor, user, ids):
+ cost = product.cost_price
+ sale = product.list_price
+ res[product.id]['standard_margin'] = sale - cost
+ if sale == 0:
+ logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
+ res[product.id]['standard_margin_rate'] = 999.
+ else:
+ res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
+ return res
+
+ _columns = {
+ 'standard_margin' : fields.function(_compute_margin,
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi ='margin',
+ help='Theorical Margin is [ sale price - cost price ] of the product form (not based on historical values).'
+ 'Prices should be VAT excluded. If no sale price, the margin will be negativ.'),
+ 'standard_margin_rate' : fields.function(_compute_margin,
+ method=True,
+ string='Theorical Margin (%)',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Markup rate is [ Theorical Margin / sale price ] of the product form (not based on historical values).'
+ 'Prices should be VAT excluded. If no sale price set, will display 999.0'),
+ }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
new file mode 100644
index 000000000..4ee497e4d
--- /dev/null
+++ b/product_standard_margin/product_std_margin_view.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ product.markup.view.form
+ form
+ product.product
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 92a460debab302f81adfeb127948c154ec32c18e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?=
Date: Thu, 12 Jul 2012 09:45:48 +0200
Subject: [PATCH 04/83] [ADD] product_historical_margin_report that override
the invoice line analysis to add margin [IMP] Add tax
include/exlude support on margin computation [FIX] Little Typo and
fixes after tests (lp:c2c-addons/6.1 rev 28.6.25)
---
product_standard_margin/__openerp__.py | 8 ++---
product_standard_margin/product_std_margin.py | 36 +++++++++++++++----
2 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index 6640d0692..d42d8ed97 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -24,12 +24,13 @@
'maintainer': 'Camptocamp',
'category': 'Sales Management',
'complexity': "normal", # easy, normal, expert
- 'depends' : ['product_get_cost_field',],
+ 'depends' : ['product_get_cost_field', 'account'],
'description': """
Add a field on the product form that compute the standard (or theorical) margin based on the
- current values of sale and cost price present in the product form.
+ current values of sale and cost price present in the product form. We take care of taxe included
+ or excluded.
- It will just compute it as follow : (Sale Price - Cost Price) / Sale Price
+ It will just compute it as follow : (Sale Price without tax - Cost Price) / Sale Price without tax
Remember that this module can be used in conjonction with product_cost_incl_bom to have the
cost price computed from the BOM when a product has one.
@@ -42,7 +43,6 @@
fields are set as the same as the company currency). We don't take care of it cause otherwise
we should have added a dependency on sale module.
- 2) For now we consider always the prices values are VAT excluded
""",
'website': 'http://www.camptocamp.com/',
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index b2ac8c43c..43759d1fa 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -29,6 +29,27 @@
class Product(Model):
_inherit = 'product.product'
+ #TODO : compute the margin with default taxes
+ def _amount_tax_excluded(self, cr, uid, ids, context=None):
+ """
+ Compute the list price total without tax (in case you are in tax included).
+ This will use the default taxes defined on the product.
+ :return dict of values:
+ {INT Product ID:
+ float price without tax
+ }
+ """
+ res = {}
+ if context is None:
+ context = {}
+ tax_obj = self.pool.get('account.tax')
+ cur_obj = self.pool.get('res.currency')
+ for prod in self.browse(cr, uid, ids):
+ price = prod.list_price
+ taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
+ res[prod.id] = taxes['total']
+ return res
+
def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
"""
Calculate the margin based on product infos. Take care of the cost_field
@@ -38,8 +59,8 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
We don't take care of the product price type currency to remove the dependency on
the sale module. We consider the cost and sale price is in the company currency.
- We don't take care of the taxes, and base our computation on the hypothesis that
- all prices are VAT excluded.
+ We take care of the default product taxes, and base our computation on total without
+ tax.
:return dict of dict of the form :
{INT Product ID : {
@@ -57,7 +78,8 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
res[product] = {'margin_absolute': 0, 'margin_relative': 0}
for product in self.browse(cursor, user, ids):
cost = product.cost_price
- sale = product.list_price
+ sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
+ # sale = product.list_price
res[product.id]['standard_margin'] = sale - cost
if sale == 0:
logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
@@ -72,13 +94,13 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
string='Theorical Margin',
digits_compute=dp.get_precision('Sale Price'),
multi ='margin',
- help='Theorical Margin is [ sale price - cost price ] of the product form (not based on historical values).'
- 'Prices should be VAT excluded. If no sale price, the margin will be negativ.'),
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
'standard_margin_rate' : fields.function(_compute_margin,
method=True,
string='Theorical Margin (%)',
digits_compute=dp.get_precision('Sale Price'),
multi='margin',
- help='Markup rate is [ Theorical Margin / sale price ] of the product form (not based on historical values).'
- 'Prices should be VAT excluded. If no sale price set, will display 999.0'),
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
}
From 260cf17ea56e998c48587e6fff2f4b1abdc77ce6 Mon Sep 17 00:00:00 2001
From: "@" <@>
Date: Tue, 15 May 2012 14:42:21 +0200
Subject: [PATCH 05/83] [IMP] product_cost_incl_bom, product_get_cost_field,
sale_markup: extracted code to new modules
extracted the bits about the computation of product cost with BoM from sale_markup to product_cost_incl_bom
(lp:c2c-addons/6.1 rev 40.1.13)
---
product_standard_margin/__init__.py | 22 ----
product_standard_margin/__openerp__.py | 58 ----------
product_standard_margin/product_std_margin.py | 106 ------------------
.../product_std_margin_view.xml | 21 ----
4 files changed, 207 deletions(-)
delete mode 100644 product_standard_margin/__init__.py
delete mode 100644 product_standard_margin/__openerp__.py
delete mode 100644 product_standard_margin/product_std_margin.py
delete mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
deleted file mode 100644
index 4a754ba5d..000000000
--- a/product_standard_margin/__init__.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-from . import product_std_margin
-
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
deleted file mode 100644
index d42d8ed97..000000000
--- a/product_standard_margin/__openerp__.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-{'name' : 'Markup rate on product and sales',
- 'version' : '1.0',
- 'author' : 'Camptocamp',
- 'maintainer': 'Camptocamp',
- 'category': 'Sales Management',
- 'complexity': "normal", # easy, normal, expert
- 'depends' : ['product_get_cost_field', 'account'],
- 'description': """
- Add a field on the product form that compute the standard (or theorical) margin based on the
- current values of sale and cost price present in the product form. We take care of taxe included
- or excluded.
-
- It will just compute it as follow : (Sale Price without tax - Cost Price) / Sale Price without tax
-
- Remember that this module can be used in conjonction with product_cost_incl_bom to have the
- cost price computed from the BOM when a product has one.
-
- WARNING:
-
- 1) As this module will base his simple computation on sale and cost prices, it suppose
- you have them both in the same currency (the price type must of the same currency for both of
- them). Remember this is the default OpenERP configuration (price type of all product price
- fields are set as the same as the company currency). We don't take care of it cause otherwise
- we should have added a dependency on sale module.
-
-
- """,
- 'website': 'http://www.camptocamp.com/',
- 'init_xml': [],
- 'update_xml': ['product_std_margin_view.xml'],
- 'demo_xml': [],
- 'tests': [],
- 'installable': True,
- 'auto_install': False,
- 'license': 'AGPL-3',
- 'application': True}
-
-
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
deleted file mode 100644
index 43759d1fa..000000000
--- a/product_standard_margin/product_std_margin.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
-# All Right Reserved
-#
-# Author : Joel Grand-Guillaume
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields
-from osv.orm import Model
-import decimal_precision as dp
-import logging
-
-class Product(Model):
- _inherit = 'product.product'
-
- #TODO : compute the margin with default taxes
- def _amount_tax_excluded(self, cr, uid, ids, context=None):
- """
- Compute the list price total without tax (in case you are in tax included).
- This will use the default taxes defined on the product.
- :return dict of values:
- {INT Product ID:
- float price without tax
- }
- """
- res = {}
- if context is None:
- context = {}
- tax_obj = self.pool.get('account.tax')
- cur_obj = self.pool.get('res.currency')
- for prod in self.browse(cr, uid, ids):
- price = prod.list_price
- taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
- res[prod.id] = taxes['total']
- return res
-
- def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
- """
- Calculate the margin based on product infos. Take care of the cost_field
- define in product_get_cost_field. So the margin will be computed based on this
- field.
-
- We don't take care of the product price type currency to remove the dependency on
- the sale module. We consider the cost and sale price is in the company currency.
-
- We take care of the default product taxes, and base our computation on total without
- tax.
-
- :return dict of dict of the form :
- {INT Product ID : {
- {'margin_absolute': float,
- 'margin_relative': float}
- }}
- """
- logger = logging.getLogger('product_standard_margin')
- if context is None:
- context = {}
- res = {}
- if not ids:
- return res
- for product in ids:
- res[product] = {'margin_absolute': 0, 'margin_relative': 0}
- for product in self.browse(cursor, user, ids):
- cost = product.cost_price
- sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
- # sale = product.list_price
- res[product.id]['standard_margin'] = sale - cost
- if sale == 0:
- logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
- res[product.id]['standard_margin_rate'] = 999.
- else:
- res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
- return res
-
- _columns = {
- 'standard_margin' : fields.function(_compute_margin,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi ='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
- 'standard_margin_rate' : fields.function(_compute_margin,
- method=True,
- string='Theorical Margin (%)',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
- }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
deleted file mode 100644
index 4ee497e4d..000000000
--- a/product_standard_margin/product_std_margin_view.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
- product.markup.view.form
- form
- product.product
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 922eb451c26d7eb76dcda8ed67b5951d73609a38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?=
Date: Thu, 12 Jul 2012 15:56:17 +0200
Subject: [PATCH 06/83] [MRG] From trunk branch, tests and bugfix. Most
improvements are on: - Margin modules - picking dispatch (better
warehouse handling)) - grouping PO - Filter on stock delivers from sales
(lp:c2c-addons/6.1 rev 69)
---
product_standard_margin/__init__.py | 22 ++++
product_standard_margin/__openerp__.py | 58 ++++++++++
product_standard_margin/product_std_margin.py | 106 ++++++++++++++++++
.../product_std_margin_view.xml | 21 ++++
4 files changed, 207 insertions(+)
create mode 100644 product_standard_margin/__init__.py
create mode 100644 product_standard_margin/__openerp__.py
create mode 100644 product_standard_margin/product_std_margin.py
create mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
new file mode 100644
index 000000000..4a754ba5d
--- /dev/null
+++ b/product_standard_margin/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from . import product_std_margin
+
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
new file mode 100644
index 000000000..d42d8ed97
--- /dev/null
+++ b/product_standard_margin/__openerp__.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+{'name' : 'Markup rate on product and sales',
+ 'version' : '1.0',
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Sales Management',
+ 'complexity': "normal", # easy, normal, expert
+ 'depends' : ['product_get_cost_field', 'account'],
+ 'description': """
+ Add a field on the product form that compute the standard (or theorical) margin based on the
+ current values of sale and cost price present in the product form. We take care of taxe included
+ or excluded.
+
+ It will just compute it as follow : (Sale Price without tax - Cost Price) / Sale Price without tax
+
+ Remember that this module can be used in conjonction with product_cost_incl_bom to have the
+ cost price computed from the BOM when a product has one.
+
+ WARNING:
+
+ 1) As this module will base his simple computation on sale and cost prices, it suppose
+ you have them both in the same currency (the price type must of the same currency for both of
+ them). Remember this is the default OpenERP configuration (price type of all product price
+ fields are set as the same as the company currency). We don't take care of it cause otherwise
+ we should have added a dependency on sale module.
+
+
+ """,
+ 'website': 'http://www.camptocamp.com/',
+ 'init_xml': [],
+ 'update_xml': ['product_std_margin_view.xml'],
+ 'demo_xml': [],
+ 'tests': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True}
+
+
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
new file mode 100644
index 000000000..43759d1fa
--- /dev/null
+++ b/product_standard_margin/product_std_margin.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
+# All Right Reserved
+#
+# Author : Joel Grand-Guillaume
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields
+from osv.orm import Model
+import decimal_precision as dp
+import logging
+
+class Product(Model):
+ _inherit = 'product.product'
+
+ #TODO : compute the margin with default taxes
+ def _amount_tax_excluded(self, cr, uid, ids, context=None):
+ """
+ Compute the list price total without tax (in case you are in tax included).
+ This will use the default taxes defined on the product.
+ :return dict of values:
+ {INT Product ID:
+ float price without tax
+ }
+ """
+ res = {}
+ if context is None:
+ context = {}
+ tax_obj = self.pool.get('account.tax')
+ cur_obj = self.pool.get('res.currency')
+ for prod in self.browse(cr, uid, ids):
+ price = prod.list_price
+ taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
+ res[prod.id] = taxes['total']
+ return res
+
+ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
+ """
+ Calculate the margin based on product infos. Take care of the cost_field
+ define in product_get_cost_field. So the margin will be computed based on this
+ field.
+
+ We don't take care of the product price type currency to remove the dependency on
+ the sale module. We consider the cost and sale price is in the company currency.
+
+ We take care of the default product taxes, and base our computation on total without
+ tax.
+
+ :return dict of dict of the form :
+ {INT Product ID : {
+ {'margin_absolute': float,
+ 'margin_relative': float}
+ }}
+ """
+ logger = logging.getLogger('product_standard_margin')
+ if context is None:
+ context = {}
+ res = {}
+ if not ids:
+ return res
+ for product in ids:
+ res[product] = {'margin_absolute': 0, 'margin_relative': 0}
+ for product in self.browse(cursor, user, ids):
+ cost = product.cost_price
+ sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
+ # sale = product.list_price
+ res[product.id]['standard_margin'] = sale - cost
+ if sale == 0:
+ logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
+ res[product.id]['standard_margin_rate'] = 999.
+ else:
+ res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
+ return res
+
+ _columns = {
+ 'standard_margin' : fields.function(_compute_margin,
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi ='margin',
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
+ 'standard_margin_rate' : fields.function(_compute_margin,
+ method=True,
+ string='Theorical Margin (%)',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
+ }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
new file mode 100644
index 000000000..4ee497e4d
--- /dev/null
+++ b/product_standard_margin/product_std_margin_view.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ product.markup.view.form
+ form
+ product.product
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 6a3002d3cca94b0f17efdba66aecf8a4f17d1c72 Mon Sep 17 00:00:00 2001
From: unknown
Date: Thu, 13 Dec 2012 13:39:06 +0100
Subject: [PATCH 07/83] [ADD] translation FR on product_standard_margin and
product_historical_margin
---
product_standard_margin/i18n/fr.po | 52 ++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 product_standard_margin/i18n/fr.po
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
new file mode 100644
index 000000000..b1c3d392b
--- /dev/null
+++ b/product_standard_margin/i18n/fr.po
@@ -0,0 +1,52 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-07 14:35+0000\n"
+"PO-Revision-Date: 2012-11-07 14:35+0000\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: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr "Produit"
+
+#. module: product_standard_margin
+#: field:product.product,standard_margin_rate:0
+msgid "Theorical Margin (%)"
+msgstr "Marge Theorique (%)"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr "Taux de marge théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du formulaire Produit] (ne tient pas compte de la facturation effective). Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le taux sera de 999.0"
+
+#. module: product_standard_margin
+#: constraint:product.product:0
+msgid "Error: Invalid ean code"
+msgstr "Erreur : Code EAN invalide"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin:0
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr "Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient pas compte de la facturation effective).Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, la marge sera negative."
+
+#. module: product_standard_margin
+#: view:product.product:0
+msgid "Margin"
+msgstr "Marge"
+
+#. module: product_standard_margin
+#: field:product.product,standard_margin:0
+msgid "Theorical Margin"
+msgstr "Marge Théorique"
+
From f4cf60b0ebd599208164df28dbf5e5af80e05a20 Mon Sep 17 00:00:00 2001
From: "@" <@>
Date: Thu, 13 Dec 2012 15:19:45 +0100
Subject: [PATCH 08/83] [FIX] typos
---
product_standard_margin/i18n/fr.po | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index b1c3d392b..1c99776a8 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -23,7 +23,7 @@ msgstr "Produit"
#. module: product_standard_margin
#: field:product.product,standard_margin_rate:0
msgid "Theorical Margin (%)"
-msgstr "Marge Theorique (%)"
+msgstr "Marge Théorique (%)"
#. module: product_standard_margin
#: help:product.product,standard_margin_rate:0
@@ -38,7 +38,7 @@ msgstr "Erreur : Code EAN invalide"
#. module: product_standard_margin
#: help:product.product,standard_margin:0
msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).Take care of tax include and exclude. If no sale price, the margin will be negativ."
-msgstr "Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient pas compte de la facturation effective).Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, la marge sera negative."
+msgstr "Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient pas compte de la facturation effective). Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
#. module: product_standard_margin
#: view:product.product:0
From 99b6f8ddfc2cdfc0a9e584dbe3081849feab3f60 Mon Sep 17 00:00:00 2001
From: Endian Solutions
Date: Sun, 23 Dec 2012 13:12:06 +0100
Subject: [PATCH 09/83] Added Dutch translations to all modules.
---
product_standard_margin/i18n/nl.po | 67 ++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 product_standard_margin/i18n/nl.po
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
new file mode 100644
index 000000000..2df248f7a
--- /dev/null
+++ b/product_standard_margin/i18n/nl.po
@@ -0,0 +1,67 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-12-23 12:04+0000\n"
+"PO-Revision-Date: 2012-12-23 13:09+0100\n"
+"Last-Translator: Erwin van der Ploeg | Endian Solutions "
+"\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr "Product"
+
+#. module: product_standard_margin
+#: field:product.product,standard_margin_rate:0
+msgid "Theorical Margin (%)"
+msgstr "Theoretische marge (%)"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Theoretische marge (%) is [ Theoretische marge / Verkoopprijs (excl. BTW) ] "
+"van het product (niet gebaseerd op historische waardes). Het veld houdt "
+"rekening met prijzen incl. en excl. BTW. Indien geen verkooprijs is "
+"ingevoerd, wordt 999,0 weergegeven."
+
+#. module: product_standard_margin
+#: constraint:product.product:0
+msgid "Error: Invalid ean code"
+msgstr "Fout: ongeldige ean code"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin:0
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values).Take care of tax include and exclude. If no "
+"sale price, the margin will be negativ."
+msgstr ""
+"Theoretische marge is [ Verkoopprijs (excl. BTW) - Kostprijs) ] van het "
+"product (niet gebaseerd op historische waardes). Het veld houdt rekening met "
+"prijzen incl. en excl. BTW. Indien geen verkooprijs is ingevoerd, zal de "
+"marge negatief zijn."
+
+#. module: product_standard_margin
+#: view:product.product:0
+msgid "Margin"
+msgstr "Marge"
+
+#. module: product_standard_margin
+#: field:product.product,standard_margin:0
+msgid "Theorical Margin"
+msgstr "Theorische marge"
From 8fb57189e3410264031c1fd22b69e3ef592ea024 Mon Sep 17 00:00:00 2001
From: Endian Solutions
Date: Sun, 23 Dec 2012 13:48:18 +0100
Subject: [PATCH 10/83] small fix in translation
---
product_standard_margin/i18n/nl.po | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
index 2df248f7a..554bdeb5a 100644
--- a/product_standard_margin/i18n/nl.po
+++ b/product_standard_margin/i18n/nl.po
@@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-23 12:04+0000\n"
-"PO-Revision-Date: 2012-12-23 13:09+0100\n"
+"PO-Revision-Date: 2012-12-23 13:35+0100\n"
"Last-Translator: Erwin van der Ploeg | Endian Solutions "
"\n"
"Language-Team: \n"
@@ -64,4 +64,4 @@ msgstr "Marge"
#. module: product_standard_margin
#: field:product.product,standard_margin:0
msgid "Theorical Margin"
-msgstr "Theorische marge"
+msgstr "Theoretische marge"
From cd2f080d3a570c8100f59bc2f2796e345c271300 Mon Sep 17 00:00:00 2001
From: Joel Grand-Guillaume
Date: Wed, 11 Sep 2013 10:08:22 +0200
Subject: [PATCH 11/83] [MIGR] Mark all module as installable = False unless we
migrate them. This will happend in the next coming month.
---
product_standard_margin/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index d42d8ed97..5b1f4d407 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -50,7 +50,7 @@
'update_xml': ['product_std_margin_view.xml'],
'demo_xml': [],
'tests': [],
- 'installable': True,
+ 'installable': False,
'auto_install': False,
'license': 'AGPL-3',
'application': True}
From 5a95ec5de7dd9f8b31d8b55b2afdfac8efbccdb3 Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Thu, 10 Oct 2013 14:09:34 +0200
Subject: [PATCH 12/83] [MIG] portage of product_standard_margin
---
product_standard_margin/__openerp__.py | 26 ++++++------
product_standard_margin/product_std_margin.py | 41 ++++++++++---------
.../product_std_margin_view.xml | 11 +++--
3 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index 5b1f4d407..c4b4c8718 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -18,39 +18,39 @@
# along with this program. If not, see .
#
##############################################################################
-{'name' : 'Markup rate on product and sales',
- 'version' : '1.0',
- 'author' : 'Camptocamp',
+{'name': 'Markup rate on product and sales',
+ 'version': '1.0',
+ 'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'Sales Management',
'complexity': "normal", # easy, normal, expert
- 'depends' : ['product_get_cost_field', 'account'],
+ 'depends': ['product_get_cost_field', 'account'],
'description': """
Add a field on the product form that compute the standard (or theorical) margin based on the
current values of sale and cost price present in the product form. We take care of taxe included
or excluded.
-
- It will just compute it as follow : (Sale Price without tax - Cost Price) / Sale Price without tax
-
+
+ It will just compute it as follow: (Sale Price without tax - Cost Price) / Sale Price without tax
+
Remember that this module can be used in conjonction with product_cost_incl_bom to have the
cost price computed from the BOM when a product has one.
-
- WARNING:
-
+
+ WARNING:
+
1) As this module will base his simple computation on sale and cost prices, it suppose
you have them both in the same currency (the price type must of the same currency for both of
them). Remember this is the default OpenERP configuration (price type of all product price
fields are set as the same as the company currency). We don't take care of it cause otherwise
we should have added a dependency on sale module.
-
-
+
+
""",
'website': 'http://www.camptocamp.com/',
'init_xml': [],
'update_xml': ['product_std_margin_view.xml'],
'demo_xml': [],
'tests': [],
- 'installable': False,
+ 'installable': True,
'auto_install': False,
'license': 'AGPL-3',
'application': True}
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index 43759d1fa..27ff7211e 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -28,7 +28,7 @@
class Product(Model):
_inherit = 'product.product'
-
+
#TODO : compute the margin with default taxes
def _amount_tax_excluded(self, cr, uid, ids, context=None):
"""
@@ -49,19 +49,19 @@ def _amount_tax_excluded(self, cr, uid, ids, context=None):
taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
res[prod.id] = taxes['total']
return res
-
+
def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
"""
Calculate the margin based on product infos. Take care of the cost_field
define in product_get_cost_field. So the margin will be computed based on this
field.
-
+
We don't take care of the product price type currency to remove the dependency on
the sale module. We consider the cost and sale price is in the company currency.
-
+
We take care of the default product taxes, and base our computation on total without
tax.
-
+
:return dict of dict of the form :
{INT Product ID : {
{'margin_absolute': float,
@@ -79,7 +79,6 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
for product in self.browse(cursor, user, ids):
cost = product.cost_price
sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
- # sale = product.list_price
res[product.id]['standard_margin'] = sale - cost
if sale == 0:
logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
@@ -89,18 +88,20 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
return res
_columns = {
- 'standard_margin' : fields.function(_compute_margin,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi ='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
- 'standard_margin_rate' : fields.function(_compute_margin,
- method=True,
- string='Theorical Margin (%)',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
+ 'standard_margin': fields.function(
+ _compute_margin,
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi ='margin',
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
+ 'standard_margin_rate': fields.function(
+ _compute_margin,
+ method=True,
+ string='Theorical Margin (%)',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
}
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
index 4ee497e4d..5fbd14c29 100644
--- a/product_standard_margin/product_std_margin_view.xml
+++ b/product_standard_margin/product_std_margin_view.xml
@@ -7,13 +7,12 @@
product.product
-
-
-
-
-
-
+
+
+
+
+
From 2ed9d92dbbe811c93d8bee2b80216979bd74368d Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Mon, 14 Oct 2013 20:08:34 +0200
Subject: [PATCH 13/83] [FIX] imports
---
product_standard_margin/product_std_margin.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index 27ff7211e..7f39ed31d 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -21,12 +21,12 @@
#
##############################################################################
-from osv import fields
-from osv.orm import Model
+from openerp.osv import orm, fields
import decimal_precision as dp
import logging
-class Product(Model):
+
+class Product(orm.Model):
_inherit = 'product.product'
#TODO : compute the margin with default taxes
From 7fa8fc70651dfbb93dac5906c788b916e4f12187 Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Mon, 14 Oct 2013 20:16:46 +0200
Subject: [PATCH 14/83] [PEP8]
---
product_standard_margin/__openerp__.py | 9 ++---
product_standard_margin/product_std_margin.py | 40 ++++++++++---------
2 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index c4b4c8718..c901845f4 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -32,18 +32,17 @@
It will just compute it as follow: (Sale Price without tax - Cost Price) / Sale Price without tax
- Remember that this module can be used in conjonction with product_cost_incl_bom to have the
+ Remember that this module can be used in conjonction with product_cost_incl_bom to have the
cost price computed from the BOM when a product has one.
WARNING:
1) As this module will base his simple computation on sale and cost prices, it suppose
- you have them both in the same currency (the price type must of the same currency for both of
- them). Remember this is the default OpenERP configuration (price type of all product price
+ you have them both in the same currency (the price type must of the same currency for both of
+ them). Remember this is the default OpenERP configuration (price type of all product price
fields are set as the same as the company currency). We don't take care of it cause otherwise
we should have added a dependency on sale module.
-
""",
'website': 'http://www.camptocamp.com/',
'init_xml': [],
@@ -54,5 +53,3 @@
'auto_install': False,
'license': 'AGPL-3',
'application': True}
-
-
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index 7f39ed31d..fa97b668f 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -33,9 +33,9 @@ class Product(orm.Model):
def _amount_tax_excluded(self, cr, uid, ids, context=None):
"""
Compute the list price total without tax (in case you are in tax included).
- This will use the default taxes defined on the product.
+ This will use the default taxes defined on the product.
:return dict of values:
- {INT Product ID:
+ {INT Product ID:
float price without tax
}
"""
@@ -43,28 +43,27 @@ def _amount_tax_excluded(self, cr, uid, ids, context=None):
if context is None:
context = {}
tax_obj = self.pool.get('account.tax')
- cur_obj = self.pool.get('res.currency')
for prod in self.browse(cr, uid, ids):
price = prod.list_price
taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
res[prod.id] = taxes['total']
return res
- def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
+ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
"""
- Calculate the margin based on product infos. Take care of the cost_field
- define in product_get_cost_field. So the margin will be computed based on this
+ Calculate the margin based on product infos. Take care of the cost_field
+ define in product_get_cost_field. So the margin will be computed based on this
field.
We don't take care of the product price type currency to remove the dependency on
the sale module. We consider the cost and sale price is in the company currency.
- We take care of the default product taxes, and base our computation on total without
+ We take care of the default product taxes, and base our computation on total without
tax.
- :return dict of dict of the form :
+ :return dict of dict of the form :
{INT Product ID : {
- {'margin_absolute': float,
+ {'margin_absolute': float,
'margin_relative': float}
}}
"""
@@ -78,7 +77,8 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
res[product] = {'margin_absolute': 0, 'margin_relative': 0}
for product in self.browse(cursor, user, ids):
cost = product.cost_price
- sale = self._amount_tax_excluded(cursor, user, [product.id], context=context)[product.id]
+ sale = self._amount_tax_excluded(cursor, user,
+ [product.id], context=context)[product.id]
res[product.id]['standard_margin'] = sale - cost
if sale == 0:
logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
@@ -90,18 +90,22 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context = None):
_columns = {
'standard_margin': fields.function(
_compute_margin,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi ='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude. If no sale price, the margin will be negativ.'),
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
+ 'of the product form (not based on historical values). '
+ 'Take care of tax include and exclude. If no sale price, '
+ 'the margin will be negativ.'),
'standard_margin_rate': fields.function(
_compute_margin,
method=True,
string='Theorical Margin (%)',
digits_compute=dp.get_precision('Sale Price'),
multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price set, will display 999.0'),
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
+ 'of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price '
+ 'set, will display 999.0'),
}
From d643b76f3a18094fcfa9ebd31e2ad0f3760ede62 Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Mon, 14 Oct 2013 20:19:31 +0200
Subject: [PATCH 15/83] [IMP] use date in __openerp__.py instead of deprecated
update_xml and demo_xml
---
product_standard_margin/__openerp__.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index c901845f4..d5f28959b 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -46,8 +46,7 @@
""",
'website': 'http://www.camptocamp.com/',
'init_xml': [],
- 'update_xml': ['product_std_margin_view.xml'],
- 'demo_xml': [],
+ 'data': ['product_std_margin_view.xml'],
'tests': [],
'installable': True,
'auto_install': False,
From 728aef25302f332e5ca1500eb249454fed92309e Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Mon, 14 Oct 2013 20:42:41 +0200
Subject: [PATCH 16/83] [FIX] remove group to show margin fields
---
product_standard_margin/product_std_margin_view.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
index 5fbd14c29..07cfa3135 100644
--- a/product_standard_margin/product_std_margin_view.xml
+++ b/product_standard_margin/product_std_margin_view.xml
@@ -7,8 +7,8 @@
product.product
-
-
+
+
From 2d3dc3bbf6311bfabef3fbed12e4a3f3237c66e9 Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Mon, 14 Oct 2013 20:43:38 +0200
Subject: [PATCH 17/83] [ADD] pot file
---
.../i18n/product_standard_margin.pot | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 product_standard_margin/i18n/product_standard_margin.pot
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
new file mode 100644
index 000000000..264b76eda
--- /dev/null
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -0,0 +1,44 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-10-14 18:35+0000\n"
+"PO-Revision-Date: 2013-10-14 18:35+0000\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: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
+#: field:product.product,standard_margin_rate:0
+msgid "Theorical Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin:0
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
+#: field:product.product,standard_margin:0
+msgid "Theorical Margin"
+msgstr ""
+
From dd649e546847d3c5f4ff86547ae08c3e646be60f Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Mon, 14 Oct 2013 20:43:50 +0200
Subject: [PATCH 18/83] [IMP] update fr.po
---
product_standard_margin/i18n/fr.po | 47 +++++++++++++++++-------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index 1c99776a8..228f7994f 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -1,52 +1,57 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
-"Project-Id-Version: OpenERP Server 6.1\n"
+"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-11-07 14:35+0000\n"
+"POT-Creation-Date: 2013-10-14 18:35+0000\n"
"PO-Revision-Date: 2012-11-07 14:35+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
+"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
+"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
+"taux sera de 999.0"
+
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_product
msgid "Product"
msgstr "Produit"
#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
#: field:product.product,standard_margin_rate:0
msgid "Theorical Margin (%)"
msgstr "Marge Théorique (%)"
-#. module: product_standard_margin
-#: help:product.product,standard_margin_rate:0
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
-msgstr "Taux de marge théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du formulaire Produit] (ne tient pas compte de la facturation effective). Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le taux sera de 999.0"
-
-#. module: product_standard_margin
-#: constraint:product.product:0
-msgid "Error: Invalid ean code"
-msgstr "Erreur : Code EAN invalide"
-
#. module: product_standard_margin
#: help:product.product,standard_margin:0
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values).Take care of tax include and exclude. If no sale price, the margin will be negativ."
-msgstr "Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient pas compte de la facturation effective). Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
-
-#. module: product_standard_margin
-#: view:product.product:0
-msgid "Margin"
-msgstr "Marge"
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
+msgstr ""
+"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
+"pas compte de la facturation effective). Ce taux tient compte des PV TTC "
+"(TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
#: field:product.product,standard_margin:0
msgid "Theorical Margin"
msgstr "Marge Théorique"
-
From b61d70c266ec326070c6b65149a176ae3d7d7625 Mon Sep 17 00:00:00 2001
From: Joel Grand-Guillaume
Date: Wed, 27 Nov 2013 15:03:12 +0100
Subject: [PATCH 19/83] [IMP] Better logger implementation
---
product_standard_margin/product_std_margin.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index fa97b668f..15d38038d 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -24,7 +24,7 @@
from openerp.osv import orm, fields
import decimal_precision as dp
import logging
-
+_logger = logging.getLogger(__name__)
class Product(orm.Model):
_inherit = 'product.product'
@@ -67,7 +67,7 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
'margin_relative': float}
}}
"""
- logger = logging.getLogger('product_standard_margin')
+
if context is None:
context = {}
res = {}
@@ -81,7 +81,7 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
[product.id], context=context)[product.id]
res[product.id]['standard_margin'] = sale - cost
if sale == 0:
- logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
+ _logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
res[product.id]['standard_margin_rate'] = 999.
else:
res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
From 74b43b60309ae3a1489b051a23c73a4744f8175d Mon Sep 17 00:00:00 2001
From: Joel Grand-Guillaume
Date: Wed, 27 Nov 2013 16:26:22 +0100
Subject: [PATCH 20/83] [FIX] Context propagation
---
product_standard_margin/product_std_margin.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index 15d38038d..055148932 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -43,7 +43,7 @@ def _amount_tax_excluded(self, cr, uid, ids, context=None):
if context is None:
context = {}
tax_obj = self.pool.get('account.tax')
- for prod in self.browse(cr, uid, ids):
+ for prod in self.browse(cr, uid, ids, context=context):
price = prod.list_price
taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
res[prod.id] = taxes['total']
@@ -75,7 +75,7 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
return res
for product in ids:
res[product] = {'margin_absolute': 0, 'margin_relative': 0}
- for product in self.browse(cursor, user, ids):
+ for product in self.browse(cursor, user, ids, context=context):
cost = product.cost_price
sale = self._amount_tax_excluded(cursor, user,
[product.id], context=context)[product.id]
From f694431e945799fceb02b931fa889cf35a6f2e5e Mon Sep 17 00:00:00 2001
From: Joel Grand-Guillaume
Date: Tue, 10 Dec 2013 14:29:31 +0100
Subject: [PATCH 21/83] [IMP] Use read whenever it's possible for performance
reasons
---
product_standard_margin/product_std_margin.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index 055148932..b2c28cf71 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -75,16 +75,16 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
return res
for product in ids:
res[product] = {'margin_absolute': 0, 'margin_relative': 0}
- for product in self.browse(cursor, user, ids, context=context):
- cost = product.cost_price
+ for product in self.read(cursor, user, ids, ['id','cost_price'], context=context):
+ cost = product['cost_price']
sale = self._amount_tax_excluded(cursor, user,
- [product.id], context=context)[product.id]
- res[product.id]['standard_margin'] = sale - cost
+ [product['id']], context=context)[product['id']]
+ res[product['id']]['standard_margin'] = sale - cost
if sale == 0:
- _logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product.id)
- res[product.id]['standard_margin_rate'] = 999.
+ _logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product['id'])
+ res[product['id']]['standard_margin_rate'] = 999.
else:
- res[product.id]['standard_margin_rate'] = (sale - cost) / sale * 100
+ res[product['id']]['standard_margin_rate'] = (sale - cost) / sale * 100
return res
_columns = {
From 1a27fe794953522e4fb70809ffb2450282d2fd3f Mon Sep 17 00:00:00 2001
From: Yannick Vaucher
Date: Wed, 11 Dec 2013 16:30:40 +0100
Subject: [PATCH 22/83] [PEP8] product_standard_margin
---
product_standard_margin/product_std_margin.py | 78 ++++++++++---------
1 file changed, 43 insertions(+), 35 deletions(-)
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index b2c28cf71..7d4c7aadb 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -26,18 +26,21 @@
import logging
_logger = logging.getLogger(__name__)
+
class Product(orm.Model):
_inherit = 'product.product'
#TODO : compute the margin with default taxes
def _amount_tax_excluded(self, cr, uid, ids, context=None):
- """
- Compute the list price total without tax (in case you are in tax included).
+ """ Compute the list price total without tax
+
+ (in case you are in tax included).
This will use the default taxes defined on the product.
:return dict of values:
{INT Product ID:
float price without tax
}
+
"""
res = {}
if context is None:
@@ -49,25 +52,27 @@ def _amount_tax_excluded(self, cr, uid, ids, context=None):
res[prod.id] = taxes['total']
return res
- def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
- """
- Calculate the margin based on product infos. Take care of the cost_field
- define in product_get_cost_field. So the margin will be computed based on this
- field.
+ def _compute_margin(self, cr, user, ids, field_name, arg, context=None):
+ """ Calculate the margin based on product infos.
+
+ Take care of the cost_field define in product_get_cost_field. So the
+ margin will be computed based on this field.
- We don't take care of the product price type currency to remove the dependency on
- the sale module. We consider the cost and sale price is in the company currency.
+ We don't take care of the product price type currency to remove the
+ dependency on the sale module. We consider the cost and sale price is
+ in the company currency.
- We take care of the default product taxes, and base our computation on total without
- tax.
+ We take care of the default product taxes, and base our computation on
+ total without tax.
:return dict of dict of the form :
{INT Product ID : {
{'margin_absolute': float,
'margin_relative': float}
}}
+
"""
-
+
if context is None:
context = {}
res = {}
@@ -75,13 +80,16 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
return res
for product in ids:
res[product] = {'margin_absolute': 0, 'margin_relative': 0}
- for product in self.read(cursor, user, ids, ['id','cost_price'], context=context):
+ for product in self.read(cr, user, ids,
+ ['id', 'cost_price'], context=context):
cost = product['cost_price']
- sale = self._amount_tax_excluded(cursor, user,
- [product['id']], context=context)[product['id']]
+ sale = self._amount_tax_excluded(cr, user,
+ [product['id']],
+ context=context)[product['id']]
res[product['id']]['standard_margin'] = sale - cost
if sale == 0:
- _logger.debug("Sale price for product ID %d is 0, cannot compute margin rate...", product['id'])
+ _logger.debug("Sale price for product ID %d is 0, cannot "
+ "compute margin rate...", product['id'])
res[product['id']]['standard_margin_rate'] = 999.
else:
res[product['id']]['standard_margin_rate'] = (sale - cost) / sale * 100
@@ -89,23 +97,23 @@ def _compute_margin(self, cursor, user, ids, field_name, arg, context=None):
_columns = {
'standard_margin': fields.function(
- _compute_margin,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
- 'of the product form (not based on historical values). '
- 'Take care of tax include and exclude. If no sale price, '
- 'the margin will be negativ.'),
+ _compute_margin,
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
+ 'of the product form (not based on historical values). '
+ 'Take care of tax include and exclude. If no sale price, '
+ 'the margin will be negativ.'),
'standard_margin_rate': fields.function(
- _compute_margin,
- method=True,
- string='Theorical Margin (%)',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
- 'of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price '
- 'set, will display 999.0'),
- }
+ _compute_margin,
+ method=True,
+ string='Theorical Margin (%)',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
+ 'of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price '
+ 'set, will display 999.0'),
+ }
From 4babfa4da1b7503c33ecee315f56c6800f8bc68b Mon Sep 17 00:00:00 2001
From: Alexandre Fayolle
Date: Wed, 13 Aug 2014 16:09:16 +0200
Subject: [PATCH 23/83] all modules are unported on 8.0 branch
---
product_standard_margin/__init__.py | 22 ----
product_standard_margin/__openerp__.py | 54 --------
product_standard_margin/i18n/fr.po | 57 ---------
product_standard_margin/i18n/nl.po | 67 ----------
.../i18n/product_standard_margin.pot | 44 -------
product_standard_margin/product_std_margin.py | 119 ------------------
.../product_std_margin_view.xml | 20 ---
7 files changed, 383 deletions(-)
delete mode 100644 product_standard_margin/__init__.py
delete mode 100644 product_standard_margin/__openerp__.py
delete mode 100644 product_standard_margin/i18n/fr.po
delete mode 100644 product_standard_margin/i18n/nl.po
delete mode 100644 product_standard_margin/i18n/product_standard_margin.pot
delete mode 100644 product_standard_margin/product_std_margin.py
delete mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
deleted file mode 100644
index 4a754ba5d..000000000
--- a/product_standard_margin/__init__.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-from . import product_std_margin
-
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
deleted file mode 100644
index d5f28959b..000000000
--- a/product_standard_margin/__openerp__.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-{'name': 'Markup rate on product and sales',
- 'version': '1.0',
- 'author': 'Camptocamp',
- 'maintainer': 'Camptocamp',
- 'category': 'Sales Management',
- 'complexity': "normal", # easy, normal, expert
- 'depends': ['product_get_cost_field', 'account'],
- 'description': """
- Add a field on the product form that compute the standard (or theorical) margin based on the
- current values of sale and cost price present in the product form. We take care of taxe included
- or excluded.
-
- It will just compute it as follow: (Sale Price without tax - Cost Price) / Sale Price without tax
-
- Remember that this module can be used in conjonction with product_cost_incl_bom to have the
- cost price computed from the BOM when a product has one.
-
- WARNING:
-
- 1) As this module will base his simple computation on sale and cost prices, it suppose
- you have them both in the same currency (the price type must of the same currency for both of
- them). Remember this is the default OpenERP configuration (price type of all product price
- fields are set as the same as the company currency). We don't take care of it cause otherwise
- we should have added a dependency on sale module.
-
- """,
- 'website': 'http://www.camptocamp.com/',
- 'init_xml': [],
- 'data': ['product_std_margin_view.xml'],
- 'tests': [],
- 'installable': True,
- 'auto_install': False,
- 'license': 'AGPL-3',
- 'application': True}
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
deleted file mode 100644
index 228f7994f..000000000
--- a/product_standard_margin/i18n/fr.po
+++ /dev/null
@@ -1,57 +0,0 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * product_standard_margin
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: OpenERP Server 7.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-10-14 18:35+0000\n"
-"PO-Revision-Date: 2012-11-07 14:35+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
-
-#. module: product_standard_margin
-#: help:product.product,standard_margin_rate:0
-msgid ""
-"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.. "
-"If no sale price set, will display 999.0"
-msgstr ""
-"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
-"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
-"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
-"taux sera de 999.0"
-
-#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_product
-msgid "Product"
-msgstr "Produit"
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
-#: field:product.product,standard_margin_rate:0
-msgid "Theorical Margin (%)"
-msgstr "Marge Théorique (%)"
-
-#. module: product_standard_margin
-#: help:product.product,standard_margin:0
-msgid ""
-"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
-"(not based on historical values). Take care of tax include and exclude. If "
-"no sale price, the margin will be negativ."
-msgstr ""
-"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
-"pas compte de la facturation effective). Ce taux tient compte des PV TTC "
-"(TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
-#: field:product.product,standard_margin:0
-msgid "Theorical Margin"
-msgstr "Marge Théorique"
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
deleted file mode 100644
index 554bdeb5a..000000000
--- a/product_standard_margin/i18n/nl.po
+++ /dev/null
@@ -1,67 +0,0 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * product_standard_margin
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: OpenERP Server 6.1\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-12-23 12:04+0000\n"
-"PO-Revision-Date: 2012-12-23 13:35+0100\n"
-"Last-Translator: Erwin van der Ploeg | Endian Solutions "
-"\n"
-"Language-Team: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: \n"
-"X-Generator: Poedit 1.5.4\n"
-
-#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_product
-msgid "Product"
-msgstr "Product"
-
-#. module: product_standard_margin
-#: field:product.product,standard_margin_rate:0
-msgid "Theorical Margin (%)"
-msgstr "Theoretische marge (%)"
-
-#. module: product_standard_margin
-#: help:product.product,standard_margin_rate:0
-msgid ""
-"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.. "
-"If no sale price set, will display 999.0"
-msgstr ""
-"Theoretische marge (%) is [ Theoretische marge / Verkoopprijs (excl. BTW) ] "
-"van het product (niet gebaseerd op historische waardes). Het veld houdt "
-"rekening met prijzen incl. en excl. BTW. Indien geen verkooprijs is "
-"ingevoerd, wordt 999,0 weergegeven."
-
-#. module: product_standard_margin
-#: constraint:product.product:0
-msgid "Error: Invalid ean code"
-msgstr "Fout: ongeldige ean code"
-
-#. module: product_standard_margin
-#: help:product.product,standard_margin:0
-msgid ""
-"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
-"(not based on historical values).Take care of tax include and exclude. If no "
-"sale price, the margin will be negativ."
-msgstr ""
-"Theoretische marge is [ Verkoopprijs (excl. BTW) - Kostprijs) ] van het "
-"product (niet gebaseerd op historische waardes). Het veld houdt rekening met "
-"prijzen incl. en excl. BTW. Indien geen verkooprijs is ingevoerd, zal de "
-"marge negatief zijn."
-
-#. module: product_standard_margin
-#: view:product.product:0
-msgid "Margin"
-msgstr "Marge"
-
-#. module: product_standard_margin
-#: field:product.product,standard_margin:0
-msgid "Theorical Margin"
-msgstr "Theoretische marge"
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
deleted file mode 100644
index 264b76eda..000000000
--- a/product_standard_margin/i18n/product_standard_margin.pot
+++ /dev/null
@@ -1,44 +0,0 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * product_standard_margin
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: OpenERP Server 7.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-10-14 18:35+0000\n"
-"PO-Revision-Date: 2013-10-14 18:35+0000\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: product_standard_margin
-#: help:product.product,standard_margin_rate:0
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_product
-msgid "Product"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
-#: field:product.product,standard_margin_rate:0
-msgid "Theorical Margin (%)"
-msgstr ""
-
-#. module: product_standard_margin
-#: help:product.product,standard_margin:0
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
-#: field:product.product,standard_margin:0
-msgid "Theorical Margin"
-msgstr ""
-
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
deleted file mode 100644
index 7d4c7aadb..000000000
--- a/product_standard_margin/product_std_margin.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
-# All Right Reserved
-#
-# Author : Joel Grand-Guillaume
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from openerp.osv import orm, fields
-import decimal_precision as dp
-import logging
-_logger = logging.getLogger(__name__)
-
-
-class Product(orm.Model):
- _inherit = 'product.product'
-
- #TODO : compute the margin with default taxes
- def _amount_tax_excluded(self, cr, uid, ids, context=None):
- """ Compute the list price total without tax
-
- (in case you are in tax included).
- This will use the default taxes defined on the product.
- :return dict of values:
- {INT Product ID:
- float price without tax
- }
-
- """
- res = {}
- if context is None:
- context = {}
- tax_obj = self.pool.get('account.tax')
- for prod in self.browse(cr, uid, ids, context=context):
- price = prod.list_price
- taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
- res[prod.id] = taxes['total']
- return res
-
- def _compute_margin(self, cr, user, ids, field_name, arg, context=None):
- """ Calculate the margin based on product infos.
-
- Take care of the cost_field define in product_get_cost_field. So the
- margin will be computed based on this field.
-
- We don't take care of the product price type currency to remove the
- dependency on the sale module. We consider the cost and sale price is
- in the company currency.
-
- We take care of the default product taxes, and base our computation on
- total without tax.
-
- :return dict of dict of the form :
- {INT Product ID : {
- {'margin_absolute': float,
- 'margin_relative': float}
- }}
-
- """
-
- if context is None:
- context = {}
- res = {}
- if not ids:
- return res
- for product in ids:
- res[product] = {'margin_absolute': 0, 'margin_relative': 0}
- for product in self.read(cr, user, ids,
- ['id', 'cost_price'], context=context):
- cost = product['cost_price']
- sale = self._amount_tax_excluded(cr, user,
- [product['id']],
- context=context)[product['id']]
- res[product['id']]['standard_margin'] = sale - cost
- if sale == 0:
- _logger.debug("Sale price for product ID %d is 0, cannot "
- "compute margin rate...", product['id'])
- res[product['id']]['standard_margin_rate'] = 999.
- else:
- res[product['id']]['standard_margin_rate'] = (sale - cost) / sale * 100
- return res
-
- _columns = {
- 'standard_margin': fields.function(
- _compute_margin,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
- 'of the product form (not based on historical values). '
- 'Take care of tax include and exclude. If no sale price, '
- 'the margin will be negativ.'),
- 'standard_margin_rate': fields.function(
- _compute_margin,
- method=True,
- string='Theorical Margin (%)',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
- 'of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price '
- 'set, will display 999.0'),
- }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
deleted file mode 100644
index 07cfa3135..000000000
--- a/product_standard_margin/product_std_margin_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
- product.markup.view.form
- form
- product.product
-
-
-
-
-
-
-
-
-
-
-
-
-
From 7972896bf4e40ae87b127201ec950deed08e41e1 Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Fri, 24 Jul 2015 09:29:36 +0200
Subject: [PATCH 24/83] [PORT][WIP] move 'product_standard_margin' from
unported to regular folder;
---
product_standard_margin/__init__.py | 22 ++++
product_standard_margin/__openerp__.py | 54 ++++++++
product_standard_margin/i18n/fr.po | 57 +++++++++
product_standard_margin/i18n/nl.po | 67 ++++++++++
.../i18n/product_standard_margin.pot | 44 +++++++
product_standard_margin/product_std_margin.py | 119 ++++++++++++++++++
.../product_std_margin_view.xml | 20 +++
7 files changed, 383 insertions(+)
create mode 100644 product_standard_margin/__init__.py
create mode 100644 product_standard_margin/__openerp__.py
create mode 100644 product_standard_margin/i18n/fr.po
create mode 100644 product_standard_margin/i18n/nl.po
create mode 100644 product_standard_margin/i18n/product_standard_margin.pot
create mode 100644 product_standard_margin/product_std_margin.py
create mode 100644 product_standard_margin/product_std_margin_view.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
new file mode 100644
index 000000000..4a754ba5d
--- /dev/null
+++ b/product_standard_margin/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from . import product_std_margin
+
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
new file mode 100644
index 000000000..e9069f0c5
--- /dev/null
+++ b/product_standard_margin/__openerp__.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+{'name': 'Markup rate on product and sales',
+ 'version': '1.0',
+ 'author': "Camptocamp,Odoo Community Association (OCA)",
+ 'maintainer': 'Camptocamp',
+ 'category': 'Sales Management',
+ 'complexity': "normal", # easy, normal, expert
+ 'depends': ['product_get_cost_field', 'account'],
+ 'description': """
+ Add a field on the product form that compute the standard (or theorical) margin based on the
+ current values of sale and cost price present in the product form. We take care of taxe included
+ or excluded.
+
+ It will just compute it as follow: (Sale Price without tax - Cost Price) / Sale Price without tax
+
+ Remember that this module can be used in conjonction with product_cost_incl_bom to have the
+ cost price computed from the BOM when a product has one.
+
+ WARNING:
+
+ 1) As this module will base his simple computation on sale and cost prices, it suppose
+ you have them both in the same currency (the price type must of the same currency for both of
+ them). Remember this is the default OpenERP configuration (price type of all product price
+ fields are set as the same as the company currency). We don't take care of it cause otherwise
+ we should have added a dependency on sale module.
+
+ """,
+ 'website': 'http://www.camptocamp.com/',
+ 'init_xml': [],
+ 'data': ['product_std_margin_view.xml'],
+ 'tests': [],
+ 'installable': False,
+ 'auto_install': False,
+ 'license': 'AGPL-3',
+ 'application': True}
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
new file mode 100644
index 000000000..228f7994f
--- /dev/null
+++ b/product_standard_margin/i18n/fr.po
@@ -0,0 +1,57 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-10-14 18:35+0000\n"
+"PO-Revision-Date: 2012-11-07 14:35+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
+"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
+"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
+"taux sera de 999.0"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr "Produit"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
+#: field:product.product,standard_margin_rate:0
+msgid "Theorical Margin (%)"
+msgstr "Marge Théorique (%)"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin:0
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
+msgstr ""
+"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
+"pas compte de la facturation effective). Ce taux tient compte des PV TTC "
+"(TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
+#: field:product.product,standard_margin:0
+msgid "Theorical Margin"
+msgstr "Marge Théorique"
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
new file mode 100644
index 000000000..554bdeb5a
--- /dev/null
+++ b/product_standard_margin/i18n/nl.po
@@ -0,0 +1,67 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-12-23 12:04+0000\n"
+"PO-Revision-Date: 2012-12-23 13:35+0100\n"
+"Last-Translator: Erwin van der Ploeg | Endian Solutions "
+"\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr "Product"
+
+#. module: product_standard_margin
+#: field:product.product,standard_margin_rate:0
+msgid "Theorical Margin (%)"
+msgstr "Theoretische marge (%)"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Theoretische marge (%) is [ Theoretische marge / Verkoopprijs (excl. BTW) ] "
+"van het product (niet gebaseerd op historische waardes). Het veld houdt "
+"rekening met prijzen incl. en excl. BTW. Indien geen verkooprijs is "
+"ingevoerd, wordt 999,0 weergegeven."
+
+#. module: product_standard_margin
+#: constraint:product.product:0
+msgid "Error: Invalid ean code"
+msgstr "Fout: ongeldige ean code"
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin:0
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values).Take care of tax include and exclude. If no "
+"sale price, the margin will be negativ."
+msgstr ""
+"Theoretische marge is [ Verkoopprijs (excl. BTW) - Kostprijs) ] van het "
+"product (niet gebaseerd op historische waardes). Het veld houdt rekening met "
+"prijzen incl. en excl. BTW. Indien geen verkooprijs is ingevoerd, zal de "
+"marge negatief zijn."
+
+#. module: product_standard_margin
+#: view:product.product:0
+msgid "Margin"
+msgstr "Marge"
+
+#. module: product_standard_margin
+#: field:product.product,standard_margin:0
+msgid "Theorical Margin"
+msgstr "Theoretische marge"
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
new file mode 100644
index 000000000..264b76eda
--- /dev/null
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -0,0 +1,44 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-10-14 18:35+0000\n"
+"PO-Revision-Date: 2013-10-14 18:35+0000\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: product_standard_margin
+#: help:product.product,standard_margin_rate:0
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
+#: field:product.product,standard_margin_rate:0
+msgid "Theorical Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: help:product.product,standard_margin:0
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
+#: field:product.product,standard_margin:0
+msgid "Theorical Margin"
+msgstr ""
+
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
new file mode 100644
index 000000000..7d4c7aadb
--- /dev/null
+++ b/product_standard_margin/product_std_margin.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
+# All Right Reserved
+#
+# Author : Joel Grand-Guillaume
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from openerp.osv import orm, fields
+import decimal_precision as dp
+import logging
+_logger = logging.getLogger(__name__)
+
+
+class Product(orm.Model):
+ _inherit = 'product.product'
+
+ #TODO : compute the margin with default taxes
+ def _amount_tax_excluded(self, cr, uid, ids, context=None):
+ """ Compute the list price total without tax
+
+ (in case you are in tax included).
+ This will use the default taxes defined on the product.
+ :return dict of values:
+ {INT Product ID:
+ float price without tax
+ }
+
+ """
+ res = {}
+ if context is None:
+ context = {}
+ tax_obj = self.pool.get('account.tax')
+ for prod in self.browse(cr, uid, ids, context=context):
+ price = prod.list_price
+ taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
+ res[prod.id] = taxes['total']
+ return res
+
+ def _compute_margin(self, cr, user, ids, field_name, arg, context=None):
+ """ Calculate the margin based on product infos.
+
+ Take care of the cost_field define in product_get_cost_field. So the
+ margin will be computed based on this field.
+
+ We don't take care of the product price type currency to remove the
+ dependency on the sale module. We consider the cost and sale price is
+ in the company currency.
+
+ We take care of the default product taxes, and base our computation on
+ total without tax.
+
+ :return dict of dict of the form :
+ {INT Product ID : {
+ {'margin_absolute': float,
+ 'margin_relative': float}
+ }}
+
+ """
+
+ if context is None:
+ context = {}
+ res = {}
+ if not ids:
+ return res
+ for product in ids:
+ res[product] = {'margin_absolute': 0, 'margin_relative': 0}
+ for product in self.read(cr, user, ids,
+ ['id', 'cost_price'], context=context):
+ cost = product['cost_price']
+ sale = self._amount_tax_excluded(cr, user,
+ [product['id']],
+ context=context)[product['id']]
+ res[product['id']]['standard_margin'] = sale - cost
+ if sale == 0:
+ _logger.debug("Sale price for product ID %d is 0, cannot "
+ "compute margin rate...", product['id'])
+ res[product['id']]['standard_margin_rate'] = 999.
+ else:
+ res[product['id']]['standard_margin_rate'] = (sale - cost) / sale * 100
+ return res
+
+ _columns = {
+ 'standard_margin': fields.function(
+ _compute_margin,
+ method=True,
+ string='Theorical Margin',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
+ 'of the product form (not based on historical values). '
+ 'Take care of tax include and exclude. If no sale price, '
+ 'the margin will be negativ.'),
+ 'standard_margin_rate': fields.function(
+ _compute_margin,
+ method=True,
+ string='Theorical Margin (%)',
+ digits_compute=dp.get_precision('Sale Price'),
+ multi='margin',
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
+ 'of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price '
+ 'set, will display 999.0'),
+ }
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/product_std_margin_view.xml
new file mode 100644
index 000000000..07cfa3135
--- /dev/null
+++ b/product_standard_margin/product_std_margin_view.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ product.markup.view.form
+ form
+ product.product
+
+
+
+
+
+
+
+
+
+
+
+
+
From 2d8a861031395695230e06a0d3c8435c5f65c42b Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Fri, 24 Jul 2015 09:33:14 +0200
Subject: [PATCH 25/83] [PORT][WIP] port somes commit from V7 branches,
specially 18bf9614b1c58f39ec8bdbd53cf4363faceaa9c1 that make standard_margin
and standard_margin_rate stored fields;
---
product_standard_margin/__init__.py | 1 -
product_standard_margin/__openerp__.py | 30 +++++-----
product_standard_margin/product_std_margin.py | 58 +++++++++++++------
3 files changed, 58 insertions(+), 31 deletions(-)
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
index 4a754ba5d..04072607e 100644
--- a/product_standard_margin/__init__.py
+++ b/product_standard_margin/__init__.py
@@ -19,4 +19,3 @@
#
##############################################################################
from . import product_std_margin
-
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index e9069f0c5..0c976ec64 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -24,31 +24,35 @@
'maintainer': 'Camptocamp',
'category': 'Sales Management',
'complexity': "normal", # easy, normal, expert
- 'depends': ['product_get_cost_field', 'account'],
+ 'depends': ['product_get_cost_field',
+ 'account'],
'description': """
- Add a field on the product form that compute the standard (or theorical) margin based on the
- current values of sale and cost price present in the product form. We take care of taxe included
- or excluded.
+ Add a field on the product form that compute the standard (or theorical)
+ margin based on the current values of sale and cost price present in the
+ product form. We take care of taxe included or excluded.
- It will just compute it as follow: (Sale Price without tax - Cost Price) / Sale Price without tax
+ It will just compute it as follow: (Sale Price without tax - Cost Price) /
+ Sale Price without tax
- Remember that this module can be used in conjonction with product_cost_incl_bom to have the
- cost price computed from the BOM when a product has one.
+ Remember that this module can be used in conjonction with
+ product_cost_incl_bom to have the cost price computed from the BOM when a
+ product has one.
WARNING:
- 1) As this module will base his simple computation on sale and cost prices, it suppose
- you have them both in the same currency (the price type must of the same currency for both of
- them). Remember this is the default OpenERP configuration (price type of all product price
- fields are set as the same as the company currency). We don't take care of it cause otherwise
- we should have added a dependency on sale module.
+ 1) As this module will base his simple computation on sale and cost prices,
+ it suppose you have them both in the same currency (the price type must of
+ the same currency for both of them). Remember this is the default OpenERP
+ configuration (price type of all product price fields are set as the same as
+ the company currency). We don't take care of it cause otherwise we should
+ have added a dependency on sale module.
""",
'website': 'http://www.camptocamp.com/',
'init_xml': [],
'data': ['product_std_margin_view.xml'],
'tests': [],
- 'installable': False,
+ 'installable': True,
'auto_install': False,
'license': 'AGPL-3',
'application': True}
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/product_std_margin.py
index 7d4c7aadb..408a07dd8 100644
--- a/product_standard_margin/product_std_margin.py
+++ b/product_standard_margin/product_std_margin.py
@@ -27,10 +27,10 @@
_logger = logging.getLogger(__name__)
-class Product(orm.Model):
+class ProductProduct(orm.Model):
_inherit = 'product.product'
- #TODO : compute the margin with default taxes
+ # TODO : compute the margin with default taxes
def _amount_tax_excluded(self, cr, uid, ids, context=None):
""" Compute the list price total without tax
@@ -48,7 +48,11 @@ def _amount_tax_excluded(self, cr, uid, ids, context=None):
tax_obj = self.pool.get('account.tax')
for prod in self.browse(cr, uid, ids, context=context):
price = prod.list_price
- taxes = tax_obj.compute_all(cr, uid, prod.taxes_id, price, 1, product=prod.id)
+ taxes = tax_obj.compute_all(cr, uid,
+ prod.taxes_id,
+ price,
+ 1,
+ product=prod.id)
res[prod.id] = taxes['total']
return res
@@ -67,37 +71,56 @@ def _compute_margin(self, cr, user, ids, field_name, arg, context=None):
:return dict of dict of the form :
{INT Product ID : {
- {'margin_absolute': float,
- 'margin_relative': float}
+ {'standard_margin': float,
+ 'standard_margin_rate': float}
}}
"""
-
- if context is None:
- context = {}
- res = {}
- if not ids:
- return res
- for product in ids:
- res[product] = {'margin_absolute': 0, 'margin_relative': 0}
+ context = context and context or {}
+ res = {id: {} for id in ids}
for product in self.read(cr, user, ids,
['id', 'cost_price'], context=context):
cost = product['cost_price']
sale = self._amount_tax_excluded(cr, user,
[product['id']],
context=context)[product['id']]
- res[product['id']]['standard_margin'] = sale - cost
+ _res = res[product['id']]
+ _res['standard_margin'] = sale - cost
if sale == 0:
_logger.debug("Sale price for product ID %d is 0, cannot "
- "compute margin rate...", product['id'])
- res[product['id']]['standard_margin_rate'] = 999.
+ "compute margin rate...",
+ product['id'])
+ _res['standard_margin_rate'] = 999.
else:
- res[product['id']]['standard_margin_rate'] = (sale - cost) / sale * 100
+ _res['standard_margin_rate'] = (sale - cost) / sale * 100
return res
+ def _get_product_margin_change_from_tax(self, cr, uid, ids, context=None):
+ """Find the products to trigger when a Tax changes"""
+ pt_obj = self.pool['product.template']
+ pp_obj = self.pool['product.product']
+ pt_ids = pt_obj.search(cr, uid, [
+ '|', ('taxes_id', 'in', ids),
+ ('supplier_taxes_id', 'in', ids)], context=context)
+ pp_ids = pp_obj.search(
+ cr, uid, [('product_tmpl_id', 'in', pt_ids)], context=context)
+ return pp_ids
+
+ _margin_triggers = {
+ 'product.product': (
+ lambda self, cr, uid, ids, context=None:
+ ids, None, 10),
+ 'account.tax': (
+ _get_product_margin_change_from_tax, [
+ 'type', 'price_include', 'amount',
+ 'include_base_amount', 'child_depend'],
+ 10),
+ }
+
_columns = {
'standard_margin': fields.function(
_compute_margin,
+ store=_margin_triggers,
method=True,
string='Theorical Margin',
digits_compute=dp.get_precision('Sale Price'),
@@ -108,6 +131,7 @@ def _compute_margin(self, cr, user, ids, field_name, arg, context=None):
'the margin will be negativ.'),
'standard_margin_rate': fields.function(
_compute_margin,
+ store=_margin_triggers,
method=True,
string='Theorical Margin (%)',
digits_compute=dp.get_precision('Sale Price'),
From 31976923e2eb0028f590ecf4db1de8af04599640 Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Fri, 24 Jul 2015 09:43:25 +0200
Subject: [PATCH 26/83] [PORT][REF] OCA convention;
---
product_standard_margin/__init__.py | 2 +-
product_standard_margin/__openerp__.py | 4 +++-
product_standard_margin/models/__init__.py | 21 +++++++++++++++++++
.../product_product.py} | 0
.../view.xml} | 0
5 files changed, 25 insertions(+), 2 deletions(-)
create mode 100644 product_standard_margin/models/__init__.py
rename product_standard_margin/{product_std_margin.py => models/product_product.py} (100%)
rename product_standard_margin/{product_std_margin_view.xml => views/view.xml} (100%)
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
index 04072607e..54f620f43 100644
--- a/product_standard_margin/__init__.py
+++ b/product_standard_margin/__init__.py
@@ -18,4 +18,4 @@
# along with this program. If not, see .
#
##############################################################################
-from . import product_std_margin
+from . import models
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index 0c976ec64..2f82b357f 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -50,7 +50,9 @@
""",
'website': 'http://www.camptocamp.com/',
'init_xml': [],
- 'data': ['product_std_margin_view.xml'],
+ 'data': [
+ 'views/view.xml',
+],
'tests': [],
'installable': True,
'auto_install': False,
diff --git a/product_standard_margin/models/__init__.py b/product_standard_margin/models/__init__.py
new file mode 100644
index 000000000..8d4366b62
--- /dev/null
+++ b/product_standard_margin/models/__init__.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joel Grand-Guillaume
+# Copyright 2012 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from . import product_product
diff --git a/product_standard_margin/product_std_margin.py b/product_standard_margin/models/product_product.py
similarity index 100%
rename from product_standard_margin/product_std_margin.py
rename to product_standard_margin/models/product_product.py
diff --git a/product_standard_margin/product_std_margin_view.xml b/product_standard_margin/views/view.xml
similarity index 100%
rename from product_standard_margin/product_std_margin_view.xml
rename to product_standard_margin/views/view.xml
From 3bb6bc453c3bc6086a5d421fc8d2962e5f1f2ede Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Fri, 24 Jul 2015 17:31:00 +0200
Subject: [PATCH 27/83] [REF] V8 api; [FIX] margin precision; [REF] new
description in readme file; [ADD] new 'field list_price_vat_excl';
---
product_standard_margin/README.rst | 55 +++++++
product_standard_margin/__init__.py | 1 +
product_standard_margin/__openerp__.py | 56 ++-----
.../data/decimal_precision.yml | 24 +++
.../models/product_product.py | 153 +++++-------------
product_standard_margin/views/view.xml | 31 ++--
6 files changed, 153 insertions(+), 167 deletions(-)
create mode 100644 product_standard_margin/README.rst
create mode 100644 product_standard_margin/data/decimal_precision.yml
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
new file mode 100644
index 000000000..1c5c9e351
--- /dev/null
+++ b/product_standard_margin/README.rst
@@ -0,0 +1,55 @@
+Product Margin and Margin Rate
+==============================
+
+Add a field on the product form that compute the standard (or theorical)
+margin based on the current values of sale and replenishment cost present in
+the product form. We take care of taxe included or excluded.
+
+It will just compute it as follow:
+(Sale Price without tax - Replenishment Cost) / Sale Price without tax
+
+Remember that this module can be used in conjonction with
+product_cost_incl_bom to have the replenishment cost computed from the BOM when
+a product has one.
+
+ WARNING:
+
+ 1) As this module will base his simple computation on sale and cost prices,
+ it suppose you have them both in the same currency (the price type must of
+ the same currency for both of them). Remember this is the default OpenERP
+ configuration (price type of all product price fields are set as the same as
+ the company currency). We don't take care of it cause otherwise we should
+ have added a dependency on sale module.
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues `_.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
+`here `_.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Alexandre Fayolle
+* Yannick Vaucher
+* Joël Grand-Guillaume
+* Sylvain Le Gal (https://twitter.com/legalsylvain)
+
+Maintainer
+----------
+
+.. image:: http://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: http://odoo-community.org
+
+This module is maintained by the OCA.
+
+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.
+
+To contribute to this module, please visit http://odoo-community.org.
+
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
index 54f620f43..cb1a1975c 100644
--- a/product_standard_margin/__init__.py
+++ b/product_standard_margin/__init__.py
@@ -18,4 +18,5 @@
# along with this program. If not, see .
#
##############################################################################
+
from . import models
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index 2f82b357f..5db420157 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -18,43 +18,19 @@
# along with this program. If not, see .
#
##############################################################################
-{'name': 'Markup rate on product and sales',
- 'version': '1.0',
- 'author': "Camptocamp,Odoo Community Association (OCA)",
- 'maintainer': 'Camptocamp',
- 'category': 'Sales Management',
- 'complexity': "normal", # easy, normal, expert
- 'depends': ['product_get_cost_field',
- 'account'],
- 'description': """
- Add a field on the product form that compute the standard (or theorical)
- margin based on the current values of sale and cost price present in the
- product form. We take care of taxe included or excluded.
-
- It will just compute it as follow: (Sale Price without tax - Cost Price) /
- Sale Price without tax
-
- Remember that this module can be used in conjonction with
- product_cost_incl_bom to have the cost price computed from the BOM when a
- product has one.
-
- WARNING:
-
- 1) As this module will base his simple computation on sale and cost prices,
- it suppose you have them both in the same currency (the price type must of
- the same currency for both of them). Remember this is the default OpenERP
- configuration (price type of all product price fields are set as the same as
- the company currency). We don't take care of it cause otherwise we should
- have added a dependency on sale module.
-
- """,
- 'website': 'http://www.camptocamp.com/',
- 'init_xml': [],
- 'data': [
- 'views/view.xml',
-],
- 'tests': [],
- 'installable': True,
- 'auto_install': False,
- 'license': 'AGPL-3',
- 'application': True}
+{
+ 'name': 'Product Margin and Margin Rate',
+ 'version': '2.0',
+ 'author': 'Camptocamp,GRAP,Odoo Community Association (OCA)',
+ 'category': 'Product',
+ 'depends': [
+ 'product_replenishment_cost',
+ 'account',
+ ],
+ 'website': 'http://www.camptocamp.com/',
+ 'data': [
+ 'data/decimal_precision.yml',
+ 'views/view.xml',
+ ],
+ 'license': 'AGPL-3',
+}
diff --git a/product_standard_margin/data/decimal_precision.yml b/product_standard_margin/data/decimal_precision.yml
new file mode 100644
index 000000000..c96bcc573
--- /dev/null
+++ b/product_standard_margin/data/decimal_precision.yml
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
+# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+- !record {model: decimal.precision, id: product_margin_precision}:
+ name: Product Margin Precision
+ digits: 2
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 408a07dd8..657e1f879 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -21,123 +21,54 @@
#
##############################################################################
-from openerp.osv import orm, fields
-import decimal_precision as dp
-import logging
-_logger = logging.getLogger(__name__)
+from openerp import fields, api
+from openerp.models import Model
+import openerp.addons.decimal_precision as dp
-class ProductProduct(orm.Model):
+class ProductProduct(Model):
_inherit = 'product.product'
- # TODO : compute the margin with default taxes
- def _amount_tax_excluded(self, cr, uid, ids, context=None):
- """ Compute the list price total without tax
+ @api.multi
+ @api.depends(
+ 'product_tmpl_id.list_price', 'replenishment_cost', 'taxes_id.type',
+ 'taxes_id.price_include', 'taxes_id.amount',
+ 'taxes_id.include_base_amount', 'taxes_id.child_depend')
+ def _get_margin(self):
+ print "_get_margin"
+ tax_obj = self.pool['account.tax']
+ for product in self:
+ product.list_price_vat_excl = tax_obj.compute_all(
+ self.env.cr, self.env.uid, product.taxes_id,
+ product.list_price, 1, product=product.id)['total']
- (in case you are in tax included).
- This will use the default taxes defined on the product.
- :return dict of values:
- {INT Product ID:
- float price without tax
- }
-
- """
- res = {}
- if context is None:
- context = {}
- tax_obj = self.pool.get('account.tax')
- for prod in self.browse(cr, uid, ids, context=context):
- price = prod.list_price
- taxes = tax_obj.compute_all(cr, uid,
- prod.taxes_id,
- price,
- 1,
- product=prod.id)
- res[prod.id] = taxes['total']
- return res
-
- def _compute_margin(self, cr, user, ids, field_name, arg, context=None):
- """ Calculate the margin based on product infos.
-
- Take care of the cost_field define in product_get_cost_field. So the
- margin will be computed based on this field.
-
- We don't take care of the product price type currency to remove the
- dependency on the sale module. We consider the cost and sale price is
- in the company currency.
-
- We take care of the default product taxes, and base our computation on
- total without tax.
-
- :return dict of dict of the form :
- {INT Product ID : {
- {'standard_margin': float,
- 'standard_margin_rate': float}
- }}
-
- """
- context = context and context or {}
- res = {id: {} for id in ids}
- for product in self.read(cr, user, ids,
- ['id', 'cost_price'], context=context):
- cost = product['cost_price']
- sale = self._amount_tax_excluded(cr, user,
- [product['id']],
- context=context)[product['id']]
- _res = res[product['id']]
- _res['standard_margin'] = sale - cost
- if sale == 0:
- _logger.debug("Sale price for product ID %d is 0, cannot "
- "compute margin rate...",
- product['id'])
- _res['standard_margin_rate'] = 999.
+ product.standard_margin =\
+ product.list_price_vat_excl - product.replenishment_cost
+ if product.list_price_vat_excl == 0:
+ product.standard_margin_rate = 999.
else:
- _res['standard_margin_rate'] = (sale - cost) / sale * 100
- return res
+ product.standard_margin_rate = (
+ (product.list_price_vat_excl - product.replenishment_cost) /
+ product.list_price_vat_excl * 100)
- def _get_product_margin_change_from_tax(self, cr, uid, ids, context=None):
- """Find the products to trigger when a Tax changes"""
- pt_obj = self.pool['product.template']
- pp_obj = self.pool['product.product']
- pt_ids = pt_obj.search(cr, uid, [
- '|', ('taxes_id', 'in', ids),
- ('supplier_taxes_id', 'in', ids)], context=context)
- pp_ids = pp_obj.search(
- cr, uid, [('product_tmpl_id', 'in', pt_ids)], context=context)
- return pp_ids
+ # Column Section
+ list_price_vat_excl = fields.Float(
+ compute=_get_margin, string='Sale Price VAT Excluded', store=True,
+ digits_compute=dp.get_precision('Product Price'),
+ )
- _margin_triggers = {
- 'product.product': (
- lambda self, cr, uid, ids, context=None:
- ids, None, 10),
- 'account.tax': (
- _get_product_margin_change_from_tax, [
- 'type', 'price_include', 'amount',
- 'include_base_amount', 'child_depend'],
- 10),
- }
+ standard_margin = fields.Float(
+ compute=_get_margin, string='Theorical Margin', store=True,
+ digits_compute=dp.get_precision('Product Price'),
+ help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
+ 'of the product form (not based on historical values). '
+ 'Take care of tax include and exclude. If no sale price, '
+ 'the margin will be negativ.')
- _columns = {
- 'standard_margin': fields.function(
- _compute_margin,
- store=_margin_triggers,
- method=True,
- string='Theorical Margin',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
- 'of the product form (not based on historical values). '
- 'Take care of tax include and exclude. If no sale price, '
- 'the margin will be negativ.'),
- 'standard_margin_rate': fields.function(
- _compute_margin,
- store=_margin_triggers,
- method=True,
- string='Theorical Margin (%)',
- digits_compute=dp.get_precision('Sale Price'),
- multi='margin',
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
- 'of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price '
- 'set, will display 999.0'),
- }
+ standard_margin_rate = fields.Float(
+ compute=_get_margin, string='Theorical Margin (%)', store=True,
+ digits_compute=dp.get_precision('Product Margin Precision'),
+ help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
+ 'of the product form (not based on historical values).'
+ 'Take care of tax include and exclude.. If no sale price '
+ 'set, will display 999.0')
diff --git a/product_standard_margin/views/view.xml b/product_standard_margin/views/view.xml
index 07cfa3135..eaeba8280 100644
--- a/product_standard_margin/views/view.xml
+++ b/product_standard_margin/views/view.xml
@@ -1,20 +1,19 @@
-
-
- product.markup.view.form
- form
- product.product
-
-
-
-
-
-
-
-
-
-
+
+
+
+ product.product
+
+
+
+
+
+
+
+
+
+
-
+
From 2262f249b10fadc0ca8cb77fb754ee0b31154cb0 Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Mon, 17 Aug 2015 12:03:41 +0200
Subject: [PATCH 28/83] [FIX] flake8 + Pylint;
---
product_standard_margin/models/product_product.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 657e1f879..01372f8b4 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -35,12 +35,11 @@ class ProductProduct(Model):
'taxes_id.price_include', 'taxes_id.amount',
'taxes_id.include_base_amount', 'taxes_id.child_depend')
def _get_margin(self):
- print "_get_margin"
tax_obj = self.pool['account.tax']
for product in self:
product.list_price_vat_excl = tax_obj.compute_all(
self.env.cr, self.env.uid, product.taxes_id,
- product.list_price, 1, product=product.id)['total']
+ product.list_price, 1, product=product.id)['total']
product.standard_margin =\
product.list_price_vat_excl - product.replenishment_cost
@@ -48,7 +47,8 @@ def _get_margin(self):
product.standard_margin_rate = 999.
else:
product.standard_margin_rate = (
- (product.list_price_vat_excl - product.replenishment_cost) /
+ (product.list_price_vat_excl
+ - product.replenishment_cost) /
product.list_price_vat_excl * 100)
# Column Section
From e5908d4b7cf4ffbf6ad144d9743562402196d278 Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Mon, 17 Aug 2015 17:54:27 +0200
Subject: [PATCH 29/83] [REF] use new API;
---
product_standard_margin/models/product_product.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 01372f8b4..6ddb14d3d 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -35,10 +35,8 @@ class ProductProduct(Model):
'taxes_id.price_include', 'taxes_id.amount',
'taxes_id.include_base_amount', 'taxes_id.child_depend')
def _get_margin(self):
- tax_obj = self.pool['account.tax']
for product in self:
- product.list_price_vat_excl = tax_obj.compute_all(
- self.env.cr, self.env.uid, product.taxes_id,
+ product.list_price_vat_excl = product.taxes_id.compute_all(
product.list_price, 1, product=product.id)['total']
product.standard_margin =\
From 2f9ac9d07053b2dd3eb68dd3a971d7d5b48ec760 Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Mon, 17 Aug 2015 17:57:43 +0200
Subject: [PATCH 30/83] [REF] add AGPL logo;
---
product_standard_margin/README.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index 1c5c9e351..abaf29e09 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -1,3 +1,6 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :alt: License: AGPL-3
+
Product Margin and Margin Rate
==============================
From 9baba3b26079e30406eeacfbf613f51507d67067 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Bidoul?=
Date: Fri, 9 Oct 2015 10:01:49 +0200
Subject: [PATCH 31/83] [UPD] prefix versions with 8.0
---
product_standard_margin/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index 5db420157..d523b73f5 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Product Margin and Margin Rate',
- 'version': '2.0',
+ 'version': '8.0.2.0.0',
'author': 'Camptocamp,GRAP,Odoo Community Association (OCA)',
'category': 'Product',
'depends': [
From 323d9fd6edc4f711669068bdbd2bb90210df5958 Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Wed, 14 Oct 2015 03:30:30 +0200
Subject: [PATCH 32/83] [MIG] Make modules uninstallable
---
product_standard_margin/__openerp__.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__openerp__.py
index d523b73f5..845100e4d 100644
--- a/product_standard_margin/__openerp__.py
+++ b/product_standard_margin/__openerp__.py
@@ -33,4 +33,5 @@
'views/view.xml',
],
'license': 'AGPL-3',
+ 'installable': False,
}
From 9ee5870d752db879d9f1b2bbebf7070bbba84384 Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Thu, 6 Oct 2016 15:56:23 +0200
Subject: [PATCH 33/83] [MIG] Rename manifest files
---
product_standard_margin/{__openerp__.py => __manifest__.py} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename product_standard_margin/{__openerp__.py => __manifest__.py} (100%)
diff --git a/product_standard_margin/__openerp__.py b/product_standard_margin/__manifest__.py
similarity index 100%
rename from product_standard_margin/__openerp__.py
rename to product_standard_margin/__manifest__.py
From 2b8be1f773a1cdb9730aed42613b116d385a913d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?=
Date: Fri, 15 Jun 2018 23:32:06 +0200
Subject: [PATCH 34/83] remove obsolete .pot files [ci skip]
---
.../i18n/product_standard_margin.pot | 44 -------------------
1 file changed, 44 deletions(-)
delete mode 100644 product_standard_margin/i18n/product_standard_margin.pot
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
deleted file mode 100644
index 264b76eda..000000000
--- a/product_standard_margin/i18n/product_standard_margin.pot
+++ /dev/null
@@ -1,44 +0,0 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * product_standard_margin
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: OpenERP Server 7.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-10-14 18:35+0000\n"
-"PO-Revision-Date: 2013-10-14 18:35+0000\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: product_standard_margin
-#: help:product.product,standard_margin_rate:0
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_product
-msgid "Product"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
-#: field:product.product,standard_margin_rate:0
-msgid "Theorical Margin (%)"
-msgstr ""
-
-#. module: product_standard_margin
-#: help:product.product,standard_margin:0
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
-#: field:product.product,standard_margin:0
-msgid "Theorical Margin"
-msgstr ""
-
From 7dc22e4a70bea474ec55a2ab8c2ff266653c21eb Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Tue, 7 Jan 2020 12:36:25 +0100
Subject: [PATCH 35/83] [REF] product_standard_margin: Black python code
---
product_standard_margin/__manifest__.py | 24 +++----
.../models/product_product.py | 66 ++++++++++++-------
2 files changed, 50 insertions(+), 40 deletions(-)
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 845100e4d..f1de21b6f 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -19,19 +19,13 @@
#
##############################################################################
{
- 'name': 'Product Margin and Margin Rate',
- 'version': '8.0.2.0.0',
- 'author': 'Camptocamp,GRAP,Odoo Community Association (OCA)',
- 'category': 'Product',
- 'depends': [
- 'product_replenishment_cost',
- 'account',
- ],
- 'website': 'http://www.camptocamp.com/',
- 'data': [
- 'data/decimal_precision.yml',
- 'views/view.xml',
- ],
- 'license': 'AGPL-3',
- 'installable': False,
+ "name": "Product Margin and Margin Rate",
+ "version": "8.0.2.0.0",
+ "author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
+ "category": "Product",
+ "depends": ["product_replenishment_cost", "account",],
+ "website": "http://www.camptocamp.com/",
+ "data": ["data/decimal_precision.yml", "views/view.xml",],
+ "license": "AGPL-3",
+ "installable": False,
}
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 6ddb14d3d..7a6a6f257 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -27,46 +27,62 @@
class ProductProduct(Model):
- _inherit = 'product.product'
+ _inherit = "product.product"
@api.multi
@api.depends(
- 'product_tmpl_id.list_price', 'replenishment_cost', 'taxes_id.type',
- 'taxes_id.price_include', 'taxes_id.amount',
- 'taxes_id.include_base_amount', 'taxes_id.child_depend')
+ "product_tmpl_id.list_price",
+ "replenishment_cost",
+ "taxes_id.type",
+ "taxes_id.price_include",
+ "taxes_id.amount",
+ "taxes_id.include_base_amount",
+ "taxes_id.child_depend",
+ )
def _get_margin(self):
for product in self:
product.list_price_vat_excl = product.taxes_id.compute_all(
- product.list_price, 1, product=product.id)['total']
+ product.list_price, 1, product=product.id
+ )["total"]
- product.standard_margin =\
+ product.standard_margin = (
product.list_price_vat_excl - product.replenishment_cost
+ )
if product.list_price_vat_excl == 0:
- product.standard_margin_rate = 999.
+ product.standard_margin_rate = 999.0
else:
product.standard_margin_rate = (
- (product.list_price_vat_excl
- - product.replenishment_cost) /
- product.list_price_vat_excl * 100)
+ (product.list_price_vat_excl - product.replenishment_cost)
+ / product.list_price_vat_excl
+ * 100
+ )
# Column Section
list_price_vat_excl = fields.Float(
- compute=_get_margin, string='Sale Price VAT Excluded', store=True,
- digits_compute=dp.get_precision('Product Price'),
- )
+ compute=_get_margin,
+ string="Sale Price VAT Excluded",
+ store=True,
+ digits_compute=dp.get_precision("Product Price"),
+ )
standard_margin = fields.Float(
- compute=_get_margin, string='Theorical Margin', store=True,
- digits_compute=dp.get_precision('Product Price'),
- help='Theorical Margin is [ sale price (Wo Tax) - cost price ] '
- 'of the product form (not based on historical values). '
- 'Take care of tax include and exclude. If no sale price, '
- 'the margin will be negativ.')
+ compute=_get_margin,
+ string="Theorical Margin",
+ store=True,
+ digits_compute=dp.get_precision("Product Price"),
+ help="Theorical Margin is [ sale price (Wo Tax) - cost price ] "
+ "of the product form (not based on historical values). "
+ "Take care of tax include and exclude. If no sale price, "
+ "the margin will be negativ.",
+ )
standard_margin_rate = fields.Float(
- compute=_get_margin, string='Theorical Margin (%)', store=True,
- digits_compute=dp.get_precision('Product Margin Precision'),
- help='Markup rate is [ Theorical Margin / sale price (Wo Tax) ] '
- 'of the product form (not based on historical values).'
- 'Take care of tax include and exclude.. If no sale price '
- 'set, will display 999.0')
+ compute=_get_margin,
+ string="Theorical Margin (%)",
+ store=True,
+ digits_compute=dp.get_precision("Product Margin Precision"),
+ help="Markup rate is [ Theorical Margin / sale price (Wo Tax) ] "
+ "of the product form (not based on historical values)."
+ "Take care of tax include and exclude.. If no sale price "
+ "set, will display 999.0",
+ )
From 53a00472a5fef3a940720be9c2169b38b3b8220f Mon Sep 17 00:00:00 2001
From: Sylvain LE GAL
Date: Tue, 7 Jan 2020 12:36:25 +0100
Subject: [PATCH 36/83] [MIG] product_standard_margin: Migration to 12.0 [IMP]
compute and display margin fields on template [REF] OCA Convention: readme
files, etc. [IMP] Add tests
---
product_standard_margin/__init__.py | 21 ----
product_standard_margin/__manifest__.py | 37 +++----
.../data/decimal_precision.yml | 24 -----
product_standard_margin/i18n/fr.po | 64 +++++------
product_standard_margin/models/__init__.py | 21 +---
.../models/product_product.py | 100 +++++++-----------
.../models/product_template.py | 67 ++++++++++++
.../readme/CONTRIBUTORS.rst | 4 +
.../readme/DESCRIPTION.rst | 17 +++
product_standard_margin/readme/ROADMAP.rst | 7 ++
.../static/description/product_form.png | Bin 0 -> 16078 bytes
product_standard_margin/tests/__init__.py | 1 +
product_standard_margin/tests/test_module.py | 57 ++++++++++
product_standard_margin/views/view.xml | 19 ----
.../views/view_product_product.xml | 32 ++++++
.../views/view_product_template.xml | 16 +++
16 files changed, 287 insertions(+), 200 deletions(-)
delete mode 100644 product_standard_margin/data/decimal_precision.yml
create mode 100644 product_standard_margin/models/product_template.py
create mode 100644 product_standard_margin/readme/CONTRIBUTORS.rst
create mode 100644 product_standard_margin/readme/DESCRIPTION.rst
create mode 100644 product_standard_margin/readme/ROADMAP.rst
create mode 100644 product_standard_margin/static/description/product_form.png
create mode 100644 product_standard_margin/tests/__init__.py
create mode 100644 product_standard_margin/tests/test_module.py
delete mode 100644 product_standard_margin/views/view.xml
create mode 100644 product_standard_margin/views/view_product_product.xml
create mode 100644 product_standard_margin/views/view_product_template.xml
diff --git a/product_standard_margin/__init__.py b/product_standard_margin/__init__.py
index cb1a1975c..0650744f6 100644
--- a/product_standard_margin/__init__.py
+++ b/product_standard_margin/__init__.py
@@ -1,22 +1 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
from . import models
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index f1de21b6f..6b59657dd 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -1,31 +1,18 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2012 - Today: Camptocamp SA
+# @author: Joel Grand-Guillaume
+# 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).
{
"name": "Product Margin and Margin Rate",
- "version": "8.0.2.0.0",
+ "version": "12.0.1.0.0",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
- "depends": ["product_replenishment_cost", "account",],
- "website": "http://www.camptocamp.com/",
- "data": ["data/decimal_precision.yml", "views/view.xml",],
+ "depends": ["account"],
+ "maintainers": ["legalsylvain"],
+ "website": "https://www.github.com/OCA/margin-analysis",
+ "data": ["views/view_product_product.xml", "views/view_product_template.xml"],
"license": "AGPL-3",
- "installable": False,
+ "installable": True,
+ "images": ["static/description/product_form.png"],
}
diff --git a/product_standard_margin/data/decimal_precision.yml b/product_standard_margin/data/decimal_precision.yml
deleted file mode 100644
index c96bcc573..000000000
--- a/product_standard_margin/data/decimal_precision.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
-# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-- !record {model: decimal.precision, id: product_margin_precision}:
- name: Product Margin Precision
- digits: 2
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index 228f7994f..c9b621929 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -1,57 +1,59 @@
-# Translation of OpenERP Server.
+# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
-"Project-Id-Version: OpenERP Server 7.0\n"
+"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-10-14 18:35+0000\n"
-"PO-Revision-Date: 2012-11-07 14:35+0000\n"
+"POT-Creation-Date: 2020-01-07 14:51+0000\n"
+"PO-Revision-Date: 2020-01-07 14:51+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
-"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: product_standard_margin
-#: help:product.product,standard_margin_rate:0
-msgid ""
-"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.. "
-"If no sale price set, will display 999.0"
-msgstr ""
-"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
-"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
-"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
-"taux sera de 999.0"
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr "Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du formulaire Produit] (ne tient pas compte de la facturation effective). Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le taux sera de 999.0"
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_product
msgid "Product"
-msgstr "Produit"
+msgstr "Article"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product Template"
+msgstr "Modèle d'article"
#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin_rate
-#: field:product.product,standard_margin_rate:0
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr "Prix de vente (HT)"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr "Marge Théorique"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
msgid "Theorical Margin (%)"
-msgstr "Marge Théorique (%)"
+msgstr "Taux de marque Théorique (%)"
#. module: product_standard_margin
-#: help:product.product,standard_margin:0
-msgid ""
-"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
-"(not based on historical values). Take care of tax include and exclude. If "
-"no sale price, the margin will be negativ."
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
msgstr ""
"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
"pas compte de la facturation effective). Ce taux tient compte des PV TTC "
"(TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product_standard_margin
-#: field:product.product,standard_margin:0
-msgid "Theorical Margin"
-msgstr "Marge Théorique"
diff --git a/product_standard_margin/models/__init__.py b/product_standard_margin/models/__init__.py
index 8d4366b62..18b37e853 100644
--- a/product_standard_margin/models/__init__.py
+++ b/product_standard_margin/models/__init__.py
@@ -1,21 +1,2 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Author: Joel Grand-Guillaume
-# Copyright 2012 Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
from . import product_product
+from . import product_template
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 7a6a6f257..3e74258f5 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -1,75 +1,29 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com)
-# All Right Reserved
-#
-# Author : Joel Grand-Guillaume
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
+# Copyright (C) 2012 - Today: Camptocamp SA
+# @author: Joel Grand-Guillaume
+# 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).
-from openerp import fields, api
-from openerp.models import Model
-import openerp.addons.decimal_precision as dp
+from odoo import api, fields, models
+import odoo.addons.decimal_precision as dp
-class ProductProduct(Model):
+class ProductProduct(models.Model):
_inherit = "product.product"
- @api.multi
- @api.depends(
- "product_tmpl_id.list_price",
- "replenishment_cost",
- "taxes_id.type",
- "taxes_id.price_include",
- "taxes_id.amount",
- "taxes_id.include_base_amount",
- "taxes_id.child_depend",
- )
- def _get_margin(self):
- for product in self:
- product.list_price_vat_excl = product.taxes_id.compute_all(
- product.list_price, 1, product=product.id
- )["total"]
-
- product.standard_margin = (
- product.list_price_vat_excl - product.replenishment_cost
- )
- if product.list_price_vat_excl == 0:
- product.standard_margin_rate = 999.0
- else:
- product.standard_margin_rate = (
- (product.list_price_vat_excl - product.replenishment_cost)
- / product.list_price_vat_excl
- * 100
- )
-
# Column Section
list_price_vat_excl = fields.Float(
- compute=_get_margin,
+ compute="_compute_margin",
string="Sale Price VAT Excluded",
store=True,
- digits_compute=dp.get_precision("Product Price"),
+ digits=dp.get_precision("Product Price"),
)
standard_margin = fields.Float(
- compute=_get_margin,
+ compute="_compute_margin",
string="Theorical Margin",
store=True,
- digits_compute=dp.get_precision("Product Price"),
+ digits=dp.get_precision("Product Price"),
help="Theorical Margin is [ sale price (Wo Tax) - cost price ] "
"of the product form (not based on historical values). "
"Take care of tax include and exclude. If no sale price, "
@@ -77,12 +31,38 @@ def _get_margin(self):
)
standard_margin_rate = fields.Float(
- compute=_get_margin,
+ compute="_compute_margin",
string="Theorical Margin (%)",
store=True,
- digits_compute=dp.get_precision("Product Margin Precision"),
+ digits=dp.get_precision("Product Price"),
help="Markup rate is [ Theorical Margin / sale price (Wo Tax) ] "
"of the product form (not based on historical values)."
"Take care of tax include and exclude.. If no sale price "
"set, will display 999.0",
)
+
+ # Compute Section
+ @api.depends(
+ "lst_price",
+ "product_tmpl_id.list_price",
+ "standard_price",
+ "taxes_id.price_include",
+ "taxes_id.amount",
+ "taxes_id.include_base_amount",
+ )
+ def _compute_margin(self):
+ for product in self:
+ product.list_price_vat_excl = product.taxes_id.compute_all(
+ product.lst_price, product=product
+ )["total_excluded"]
+ product.standard_margin = (
+ product.list_price_vat_excl - product.standard_price
+ )
+ if product.list_price_vat_excl == 0:
+ product.standard_margin_rate = 999.0
+ else:
+ product.standard_margin_rate = (
+ (product.list_price_vat_excl - product.standard_price)
+ / product.list_price_vat_excl
+ * 100
+ )
diff --git a/product_standard_margin/models/product_template.py b/product_standard_margin/models/product_template.py
new file mode 100644
index 000000000..19e1f2a1a
--- /dev/null
+++ b/product_standard_margin/models/product_template.py
@@ -0,0 +1,67 @@
+# Copyright (C) 2012 - Today: Camptocamp SA
+# @author: Joel Grand-Guillaume
+# 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).
+
+from odoo import api, fields, models
+import odoo.addons.decimal_precision as dp
+
+
+class ProductTemplate(models.Model):
+ _inherit = "product.template"
+
+ # Column Section
+ list_price_vat_excl = fields.Float(
+ compute="_compute_margin",
+ string="Sale Price VAT Excluded",
+ digits=dp.get_precision("Product Price"),
+ )
+
+ standard_margin = fields.Float(
+ compute="_compute_margin",
+ string="Theorical Margin",
+ digits=dp.get_precision("Product Price"),
+ help="Theorical Margin is [ sale price (Wo Tax) - cost price ] "
+ "of the product form (not based on historical values). "
+ "Take care of tax include and exclude. If no sale price, "
+ "the margin will be negativ.",
+ )
+
+ standard_margin_rate = fields.Float(
+ compute="_compute_margin",
+ string="Theorical Margin (%)",
+ digits=dp.get_precision("Product Price"),
+ help="Margin rate is [ Theorical Margin / sale price (Wo Tax) ] "
+ "of the product form (not based on historical values)."
+ "Take care of tax include and exclude.. If no sale price "
+ "set, will display 999.0",
+ )
+
+ # Compute Section
+ @api.depends(
+ "lst_price",
+ "standard_price",
+ "taxes_id.price_include",
+ "taxes_id.amount",
+ "taxes_id.include_base_amount",
+ )
+ def _compute_margin(self):
+ # The code is duplicated from product.product model
+ # because otherwise, the recomputation is not done correctly
+ # when the product datas are changed from the template view
+ for template in self:
+ template.list_price_vat_excl = template.taxes_id.compute_all(
+ template.list_price, product=template
+ )["total_excluded"]
+ template.standard_margin = (
+ template.list_price_vat_excl - template.standard_price
+ )
+ if template.list_price_vat_excl == 0:
+ template.standard_margin_rate = 999.0
+ else:
+ template.standard_margin_rate = (
+ (template.list_price_vat_excl - template.standard_price)
+ / template.list_price_vat_excl
+ * 100
+ )
diff --git a/product_standard_margin/readme/CONTRIBUTORS.rst b/product_standard_margin/readme/CONTRIBUTORS.rst
new file mode 100644
index 000000000..1e1d54b12
--- /dev/null
+++ b/product_standard_margin/readme/CONTRIBUTORS.rst
@@ -0,0 +1,4 @@
+* Alexandre Fayolle
+* Yannick Vaucher
+* Joël Grand-Guillaume
+* Sylvain Le Gal (https://twitter.com/legalsylvain)
diff --git a/product_standard_margin/readme/DESCRIPTION.rst b/product_standard_margin/readme/DESCRIPTION.rst
new file mode 100644
index 000000000..3698a5682
--- /dev/null
+++ b/product_standard_margin/readme/DESCRIPTION.rst
@@ -0,0 +1,17 @@
+Add a field on the product form that compute the standard (or theorical)
+margin based on the current values of sale and standard price present in
+the product form. We take care of taxe included or excluded.
+
+It will just compute it as follow:
+(Sale Price without tax - Standard Price) / Sale Price without tax
+
+.. figure:: ../static/description/product_form.png
+
+**Note:**
+
+As this module will base his simple computation on sale and cost prices,
+it suppose you have them both in the same currency (the price type must of
+the same currency for both of them). Remember this is the default OpenERP
+configuration (price type of all product price fields are set as the same as
+the company currency). We don't take care of it cause otherwise we should
+have added a dependency on sale module.
diff --git a/product_standard_margin/readme/ROADMAP.rst b/product_standard_margin/readme/ROADMAP.rst
new file mode 100644
index 000000000..c711b0f1b
--- /dev/null
+++ b/product_standard_margin/readme/ROADMAP.rst
@@ -0,0 +1,7 @@
+* This module will not work properly if used in a multicompany context with product
+ prices depending on the company.
+
+* It should be great to use the odoo widget ``percentpie`` for the display of the
+ field ``standard_margin_rate`` but for the time being, the field is not displayed
+ properly.
+ Ref of the Odoo Issue: https://github.com/odoo/odoo/issues/42869
diff --git a/product_standard_margin/static/description/product_form.png b/product_standard_margin/static/description/product_form.png
new file mode 100644
index 0000000000000000000000000000000000000000..bd8146a0daace0d58b50f73f97b6d48fe41d7b31
GIT binary patch
literal 16078
zcmcJ0WmH^Ew`L>3fGZ
z&fxSp$PbhlU8V>4Bfg8Iri+@rxr@7zlNrF>-JRLW&f3|;$ia-+-pL~KRDb{gAOpxs
zh<^6SI$rTt`0Sqd_O{n{5R;0`sX)PAGP?4O6(l}wMOomORQXpi%+^qC-7TBu>r{8~
zd-FaQ^0hDC42pqL$6uE1JEd$wZl%nE!mCiWLirfII~%GUyoKCy@gQ@t+(?QskolWSOL+`X`4BK`1OF2Zn6^
z|BFhldYv>xOj$P^@LE>^(Fh6>t2LsYaUb~~{!05Z5FW=hK7!J0j|9h}^9pE%U&@!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
zO-en|wu_OH|40TbRlEPF$d_$i{(e`Nh_Q)J*|{O9rnZ6u$`a)pmydA7u3%I0|G8CY*#E6d}f5tQgpzXIWFY-R-`&2!C|nen*uK%YSE`q}L7Bf(
z>pktQGy4bU({m@-QIU=*`&dPXO28`JJ-nL5&7G+hshYgU00i&n^BSAS8@zuvR%v5+t}{?rkYBkZ-;ERkOdD-~k@vWpM;*X3#ayo`Up
ykp1g^br{`$Tt+5G`qzCE(}@3>_upBbQCY{z-a*lN%Y*Nt17szYBr3!VgZ>AbhYhj-
literal 0
HcmV?d00001
diff --git a/product_standard_margin/tests/__init__.py b/product_standard_margin/tests/__init__.py
new file mode 100644
index 000000000..d9b96c4fa
--- /dev/null
+++ b/product_standard_margin/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_module
diff --git a/product_standard_margin/tests/test_module.py b/product_standard_margin/tests/test_module.py
new file mode 100644
index 000000000..af7d103e2
--- /dev/null
+++ b/product_standard_margin/tests/test_module.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2020 - 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).
+
+from odoo.tests.common import TransactionCase
+
+
+class TestModule(TransactionCase):
+
+ def setUp(self):
+ super().setUp()
+ self.ProductProduct = self.env['product.product']
+ self.ProductTemplate = self.env['product.template']
+
+ # Custom Section
+ def _create_product(self, model, standard_price, sale_price, sale_tax_ids):
+ if model == 'product':
+ ModelObj = self.ProductProduct
+ else:
+ ModelObj = self.ProductTemplate
+ return ModelObj.create({
+ 'name': 'Demo Product',
+ 'standard_price': standard_price,
+ 'lst_price': sale_price,
+ 'taxes_id': [(6, 0, sale_tax_ids)],
+ })
+
+ # Test Section
+ def test_01_classic_margin(self):
+ for model in ['product', 'template']:
+ product = self._create_product(model, 50, 200, [])
+ self.assertEqual(
+ product.standard_margin, 150,
+ "Incorrect Standard Margin")
+ self.assertEqual(
+ product.standard_margin_rate, 75.0,
+ "Incorrect Standard Margin Rate")
+
+ def test_02_margin_without_standard_price(self):
+ for model in ['product', 'template']:
+ product = self._create_product(model, 0, 200, [])
+ self.assertEqual(
+ product.standard_margin, 200,
+ "Incorrect Standard Margin (without standard price)")
+ self.assertEqual(
+ product.standard_margin_rate, 100.0,
+ "Incorrect Standard Margin Rate (without standard price)")
+
+ def test_03_margin_without_sale_price(self):
+ for model in ['product', 'template']:
+ product = self._create_product(model, 50, 0, [])
+ self.assertEqual(
+ product.standard_margin, -50,
+ "Incorrect Standard Margin (without sale price)")
+ self.assertEqual(
+ product.standard_margin_rate, 999.0,
+ "Incorrect Standard Margin Rate (without sale price)")
diff --git a/product_standard_margin/views/view.xml b/product_standard_margin/views/view.xml
deleted file mode 100644
index eaeba8280..000000000
--- a/product_standard_margin/views/view.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
- product.product
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
new file mode 100644
index 000000000..2e1df3e90
--- /dev/null
+++ b/product_standard_margin/views/view_product_product.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ product.product
+
+
+
+
+
+
+
+
+
+
+
+
+
+ product.product
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
new file mode 100644
index 000000000..da68bdd01
--- /dev/null
+++ b/product_standard_margin/views/view_product_template.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ product.template
+
+
+
+
+
+
+
+
+
From 03fa740a79e8162b54634aea32611a11d525f56a Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Sun, 19 Jul 2020 08:36:41 +0000
Subject: [PATCH 37/83] [UPD] Update product_standard_margin.pot
---
product_standard_margin/i18n/fr.po | 33 +++++++--
product_standard_margin/i18n/nl.po | 72 +++++++++++++------
.../i18n/product_standard_margin.pot | 59 +++++++++++++++
3 files changed, 136 insertions(+), 28 deletions(-)
create mode 100644 product_standard_margin/i18n/product_standard_margin.pot
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index c9b621929..b168fe40c 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
@@ -10,16 +10,36 @@ msgstr ""
"PO-Revision-Date: 2020-01-07 14:51+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: product_standard_margin
-#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
-msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
-msgstr "Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du formulaire Produit] (ne tient pas compte de la facturation effective). Ce taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le taux sera de 999.0"
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
+"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
+"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
+"taux sera de 999.0"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+#, fuzzy
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
+"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
+"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
+"taux sera de 999.0"
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_product
@@ -52,7 +72,10 @@ msgstr "Taux de marque Théorique (%)"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
msgstr ""
"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
"pas compte de la facturation effective). Ce taux tient compte des PV TTC "
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
index 554bdeb5a..0cc539b5b 100644
--- a/product_standard_margin/i18n/nl.po
+++ b/product_standard_margin/i18n/nl.po
@@ -11,6 +11,7 @@ msgstr ""
"Last-Translator: Erwin van der Ploeg | Endian Solutions "
"\n"
"Language-Team: \n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -18,17 +19,20 @@ msgstr ""
"X-Generator: Poedit 1.5.4\n"
#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_product
-msgid "Product"
-msgstr "Product"
-
-#. module: product_standard_margin
-#: field:product.product,standard_margin_rate:0
-msgid "Theorical Margin (%)"
-msgstr "Theoretische marge (%)"
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+#, fuzzy
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+"Theoretische marge (%) is [ Theoretische marge / Verkoopprijs (excl. BTW) ] "
+"van het product (niet gebaseerd op historische waardes). Het veld houdt "
+"rekening met prijzen incl. en excl. BTW. Indien geen verkooprijs is "
+"ingevoerd, wordt 999,0 weergegeven."
#. module: product_standard_margin
-#: help:product.product,standard_margin_rate:0
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
msgid ""
"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
"form (not based on historical values).Take care of tax include and exclude.. "
@@ -40,28 +44,50 @@ msgstr ""
"ingevoerd, wordt 999,0 weergegeven."
#. module: product_standard_margin
-#: constraint:product.product:0
-msgid "Error: Invalid ean code"
-msgstr "Fout: ongeldige ean code"
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr "Product"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+#, fuzzy
+msgid "Product Template"
+msgstr "Product"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr "Theoretische marge"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Theorical Margin (%)"
+msgstr "Theoretische marge (%)"
#. module: product_standard_margin
-#: help:product.product,standard_margin:0
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+#, fuzzy
msgid ""
"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
-"(not based on historical values).Take care of tax include and exclude. If no "
-"sale price, the margin will be negativ."
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
msgstr ""
"Theoretische marge is [ Verkoopprijs (excl. BTW) - Kostprijs) ] van het "
"product (niet gebaseerd op historische waardes). Het veld houdt rekening met "
"prijzen incl. en excl. BTW. Indien geen verkooprijs is ingevoerd, zal de "
"marge negatief zijn."
-#. module: product_standard_margin
-#: view:product.product:0
-msgid "Margin"
-msgstr "Marge"
+#~ msgid "Error: Invalid ean code"
+#~ msgstr "Fout: ongeldige ean code"
-#. module: product_standard_margin
-#: field:product.product,standard_margin:0
-msgid "Theorical Margin"
-msgstr "Theoretische marge"
+#~ msgid "Margin"
+#~ msgstr "Marge"
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
new file mode 100644
index 000000000..fdd3b6056
--- /dev/null
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -0,0 +1,59 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.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: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Theorical Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr ""
+
From 3fc46f2579e2051783942fd88ad35e2620333b49 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sun, 19 Jul 2020 08:47:38 +0000
Subject: [PATCH 38/83] [UPD] README.rst
---
product_standard_margin/README.rst | 108 +++--
.../static/description/index.html | 451 ++++++++++++++++++
2 files changed, 532 insertions(+), 27 deletions(-)
create mode 100644 product_standard_margin/static/description/index.html
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index abaf29e09..67f6efbd7 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -1,58 +1,112 @@
-.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
- :alt: License: AGPL-3
-
+==============================
Product Margin and Margin Rate
==============================
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! This file is generated by oca-gen-addon-readme !!
+ !! changes will be overwritten. !!
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
+ :target: https://odoo-community.org/page/development-status
+ :alt: Beta
+.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
+ :target: https://github.com/OCA/margin-analysis/tree/12.0/product_standard_margin
+ :alt: OCA/margin-analysis
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+ :target: https://translation.odoo-community.org/projects/margin-analysis-12-0/margin-analysis-12-0-product_standard_margin
+ :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+ :target: https://runbot.odoo-community.org/runbot/132/12.0
+ :alt: Try me on Runbot
+
+|badge1| |badge2| |badge3| |badge4| |badge5|
+
Add a field on the product form that compute the standard (or theorical)
-margin based on the current values of sale and replenishment cost present in
+margin based on the current values of sale and standard price present in
the product form. We take care of taxe included or excluded.
It will just compute it as follow:
-(Sale Price without tax - Replenishment Cost) / Sale Price without tax
+(Sale Price without tax - Standard Price) / Sale Price without tax
+
+.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/12.0/product_standard_margin/static/description/product_form.png
+
+**Note:**
+
+As this module will base his simple computation on sale and cost prices,
+it suppose you have them both in the same currency (the price type must of
+the same currency for both of them). Remember this is the default OpenERP
+configuration (price type of all product price fields are set as the same as
+the company currency). We don't take care of it cause otherwise we should
+have added a dependency on sale module.
+
+**Table of contents**
-Remember that this module can be used in conjonction with
-product_cost_incl_bom to have the replenishment cost computed from the BOM when
-a product has one.
+.. contents::
+ :local:
- WARNING:
+Known issues / Roadmap
+======================
- 1) As this module will base his simple computation on sale and cost prices,
- it suppose you have them both in the same currency (the price type must of
- the same currency for both of them). Remember this is the default OpenERP
- configuration (price type of all product price fields are set as the same as
- the company currency). We don't take care of it cause otherwise we should
- have added a dependency on sale module.
+* This module will not work properly if used in a multicompany context with product
+ prices depending on the company.
+
+* It should be great to use the odoo widget ``percentpie`` for the display of the
+ field ``standard_margin_rate`` but for the time being, the field is not displayed
+ properly.
+ Ref of the Odoo Issue: https://github.com/odoo/odoo/issues/42869
Bug Tracker
===========
-Bugs are tracked on `GitHub Issues `_.
+Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
-`here `_.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+`feedback `_.
+
+Do not contact contributors directly about support or help with technical issues.
Credits
=======
+Authors
+~~~~~~~
+
+* Camptocamp
+* GRAP
+
Contributors
-------------
+~~~~~~~~~~~~
* Alexandre Fayolle
* Yannick Vaucher
* Joël Grand-Guillaume
* Sylvain Le Gal (https://twitter.com/legalsylvain)
-Maintainer
-----------
-
-.. image:: http://odoo-community.org/logo.png
- :alt: Odoo Community Association
- :target: http://odoo-community.org
+Maintainers
+~~~~~~~~~~~
This module is maintained by the OCA.
-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.
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+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.
+
+.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
+ :target: https://github.com/legalsylvain
+ :alt: legalsylvain
+
+Current `maintainer `__:
+
+|maintainer-legalsylvain|
-To contribute to this module, please visit http://odoo-community.org.
+This module is part of the `OCA/margin-analysis `_ project on GitHub.
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
new file mode 100644
index 000000000..184d8d251
--- /dev/null
+++ b/product_standard_margin/static/description/index.html
@@ -0,0 +1,451 @@
+
+
+
+
+
+
+Product Margin and Margin Rate
+
+
+
+
+
Product Margin and Margin Rate
+
+
+

+
Add a field on the product form that compute the standard (or theorical)
+margin based on the current values of sale and standard price present in
+the product form. We take care of taxe included or excluded.
+
It will just compute it as follow:
+(Sale Price without tax - Standard Price) / Sale Price without tax
+
+
Note:
+
As this module will base his simple computation on sale and cost prices,
+it suppose you have them both in the same currency (the price type must of
+the same currency for both of them). Remember this is the default OpenERP
+configuration (price type of all product price fields are set as the same as
+the company currency). We don’t take care of it cause otherwise we should
+have added a dependency on sale module.
+
Table of contents
+
+
+
+
+- This module will not work properly if used in a multicompany context with product
+prices depending on the company.
+- It should be great to use the odoo widget percentpie for the display of the
+field standard_margin_rate but for the time being, the field is not displayed
+properly.
+Ref of the Odoo Issue: https://github.com/odoo/odoo/issues/42869
+
+
+
+
+
Bugs are tracked on GitHub Issues.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback.
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+
This module is maintained by the OCA.
+

+
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.
+
Current maintainer:
+

+
This module is part of the OCA/margin-analysis project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+
+
+
+
+
From d718ddcdfa3f73e5dd71a34841976b9a56bd26fb Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sun, 19 Jul 2020 08:47:39 +0000
Subject: [PATCH 39/83] [ADD] icon.png
---
.../static/description/icon.png | Bin 0 -> 9455 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 product_standard_margin/static/description/icon.png
diff --git a/product_standard_margin/static/description/icon.png b/product_standard_margin/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
literal 9455
zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~!
zVpnB`o+K7|Al`Q_U;eD$B
zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA
z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__
zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_
zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I
z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U
z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)(
z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH
zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW
z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx
zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h
zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9
zeKEe+b0{#KWGp$F+tga)0Rt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==4x{6EJwiPZ8zub-iXoUtkJiG{}
zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N
Xviia!U7SGha1wx#SCgwmn*{w2TRX*I
literal 0
HcmV?d00001
From a559e5961da1a8059eebd9abaf7ec76d4d1f6056 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Volksdorf?=
Date: Fri, 20 Nov 2020 18:15:00 +0000
Subject: [PATCH 40/83] Added translation using Weblate (German)
---
product_standard_margin/i18n/de.po | 59 ++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 product_standard_margin/i18n/de.po
diff --git a/product_standard_margin/i18n/de.po b/product_standard_margin/i18n/de.po
new file mode 100644
index 000000000..5fc7044b9
--- /dev/null
+++ b/product_standard_margin/i18n/de.po
@@ -0,0 +1,59 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: de\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: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Theorical Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr ""
From c3e0c4d30a174ee269f0f2661216fa216c436f9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Volksdorf?=
Date: Fri, 20 Nov 2020 18:16:40 +0000
Subject: [PATCH 41/83] Translated using Weblate (German)
Currently translated at 100.0% (8 of 8 strings)
Translation: margin-analysis-12.0/margin-analysis-12.0-product_standard_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-12-0/margin-analysis-12-0-product_standard_margin/de/
---
product_standard_margin/i18n/de.po | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/product_standard_margin/i18n/de.po b/product_standard_margin/i18n/de.po
index 5fc7044b9..1386c8ad9 100644
--- a/product_standard_margin/i18n/de.po
+++ b/product_standard_margin/i18n/de.po
@@ -6,54 +6,67 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2020-11-20 18:43+0000\n"
+"Last-Translator: André Volksdorf \n"
"Language-Team: none\n"
"Language: de\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"
+"X-Generator: Weblate 3.10\n"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
msgstr ""
+"Der Margensatz ist [ Theoretische Marge / Verkaufspreis (Ohne Steuern) ] des "
+"Produkts (nicht auf historischen Werten basierend), wobei darauf zu achten "
+"ist, Steuern ein- und auszuschließen. Wenn kein Verkaufspreis festgelegt "
+"wurde, wird 999.0 angezeigt"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
msgstr ""
+"Der Aufschlagssatz ist [ Theoretische Marge / Verkaufspreis (Ohne Steuern) ] "
+"des Produkts (nicht auf historischen Werten basierend), mit und ohne Steuer. "
+"Wenn kein Verkaufspreis festgelegt wurde, wird 999.0 angezeigt"
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_product
msgid "Product"
-msgstr ""
+msgstr "Produkt"
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_template
msgid "Product Template"
-msgstr ""
+msgstr "Produktvorlage"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
msgid "Sale Price VAT Excluded"
-msgstr ""
+msgstr "Verkaufspreis ohne Mehrwertsteuer"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
msgid "Theorical Margin"
-msgstr ""
+msgstr "Theoretische Marge"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
msgid "Theorical Margin (%)"
-msgstr ""
+msgstr "Theoretische Marge (%)"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
msgstr ""
+"Theoretische Gewinnmarge ist [ Verkaufspreis (Ohne Steuern) - Einkaufspreis ]"
+" des Produkts (nicht auf historischen Werten basierend). Achten Sie darauf, "
+"Steuern ein- und auszuschließen. Wenn kein Verkaufspreis angegeben wird, ist "
+"die Marge negativ."
From fc9ec800eebdf8ef39f3a789d9914ac7b0910812 Mon Sep 17 00:00:00 2001
From: Marcel Savegnago
Date: Sun, 14 Mar 2021 21:38:36 +0000
Subject: [PATCH 42/83] Added translation using Weblate (Portuguese (Brazil))
---
product_standard_margin/i18n/pt_BR.po | 59 +++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 product_standard_margin/i18n/pt_BR.po
diff --git a/product_standard_margin/i18n/pt_BR.po b/product_standard_margin/i18n/pt_BR.po
new file mode 100644
index 000000000..c8a043599
--- /dev/null
+++ b/product_standard_margin/i18n/pt_BR.po
@@ -0,0 +1,59 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: pt_BR\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: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Theorical Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr ""
From 86de51ee285be8961ccecbcf97e39d13932a9be5 Mon Sep 17 00:00:00 2001
From: alvarorib
Date: Mon, 12 Apr 2021 13:56:36 +0000
Subject: [PATCH 43/83] Added translation using Weblate (Portuguese)
---
product_standard_margin/i18n/pt.po | 59 ++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 product_standard_margin/i18n/pt.po
diff --git a/product_standard_margin/i18n/pt.po b/product_standard_margin/i18n/pt.po
new file mode 100644
index 000000000..5be85e4ea
--- /dev/null
+++ b/product_standard_margin/i18n/pt.po
@@ -0,0 +1,59 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: pt\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: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Theorical Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgstr ""
From 7a97c500a6d934a7bfd33ee0ea4fd9c1e5cd623e Mon Sep 17 00:00:00 2001
From: Cyril VINH-TUNG
Date: Wed, 15 Dec 2021 11:46:34 -1000
Subject: [PATCH 44/83] [IMP] product_standard_margin: black, isort, prettier
---
product_standard_margin/__manifest__.py | 2 +-
.../models/product_product.py | 1 +
.../models/product_template.py | 1 +
product_standard_margin/tests/test_module.py | 59 +++++++++++--------
.../views/view_product_product.xml | 19 +++---
.../views/view_product_template.xml | 20 +++++--
6 files changed, 61 insertions(+), 41 deletions(-)
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 6b59657dd..02c211f6d 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -10,7 +10,7 @@
"category": "Product",
"depends": ["account"],
"maintainers": ["legalsylvain"],
- "website": "https://www.github.com/OCA/margin-analysis",
+ "website": "https://github.com/OCA/margin-analysis",
"data": ["views/view_product_product.xml", "views/view_product_template.xml"],
"license": "AGPL-3",
"installable": True,
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 3e74258f5..5f3d52af7 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -5,6 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
+
import odoo.addons.decimal_precision as dp
diff --git a/product_standard_margin/models/product_template.py b/product_standard_margin/models/product_template.py
index 19e1f2a1a..8458feb98 100644
--- a/product_standard_margin/models/product_template.py
+++ b/product_standard_margin/models/product_template.py
@@ -5,6 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
+
import odoo.addons.decimal_precision as dp
diff --git a/product_standard_margin/tests/test_module.py b/product_standard_margin/tests/test_module.py
index af7d103e2..f628568bd 100644
--- a/product_standard_margin/tests/test_module.py
+++ b/product_standard_margin/tests/test_module.py
@@ -6,52 +6,59 @@
class TestModule(TransactionCase):
-
def setUp(self):
super().setUp()
- self.ProductProduct = self.env['product.product']
- self.ProductTemplate = self.env['product.template']
+ self.ProductProduct = self.env["product.product"]
+ self.ProductTemplate = self.env["product.template"]
# Custom Section
def _create_product(self, model, standard_price, sale_price, sale_tax_ids):
- if model == 'product':
+ if model == "product":
ModelObj = self.ProductProduct
else:
ModelObj = self.ProductTemplate
- return ModelObj.create({
- 'name': 'Demo Product',
- 'standard_price': standard_price,
- 'lst_price': sale_price,
- 'taxes_id': [(6, 0, sale_tax_ids)],
- })
+ return ModelObj.create(
+ {
+ "name": "Demo Product",
+ "standard_price": standard_price,
+ "lst_price": sale_price,
+ "taxes_id": [(6, 0, sale_tax_ids)],
+ }
+ )
# Test Section
def test_01_classic_margin(self):
- for model in ['product', 'template']:
+ for model in ["product", "template"]:
product = self._create_product(model, 50, 200, [])
+ self.assertEqual(product.standard_margin, 150, "Incorrect Standard Margin")
self.assertEqual(
- product.standard_margin, 150,
- "Incorrect Standard Margin")
- self.assertEqual(
- product.standard_margin_rate, 75.0,
- "Incorrect Standard Margin Rate")
+ product.standard_margin_rate, 75.0, "Incorrect Standard Margin Rate"
+ )
def test_02_margin_without_standard_price(self):
- for model in ['product', 'template']:
+ for model in ["product", "template"]:
product = self._create_product(model, 0, 200, [])
self.assertEqual(
- product.standard_margin, 200,
- "Incorrect Standard Margin (without standard price)")
+ product.standard_margin,
+ 200,
+ "Incorrect Standard Margin (without standard price)",
+ )
self.assertEqual(
- product.standard_margin_rate, 100.0,
- "Incorrect Standard Margin Rate (without standard price)")
+ product.standard_margin_rate,
+ 100.0,
+ "Incorrect Standard Margin Rate (without standard price)",
+ )
def test_03_margin_without_sale_price(self):
- for model in ['product', 'template']:
+ for model in ["product", "template"]:
product = self._create_product(model, 50, 0, [])
self.assertEqual(
- product.standard_margin, -50,
- "Incorrect Standard Margin (without sale price)")
+ product.standard_margin,
+ -50,
+ "Incorrect Standard Margin (without sale price)",
+ )
self.assertEqual(
- product.standard_margin_rate, 999.0,
- "Incorrect Standard Margin Rate (without sale price)")
+ product.standard_margin_rate,
+ 999.0,
+ "Incorrect Standard Margin Rate (without sale price)",
+ )
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 2e1df3e90..6126c826c 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -1,4 +1,4 @@
-
+
@@ -6,11 +6,14 @@
-
+
-
-
-
+
+
+
@@ -20,11 +23,11 @@
-
+
-
-
+
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
index da68bdd01..1dba3277f 100644
--- a/product_standard_margin/views/view_product_template.xml
+++ b/product_standard_margin/views/view_product_template.xml
@@ -1,15 +1,23 @@
-
+
product.template
-
-
-
+
+
+
From 5a38a353a91efcd7e69cd0cf4ee69a92a4322866 Mon Sep 17 00:00:00 2001
From: Cyril VINH-TUNG
Date: Wed, 15 Dec 2021 12:01:46 -1000
Subject: [PATCH 45/83] [MIG] product_standard_margin: Migration to 14.0
---
product_standard_margin/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 02c211f6d..700801ddc 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Margin and Margin Rate",
- "version": "12.0.1.0.0",
+ "version": "14.0.1.0.0",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
"depends": ["account"],
From 618b0ad998b07da6007fe13bba4f6e4053a2ba14 Mon Sep 17 00:00:00 2001
From: Cyril VINH-TUNG
Date: Wed, 15 Dec 2021 12:44:37 -1000
Subject: [PATCH 46/83] [IMP] Add margin fields in product tree views
---
.../views/view_product_product.xml | 10 ++++++++++
.../views/view_product_template.xml | 19 +++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 6126c826c..78cea78ae 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -32,4 +32,14 @@
+
+ product.product
+
+
+
+
+
+
+
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
index 1dba3277f..eb3ac7423 100644
--- a/product_standard_margin/views/view_product_template.xml
+++ b/product_standard_margin/views/view_product_template.xml
@@ -21,4 +21,23 @@
+
+ product.template
+
+
+
+
+
+
+
+
From 3b14975c0bbb978b8a33ef6f2c8ce0a82f497398 Mon Sep 17 00:00:00 2001
From: Cyril VINH-TUNG
Date: Wed, 15 Dec 2021 18:23:55 -1000
Subject: [PATCH 47/83] [IMP] Add percentpie widget for rate field
---
product_standard_margin/readme/ROADMAP.rst | 5 -----
product_standard_margin/views/view_product_product.xml | 4 ++--
product_standard_margin/views/view_product_template.xml | 1 +
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/product_standard_margin/readme/ROADMAP.rst b/product_standard_margin/readme/ROADMAP.rst
index c711b0f1b..354994f4a 100644
--- a/product_standard_margin/readme/ROADMAP.rst
+++ b/product_standard_margin/readme/ROADMAP.rst
@@ -1,7 +1,2 @@
* This module will not work properly if used in a multicompany context with product
prices depending on the company.
-
-* It should be great to use the odoo widget ``percentpie`` for the display of the
- field ``standard_margin_rate`` but for the time being, the field is not displayed
- properly.
- Ref of the Odoo Issue: https://github.com/odoo/odoo/issues/42869
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 78cea78ae..7521e805d 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -13,7 +13,7 @@
position="after"
>
-
+
@@ -27,7 +27,7 @@
-
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
index eb3ac7423..c2adbfc45 100644
--- a/product_standard_margin/views/view_product_template.xml
+++ b/product_standard_margin/views/view_product_template.xml
@@ -16,6 +16,7 @@
/>
From a59f42fce1e8eaf6f6bf0b146c39c983a3f768b5 Mon Sep 17 00:00:00 2001
From: Cyril VINH-TUNG
Date: Thu, 23 Dec 2021 09:52:15 -1000
Subject: [PATCH 48/83] [IMP] Add Markup Rate
---
product_standard_margin/i18n/fr.po | 63 ++++++++++++++-----
.../i18n/product_standard_margin.pot | 55 ++++++++++++++--
.../models/product_product.py | 18 ++++++
.../models/product_template.py | 17 +++++
.../readme/CONTRIBUTORS.rst | 1 +
.../readme/DESCRIPTION.rst | 9 ++-
.../views/view_product_product.xml | 3 +
.../views/view_product_template.xml | 10 +++
8 files changed, 153 insertions(+), 23 deletions(-)
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index b168fe40c..b3d9c8301 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -4,41 +4,70 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-01-07 14:51+0000\n"
-"PO-Revision-Date: 2020-01-07 14:51+0000\n"
-"Last-Translator: <>\n"
+"POT-Creation-Date: 2021-12-23 19:48+0000\n"
+"PO-Revision-Date: 2021-12-23 19:48+0000\n"
+"Last-Translator: \n"
"Language-Team: \n"
-"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
+msgid "Display Name"
+msgstr "Nom affiché"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
+msgid "ID"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
+msgid "Last Modified on"
+msgstr "Dernière modification le"
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.. "
-"If no sale price set, will display 999.0"
+"form (not based on historical values).Take care of tax include and exclude.."
+" If no sale price set, will display 999.0"
msgstr ""
"Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
"taux sera de 999.0"
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.."
+" If no cost price set, will display 999.0"
+msgstr ""
+"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / Coût unitaire du "
+"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
+"taux tient compte des PV TTC (TVA incluse). Si aucun coût n'a été saisi, le "
+"taux sera de 999.0"
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
-#, fuzzy
msgid ""
"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.. "
-"If no sale price set, will display 999.0"
+"form (not based on historical values).Take care of tax include and exclude.."
+" If no sale price set, will display 999.0"
msgstr ""
-"Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
+"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / Coût unitaire du "
"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
-"taux tient compte des PV TTC (TVA incluse). Si aucun PV n'a été saisi, le "
+"taux tient compte des PV TTC (TVA incluse). Si aucun coût n'a été saisi, le "
"taux sera de 999.0"
#. module: product_standard_margin
@@ -73,10 +102,16 @@ msgstr "Taux de marque Théorique (%)"
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
msgid ""
-"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
-"(not based on historical values). Take care of tax include and exclude. If "
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form"
+" (not based on historical values). Take care of tax include and exclude. If "
"no sale price, the margin will be negativ."
msgstr ""
"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
"pas compte de la facturation effective). Ce taux tient compte des PV TTC "
"(TVA incluse). Si aucun PV n'a été saisi, la marge sera négative."
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
+msgstr "Taux de marge Théorique (%)"
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
index fdd3b6056..b9358712d 100644
--- a/product_standard_margin/i18n/product_standard_margin.pot
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -1,26 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"POT-Creation-Date: 2021-12-23 19:48+0000\n"
+"PO-Revision-Date: 2021-12-23 19:48+0000\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: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
+msgid "ID"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
-msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.."
+" If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.."
+" If no cost price set, will display 999.0"
msgstr ""
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.."
+" If no sale price set, will display 999.0"
msgstr ""
#. module: product_standard_margin
@@ -54,6 +89,14 @@ msgstr ""
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form"
+" (not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
msgstr ""
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
+msgstr ""
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 5f3d52af7..4da7da4f9 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -41,6 +41,16 @@ class ProductProduct(models.Model):
"Take care of tax include and exclude.. If no sale price "
"set, will display 999.0",
)
+ standard_markup_rate = fields.Float(
+ compute="_compute_margin",
+ string="Theorical Markup (%)",
+ store=True,
+ digits=dp.get_precision("Product Price"),
+ help="Markup rate is [ Theorical Margin / cost price (Wo Tax) ] "
+ "of the product form (not based on historical values)."
+ "Take care of tax include and exclude.. If no cost price "
+ "set, will display 999.0",
+ )
# Compute Section
@api.depends(
@@ -67,3 +77,11 @@ def _compute_margin(self):
/ product.list_price_vat_excl
* 100
)
+ if product.standard_price == 0:
+ product.standard_markup_rate = 999.0
+ else:
+ product.standard_markup_rate = (
+ (product.list_price_vat_excl - product.standard_price)
+ / product.standard_price
+ * 100
+ )
diff --git a/product_standard_margin/models/product_template.py b/product_standard_margin/models/product_template.py
index 8458feb98..d45ff4036 100644
--- a/product_standard_margin/models/product_template.py
+++ b/product_standard_margin/models/product_template.py
@@ -38,6 +38,15 @@ class ProductTemplate(models.Model):
"Take care of tax include and exclude.. If no sale price "
"set, will display 999.0",
)
+ standard_markup_rate = fields.Float(
+ compute="_compute_margin",
+ string="Theorical Markup (%)",
+ digits=dp.get_precision("Product Price"),
+ help="Markup rate is [ Theorical Margin / cost price (Wo Tax) ] "
+ "of the product form (not based on historical values)."
+ "Take care of tax include and exclude.. If no cost price "
+ "set, will display 999.0",
+ )
# Compute Section
@api.depends(
@@ -66,3 +75,11 @@ def _compute_margin(self):
/ template.list_price_vat_excl
* 100
)
+ if template.standard_price == 0:
+ template.standard_markup_rate = 999.0
+ else:
+ template.standard_markup_rate = (
+ (template.list_price_vat_excl - template.standard_price)
+ / template.standard_price
+ * 100
+ )
diff --git a/product_standard_margin/readme/CONTRIBUTORS.rst b/product_standard_margin/readme/CONTRIBUTORS.rst
index 1e1d54b12..76e09f2ee 100644
--- a/product_standard_margin/readme/CONTRIBUTORS.rst
+++ b/product_standard_margin/readme/CONTRIBUTORS.rst
@@ -2,3 +2,4 @@
* Yannick Vaucher
* Joël Grand-Guillaume
* Sylvain Le Gal (https://twitter.com/legalsylvain)
+* Cyril Vinh-Tung
diff --git a/product_standard_margin/readme/DESCRIPTION.rst b/product_standard_margin/readme/DESCRIPTION.rst
index 3698a5682..f1db3a839 100644
--- a/product_standard_margin/readme/DESCRIPTION.rst
+++ b/product_standard_margin/readme/DESCRIPTION.rst
@@ -1,9 +1,12 @@
-Add a field on the product form that compute the standard (or theorical)
-margin based on the current values of sale and standard price present in
-the product form. We take care of taxe included or excluded.
+Add 2 fields on the product form that compute the standard (or theorical)
+margin and markup based on the current values of sale and standard price
+present in the product form. We take care of taxe included or excluded.
It will just compute it as follow:
+Margin :
(Sale Price without tax - Standard Price) / Sale Price without tax
+Markup :
+(Sale Price without tax - Standard Price) / Standard Price
.. figure:: ../static/description/product_form.png
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 7521e805d..8c7d865c7 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -14,6 +14,7 @@
>
+
@@ -28,6 +29,7 @@
+
@@ -39,6 +41,7 @@
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
index c2adbfc45..715e5c417 100644
--- a/product_standard_margin/views/view_product_template.xml
+++ b/product_standard_margin/views/view_product_template.xml
@@ -19,6 +19,11 @@
widget="percentpie"
attrs="{'invisible': [('product_variant_count', '>', 1)]}"
/>
+
@@ -38,6 +43,11 @@
attrs="{'invisible': [('product_variant_count', '>', 1)]}"
optional="hide"
/>
+
From 74409362e679561d74e6064d0c5cd63503f33dc5 Mon Sep 17 00:00:00 2001
From: oca-ci
Date: Thu, 16 Feb 2023 13:22:12 +0000
Subject: [PATCH 49/83] [UPD] Update product_standard_margin.pot
---
product_standard_margin/i18n/product_standard_margin.pot | 2 --
1 file changed, 2 deletions(-)
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
index b9358712d..0278558bd 100644
--- a/product_standard_margin/i18n/product_standard_margin.pot
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -6,8 +6,6 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-12-23 19:48+0000\n"
-"PO-Revision-Date: 2021-12-23 19:48+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
From feba17d7dc4e5e00e0300ac33f99800898cd6ece Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 16 Feb 2023 13:25:27 +0000
Subject: [PATCH 50/83] [UPD] README.rst
---
product_standard_margin/README.rst | 27 +++++++++----------
.../static/description/index.html | 24 ++++++++---------
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index 67f6efbd7..eca4cbeea 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -14,25 +14,28 @@ Product Margin and Margin Rate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
- :target: https://github.com/OCA/margin-analysis/tree/12.0/product_standard_margin
+ :target: https://github.com/OCA/margin-analysis/tree/14.0/product_standard_margin
:alt: OCA/margin-analysis
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/margin-analysis-12-0/margin-analysis-12-0-product_standard_margin
+ :target: https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-product_standard_margin
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/132/12.0
+ :target: https://runbot.odoo-community.org/runbot/132/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
-Add a field on the product form that compute the standard (or theorical)
-margin based on the current values of sale and standard price present in
-the product form. We take care of taxe included or excluded.
+Add 2 fields on the product form that compute the standard (or theorical)
+margin and markup based on the current values of sale and standard price
+present in the product form. We take care of taxe included or excluded.
It will just compute it as follow:
+Margin :
(Sale Price without tax - Standard Price) / Sale Price without tax
+Markup :
+(Sale Price without tax - Standard Price) / Standard Price
-.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/12.0/product_standard_margin/static/description/product_form.png
+.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/14.0/product_standard_margin/static/description/product_form.png
**Note:**
@@ -54,18 +57,13 @@ Known issues / Roadmap
* This module will not work properly if used in a multicompany context with product
prices depending on the company.
-* It should be great to use the odoo widget ``percentpie`` for the display of the
- field ``standard_margin_rate`` but for the time being, the field is not displayed
- properly.
- Ref of the Odoo Issue: https://github.com/odoo/odoo/issues/42869
-
Bug Tracker
===========
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -85,6 +83,7 @@ Contributors
* Yannick Vaucher
* Joël Grand-Guillaume
* Sylvain Le Gal (https://twitter.com/legalsylvain)
+* Cyril Vinh-Tung
Maintainers
~~~~~~~~~~~
@@ -107,6 +106,6 @@ Current `maintainer `__:
|maintainer-legalsylvain|
-This module is part of the `OCA/margin-analysis `_ project on GitHub.
+This module is part of the `OCA/margin-analysis `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
index 184d8d251..af76cded3 100644
--- a/product_standard_margin/static/description/index.html
+++ b/product_standard_margin/static/description/index.html
@@ -367,14 +367,17 @@ Product Margin and Margin Rate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

-Add a field on the product form that compute the standard (or theorical)
-margin based on the current values of sale and standard price present in
-the product form. We take care of taxe included or excluded.
+

+Add 2 fields on the product form that compute the standard (or theorical)
+margin and markup based on the current values of sale and standard price
+present in the product form. We take care of taxe included or excluded.
It will just compute it as follow:
-(Sale Price without tax - Standard Price) / Sale Price without tax
+Margin :
+(Sale Price without tax - Standard Price) / Sale Price without tax
+Markup :
+(Sale Price without tax - Standard Price) / Standard Price
Note:
As this module will base his simple computation on sale and cost prices,
@@ -401,10 +404,6 @@
- This module will not work properly if used in a multicompany context with product
prices depending on the company.
-- It should be great to use the odoo widget percentpie for the display of the
-field standard_margin_rate but for the time being, the field is not displayed
-properly.
-Ref of the Odoo Issue: https://github.com/odoo/odoo/issues/42869
@@ -412,7 +411,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+
feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -442,7 +442,7 @@
promote its widespread use.
Current maintainer:

-
This module is part of the OCA/margin-analysis project on GitHub.
+
This module is part of the OCA/margin-analysis project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
From aa331eb909e319c387f695a0c57a5dc9a4c7ca42 Mon Sep 17 00:00:00 2001
From: Weblate
Date: Thu, 16 Feb 2023 16:44:57 +0000
Subject: [PATCH 51/83] Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.
Translation: margin-analysis-14.0/margin-analysis-14.0-product_standard_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-product_standard_margin/
---
product_standard_margin/i18n/de.po | 58 +++++++++++++++++++++++----
product_standard_margin/i18n/fr.po | 17 ++++----
product_standard_margin/i18n/nl.po | 33 +++++++++++++++
product_standard_margin/i18n/pt.po | 50 +++++++++++++++++++++--
product_standard_margin/i18n/pt_BR.po | 50 +++++++++++++++++++++--
5 files changed, 184 insertions(+), 24 deletions(-)
diff --git a/product_standard_margin/i18n/de.po b/product_standard_margin/i18n/de.po
index 1386c8ad9..dd31fc926 100644
--- a/product_standard_margin/i18n/de.po
+++ b/product_standard_margin/i18n/de.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
@@ -16,18 +16,51 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
+msgid "ID"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
-msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
msgstr ""
"Der Margensatz ist [ Theoretische Marge / Verkaufspreis (Ohne Steuern) ] des "
"Produkts (nicht auf historischen Werten basierend), wobei darauf zu achten "
"ist, Steuern ein- und auszuschließen. Wenn kein Verkaufspreis festgelegt "
"wurde, wird 999.0 angezeigt"
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no cost price set, will display 999.0"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
msgstr ""
"Der Aufschlagssatz ist [ Theoretische Marge / Verkaufspreis (Ohne Steuern) ] "
"des Produkts (nicht auf historischen Werten basierend), mit und ohne Steuer. "
@@ -64,9 +97,18 @@ msgstr "Theoretische Marge (%)"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
+msgstr ""
+"Theoretische Gewinnmarge ist [ Verkaufspreis (Ohne Steuern) - "
+"Einkaufspreis ] des Produkts (nicht auf historischen Werten basierend). "
+"Achten Sie darauf, Steuern ein- und auszuschließen. Wenn kein Verkaufspreis "
+"angegeben wird, ist die Marge negativ."
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
msgstr ""
-"Theoretische Gewinnmarge ist [ Verkaufspreis (Ohne Steuern) - Einkaufspreis ]"
-" des Produkts (nicht auf historischen Werten basierend). Achten Sie darauf, "
-"Steuern ein- und auszuschließen. Wenn kein Verkaufspreis angegeben wird, ist "
-"die Marge negativ."
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index b3d9c8301..730ded356 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -10,6 +10,7 @@ msgstr ""
"PO-Revision-Date: 2021-12-23 19:48+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
@@ -37,8 +38,8 @@ msgstr "Dernière modification le"
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.."
-" If no sale price set, will display 999.0"
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
msgstr ""
"Taux de marque théorique [ (PV unitaire - Coût unitaire ) / PV unitaire du "
"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
@@ -50,8 +51,8 @@ msgstr ""
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
msgid ""
"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.."
-" If no cost price set, will display 999.0"
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no cost price set, will display 999.0"
msgstr ""
"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / Coût unitaire du "
"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
@@ -62,8 +63,8 @@ msgstr ""
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
msgid ""
"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.."
-" If no sale price set, will display 999.0"
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
msgstr ""
"Taux de marge théorique [ (PV unitaire - Coût unitaire ) / Coût unitaire du "
"formulaire Produit] (ne tient pas compte de la facturation effective). Ce "
@@ -102,8 +103,8 @@ msgstr "Taux de marque Théorique (%)"
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
msgid ""
-"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form"
-" (not based on historical values). Take care of tax include and exclude. If "
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
"no sale price, the margin will be negativ."
msgstr ""
"Marge théorique [ Vente unitaire HT - coût unitaire ] du produit (ne tient "
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
index 0cc539b5b..a964ef6bf 100644
--- a/product_standard_margin/i18n/nl.po
+++ b/product_standard_margin/i18n/nl.po
@@ -18,6 +18,24 @@ msgstr ""
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
+msgid "ID"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
#, fuzzy
@@ -31,6 +49,15 @@ msgstr ""
"rekening met prijzen incl. en excl. BTW. Indien geen verkooprijs is "
"ingevoerd, wordt 999,0 weergegeven."
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no cost price set, will display 999.0"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
msgid ""
@@ -86,6 +113,12 @@ msgstr ""
"prijzen incl. en excl. BTW. Indien geen verkooprijs is ingevoerd, zal de "
"marge negatief zijn."
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
+msgstr ""
+
#~ msgid "Error: Invalid ean code"
#~ msgstr "Fout: ongeldige ean code"
diff --git a/product_standard_margin/i18n/pt.po b/product_standard_margin/i18n/pt.po
index 5be85e4ea..4495883b4 100644
--- a/product_standard_margin/i18n/pt.po
+++ b/product_standard_margin/i18n/pt.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
@@ -14,14 +14,47 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
+msgid "ID"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
-msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no cost price set, will display 999.0"
msgstr ""
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
msgstr ""
#. module: product_standard_margin
@@ -55,5 +88,14 @@ msgstr ""
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
msgstr ""
diff --git a/product_standard_margin/i18n/pt_BR.po b/product_standard_margin/i18n/pt_BR.po
index c8a043599..d3c442b05 100644
--- a/product_standard_margin/i18n/pt_BR.po
+++ b/product_standard_margin/i18n/pt_BR.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * product_standard_margin
+# * product_standard_margin
#
msgid ""
msgstr ""
@@ -14,14 +14,47 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
+msgid "ID"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
-msgid "Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no cost price set, will display 999.0"
msgstr ""
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
-msgid "Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product form (not based on historical values).Take care of tax include and exclude.. If no sale price set, will display 999.0"
+msgid ""
+"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and exclude.. "
+"If no sale price set, will display 999.0"
msgstr ""
#. module: product_standard_margin
@@ -55,5 +88,14 @@ msgstr ""
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
-msgid "Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form (not based on historical values). Take care of tax include and exclude. If no sale price, the margin will be negativ."
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product form "
+"(not based on historical values). Take care of tax include and exclude. If "
+"no sale price, the margin will be negativ."
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
msgstr ""
From 2f1928c90d253d585650db2cecd3cd6341152adb Mon Sep 17 00:00:00 2001
From: Denis Leemann
Date: Fri, 17 Feb 2023 13:36:08 +0100
Subject: [PATCH 52/83] [MIG] product_standard_margin: Migration to 15.0
---
product_standard_margin/__manifest__.py | 2 +-
product_standard_margin/models/product_product.py | 4 ++--
product_standard_margin/models/product_template.py | 2 +-
product_standard_margin/tests/test_module.py | 11 ++++++-----
.../views/view_product_product.xml | 2 +-
5 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 700801ddc..b19305242 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Margin and Margin Rate",
- "version": "14.0.1.0.0",
+ "version": "15.0.1.0.0",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
"depends": ["account"],
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 4da7da4f9..43d77b151 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -54,7 +54,7 @@ class ProductProduct(models.Model):
# Compute Section
@api.depends(
- "lst_price",
+ "list_price",
"product_tmpl_id.list_price",
"standard_price",
"taxes_id.price_include",
@@ -64,7 +64,7 @@ class ProductProduct(models.Model):
def _compute_margin(self):
for product in self:
product.list_price_vat_excl = product.taxes_id.compute_all(
- product.lst_price, product=product
+ product.list_price, product=product
)["total_excluded"]
product.standard_margin = (
product.list_price_vat_excl - product.standard_price
diff --git a/product_standard_margin/models/product_template.py b/product_standard_margin/models/product_template.py
index d45ff4036..f0382201d 100644
--- a/product_standard_margin/models/product_template.py
+++ b/product_standard_margin/models/product_template.py
@@ -50,7 +50,7 @@ class ProductTemplate(models.Model):
# Compute Section
@api.depends(
- "lst_price",
+ "list_price",
"standard_price",
"taxes_id.price_include",
"taxes_id.amount",
diff --git a/product_standard_margin/tests/test_module.py b/product_standard_margin/tests/test_module.py
index f628568bd..ead2bed82 100644
--- a/product_standard_margin/tests/test_module.py
+++ b/product_standard_margin/tests/test_module.py
@@ -6,10 +6,11 @@
class TestModule(TransactionCase):
- def setUp(self):
- super().setUp()
- self.ProductProduct = self.env["product.product"]
- self.ProductTemplate = self.env["product.template"]
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.ProductProduct = cls.env["product.product"]
+ cls.ProductTemplate = cls.env["product.template"]
# Custom Section
def _create_product(self, model, standard_price, sale_price, sale_tax_ids):
@@ -21,7 +22,7 @@ def _create_product(self, model, standard_price, sale_price, sale_tax_ids):
{
"name": "Demo Product",
"standard_price": standard_price,
- "lst_price": sale_price,
+ "list_price": sale_price,
"taxes_id": [(6, 0, sale_tax_ids)],
}
)
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 8c7d865c7..1dd6b8991 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -5,7 +5,7 @@
product.product
-
+
Date: Mon, 20 Feb 2023 12:16:45 +0000
Subject: [PATCH 53/83] [UPD] Update product_standard_margin.pot
---
.../i18n/product_standard_margin.pot | 20 +------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
index 0278558bd..8c0b59d3a 100644
--- a/product_standard_margin/i18n/product_standard_margin.pot
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -13,24 +13,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
-msgid "ID"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
From 2fcc597cd228eb02618b624d3a37697a66ed1f59 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Mon, 20 Feb 2023 12:19:16 +0000
Subject: [PATCH 54/83] [UPD] README.rst
---
product_standard_margin/README.rst | 12 ++++++------
.../static/description/index.html | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index eca4cbeea..318b2bf6d 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -14,13 +14,13 @@ Product Margin and Margin Rate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
- :target: https://github.com/OCA/margin-analysis/tree/14.0/product_standard_margin
+ :target: https://github.com/OCA/margin-analysis/tree/15.0/product_standard_margin
:alt: OCA/margin-analysis
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-product_standard_margin
+ :target: https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-product_standard_margin
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/132/14.0
+ :target: https://runbot.odoo-community.org/runbot/132/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -35,7 +35,7 @@ Margin :
Markup :
(Sale Price without tax - Standard Price) / Standard Price
-.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/14.0/product_standard_margin/static/description/product_form.png
+.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/15.0/product_standard_margin/static/description/product_form.png
**Note:**
@@ -63,7 +63,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -106,6 +106,6 @@ Current `maintainer `__:
|maintainer-legalsylvain|
-This module is part of the `OCA/margin-analysis `_ project on GitHub.
+This module is part of the `OCA/margin-analysis `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
index af76cded3..18c509a6d 100644
--- a/product_standard_margin/static/description/index.html
+++ b/product_standard_margin/static/description/index.html
@@ -367,7 +367,7 @@ Product Margin and Margin Rate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

Add 2 fields on the product form that compute the standard (or theorical)
margin and markup based on the current values of sale and standard price
present in the product form. We take care of taxe included or excluded.
@@ -377,7 +377,7 @@ Product Margin and Margin Rate
Markup :
(Sale Price without tax - Standard Price) / Standard Price
Note:
As this module will base his simple computation on sale and cost prices,
@@ -411,7 +411,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
From 6912c05b2b2c02d0380f78cc73cd157abe4629c9 Mon Sep 17 00:00:00 2001
From: Weblate
Date: Mon, 20 Feb 2023 16:07:59 +0000
Subject: [PATCH 55/83] Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.
Translation: margin-analysis-15.0/margin-analysis-15.0-product_standard_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-product_standard_margin/
---
product_standard_margin/i18n/de.po | 18 ------------------
product_standard_margin/i18n/fr.po | 24 ++++++------------------
product_standard_margin/i18n/nl.po | 18 ------------------
product_standard_margin/i18n/pt.po | 18 ------------------
product_standard_margin/i18n/pt_BR.po | 18 ------------------
5 files changed, 6 insertions(+), 90 deletions(-)
diff --git a/product_standard_margin/i18n/de.po b/product_standard_margin/i18n/de.po
index dd31fc926..f2fb147fa 100644
--- a/product_standard_margin/i18n/de.po
+++ b/product_standard_margin/i18n/de.po
@@ -16,24 +16,6 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
-msgid "ID"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
diff --git a/product_standard_margin/i18n/fr.po b/product_standard_margin/i18n/fr.po
index 730ded356..9072079c9 100644
--- a/product_standard_margin/i18n/fr.po
+++ b/product_standard_margin/i18n/fr.po
@@ -16,24 +16,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
-msgid "Display Name"
-msgstr "Nom affiché"
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
-msgid "ID"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
-msgid "Last Modified on"
-msgstr "Dernière modification le"
-
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
@@ -116,3 +98,9 @@ msgstr ""
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
msgid "Theorical Markup (%)"
msgstr "Taux de marge Théorique (%)"
+
+#~ msgid "Display Name"
+#~ msgstr "Nom affiché"
+
+#~ msgid "Last Modified on"
+#~ msgstr "Dernière modification le"
diff --git a/product_standard_margin/i18n/nl.po b/product_standard_margin/i18n/nl.po
index a964ef6bf..44f1000a2 100644
--- a/product_standard_margin/i18n/nl.po
+++ b/product_standard_margin/i18n/nl.po
@@ -18,24 +18,6 @@ msgstr ""
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
-msgid "ID"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
#, fuzzy
diff --git a/product_standard_margin/i18n/pt.po b/product_standard_margin/i18n/pt.po
index 4495883b4..12a51a785 100644
--- a/product_standard_margin/i18n/pt.po
+++ b/product_standard_margin/i18n/pt.po
@@ -14,24 +14,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
-msgid "ID"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
diff --git a/product_standard_margin/i18n/pt_BR.po b/product_standard_margin/i18n/pt_BR.po
index d3c442b05..a6f8876e6 100644
--- a/product_standard_margin/i18n/pt_BR.po
+++ b/product_standard_margin/i18n/pt_BR.po
@@ -14,24 +14,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__display_name
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__id
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__id
-msgid "ID"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_product____last_update
-#: model:ir.model.fields,field_description:product_standard_margin.field_product_template____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
From 84e3c46d8eda6bb5827e3c723e3e10282fd04920 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro?=
Date: Mon, 5 Jun 2023 11:32:09 +0200
Subject: [PATCH 56/83] [MIG] product_standard_margin: Migration to 16.0
---
product_standard_margin/__manifest__.py | 2 +-
product_standard_margin/i18n/es.po | 91 +++++++++++++++++++
.../models/product_product.py | 12 +--
.../models/product_template.py | 10 +-
4 files changed, 101 insertions(+), 14 deletions(-)
create mode 100644 product_standard_margin/i18n/es.po
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index b19305242..0c63670f7 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Margin and Margin Rate",
- "version": "15.0.1.0.0",
+ "version": "16.0.1.0.0",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
"depends": ["account"],
diff --git a/product_standard_margin/i18n/es.po b/product_standard_margin/i18n/es.po
new file mode 100644
index 000000000..0e1b1ebc6
--- /dev/null
+++ b/product_standard_margin/i18n/es.po
@@ -0,0 +1,91 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2023-06-05 09:26+0000\n"
+"PO-Revision-Date: 2023-06-05 11:27+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"Language: es\n"
+"X-Generator: Poedit 2.0.6\n"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid ""
+"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and "
+"exclude.. If no sale price set, will display 999.0"
+msgstr ""
+"La tasa de margen es [ Margen teórico / precio de venta (sin impuestos) ] "
+"de la ficha del producto (no basado en valores históricos). Tenga cuidado "
+"de impuestos incluidos y excluidos. Si no hay precio de venta establecido "
+"mostrará 999.0"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Theorical Margin / cost price (Wo Tax) ] of the product "
+"form (not based on historical values).Take care of tax include and "
+"exclude.. If no cost price set, will display 999.0"
+msgstr ""
+"La tasa de Markup es [ Margen teórico / precio de coste (sin impuestos) ] "
+"de la ficha del producto (no basado en valores históricos). Tenga cuidado "
+"de impuestos incluidos y excluidos. Si no hay precio de coste establecido "
+"mostrará 999.0"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product"
+msgstr "Producto"
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product Variant"
+msgstr "Variante de producto"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr "Precio de venta sin impuestos"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Theorical Margin"
+msgstr "Margen teórico"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Theorical Margin (%)"
+msgstr "Margen teórico (%)"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid ""
+"Theorical Margin is [ sale price (Wo Tax) - cost price ] of the product "
+"form (not based on historical values). Take care of tax include and "
+"exclude. If no sale price, the margin will be negativ."
+msgstr ""
+"El margen teórico es [ precio de venta (sin impuestos) - precio de coste ] "
+"de la ficha del producto (no basado en valores históricos). Tenga cuidado "
+"de impuestos incluidos y excluidos. Si no hay precio de venta el margen "
+"será negativo."
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Theorical Markup (%)"
+msgstr "Markup teórico (%)"
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index 43d77b151..1ad77b301 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -6,8 +6,6 @@
from odoo import api, fields, models
-import odoo.addons.decimal_precision as dp
-
class ProductProduct(models.Model):
_inherit = "product.product"
@@ -17,14 +15,14 @@ class ProductProduct(models.Model):
compute="_compute_margin",
string="Sale Price VAT Excluded",
store=True,
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
)
standard_margin = fields.Float(
compute="_compute_margin",
string="Theorical Margin",
store=True,
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
help="Theorical Margin is [ sale price (Wo Tax) - cost price ] "
"of the product form (not based on historical values). "
"Take care of tax include and exclude. If no sale price, "
@@ -35,8 +33,8 @@ class ProductProduct(models.Model):
compute="_compute_margin",
string="Theorical Margin (%)",
store=True,
- digits=dp.get_precision("Product Price"),
- help="Markup rate is [ Theorical Margin / sale price (Wo Tax) ] "
+ digits="Product Price",
+ help="Margin rate is [ Theorical Margin / sale price (Wo Tax) ] "
"of the product form (not based on historical values)."
"Take care of tax include and exclude.. If no sale price "
"set, will display 999.0",
@@ -45,7 +43,7 @@ class ProductProduct(models.Model):
compute="_compute_margin",
string="Theorical Markup (%)",
store=True,
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
help="Markup rate is [ Theorical Margin / cost price (Wo Tax) ] "
"of the product form (not based on historical values)."
"Take care of tax include and exclude.. If no cost price "
diff --git a/product_standard_margin/models/product_template.py b/product_standard_margin/models/product_template.py
index f0382201d..658b1ce34 100644
--- a/product_standard_margin/models/product_template.py
+++ b/product_standard_margin/models/product_template.py
@@ -6,8 +6,6 @@
from odoo import api, fields, models
-import odoo.addons.decimal_precision as dp
-
class ProductTemplate(models.Model):
_inherit = "product.template"
@@ -16,13 +14,13 @@ class ProductTemplate(models.Model):
list_price_vat_excl = fields.Float(
compute="_compute_margin",
string="Sale Price VAT Excluded",
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
)
standard_margin = fields.Float(
compute="_compute_margin",
string="Theorical Margin",
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
help="Theorical Margin is [ sale price (Wo Tax) - cost price ] "
"of the product form (not based on historical values). "
"Take care of tax include and exclude. If no sale price, "
@@ -32,7 +30,7 @@ class ProductTemplate(models.Model):
standard_margin_rate = fields.Float(
compute="_compute_margin",
string="Theorical Margin (%)",
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
help="Margin rate is [ Theorical Margin / sale price (Wo Tax) ] "
"of the product form (not based on historical values)."
"Take care of tax include and exclude.. If no sale price "
@@ -41,7 +39,7 @@ class ProductTemplate(models.Model):
standard_markup_rate = fields.Float(
compute="_compute_margin",
string="Theorical Markup (%)",
- digits=dp.get_precision("Product Price"),
+ digits="Product Price",
help="Markup rate is [ Theorical Margin / cost price (Wo Tax) ] "
"of the product form (not based on historical values)."
"Take care of tax include and exclude.. If no cost price "
From f61537110378eb17c3d9bdf7838e1a8ec79c461b Mon Sep 17 00:00:00 2001
From: oca-ci
Date: Wed, 21 Jun 2023 15:15:23 +0000
Subject: [PATCH 57/83] [UPD] Update product_standard_margin.pot
---
.../i18n/product_standard_margin.pot | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/product_standard_margin/i18n/product_standard_margin.pot b/product_standard_margin/i18n/product_standard_margin.pot
index 8c0b59d3a..25a492dce 100644
--- a/product_standard_margin/i18n/product_standard_margin.pot
+++ b/product_standard_margin/i18n/product_standard_margin.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 15.0\n"
+"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -14,6 +14,7 @@ msgstr ""
"Plural-Forms: \n"
#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
msgid ""
"Margin rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
@@ -31,21 +32,13 @@ msgid ""
msgstr ""
#. module: product_standard_margin
-#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
-msgid ""
-"Markup rate is [ Theorical Margin / sale price (Wo Tax) ] of the product "
-"form (not based on historical values).Take care of tax include and exclude.."
-" If no sale price set, will display 999.0"
-msgstr ""
-
-#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_product
+#: model:ir.model,name:product_standard_margin.model_product_template
msgid "Product"
msgstr ""
#. module: product_standard_margin
-#: model:ir.model,name:product_standard_margin.model_product_template
-msgid "Product Template"
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product Variant"
msgstr ""
#. module: product_standard_margin
From 2958a80a59a151eb1f93c877ec8062e240b8e3f5 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Wed, 21 Jun 2023 15:18:28 +0000
Subject: [PATCH 58/83] [UPD] README.rst
---
product_standard_margin/README.rst | 12 ++++++------
.../static/description/index.html | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index 318b2bf6d..44d3b45e8 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -14,13 +14,13 @@ Product Margin and Margin Rate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
- :target: https://github.com/OCA/margin-analysis/tree/15.0/product_standard_margin
+ :target: https://github.com/OCA/margin-analysis/tree/16.0/product_standard_margin
:alt: OCA/margin-analysis
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-product_standard_margin
+ :target: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-product_standard_margin
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/132/15.0
+ :target: https://runbot.odoo-community.org/runbot/132/16.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -35,7 +35,7 @@ Margin :
Markup :
(Sale Price without tax - Standard Price) / Standard Price
-.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/15.0/product_standard_margin/static/description/product_form.png
+.. figure:: https://raw.githubusercontent.com/OCA/margin-analysis/16.0/product_standard_margin/static/description/product_form.png
**Note:**
@@ -63,7 +63,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -106,6 +106,6 @@ Current `maintainer `__:
|maintainer-legalsylvain|
-This module is part of the `OCA/margin-analysis `_ project on GitHub.
+This module is part of the `OCA/margin-analysis `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
index 18c509a6d..5f11a2151 100644
--- a/product_standard_margin/static/description/index.html
+++ b/product_standard_margin/static/description/index.html
@@ -367,7 +367,7 @@ Product Margin and Margin Rate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

Add 2 fields on the product form that compute the standard (or theorical)
margin and markup based on the current values of sale and standard price
present in the product form. We take care of taxe included or excluded.
@@ -377,7 +377,7 @@ Product Margin and Margin Rate
Markup :
(Sale Price without tax - Standard Price) / Standard Price
Note:
As this module will base his simple computation on sale and cost prices,
@@ -411,7 +411,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
From 86b44ded409d3e89c0c309a1cb73de249cf1c038 Mon Sep 17 00:00:00 2001
From: Hugo
Date: Mon, 24 Jul 2023 11:30:04 +0200
Subject: [PATCH 59/83] [FIX] product_standard_margin
---
product_standard_margin/views/view_product_product.xml | 8 ++++----
product_standard_margin/views/view_product_template.xml | 2 --
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 1dd6b8991..6e7fa19bc 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -13,8 +13,8 @@
position="after"
>
-
-
+
+
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
index 715e5c417..e86f6d63b 100644
--- a/product_standard_margin/views/view_product_template.xml
+++ b/product_standard_margin/views/view_product_template.xml
@@ -16,12 +16,10 @@
/>
From 5c2c4946d17eb700b69d26e23652a19709e6d643 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Mon, 24 Jul 2023 12:24:25 +0000
Subject: [PATCH 60/83] product_standard_margin 16.0.1.0.1
---
product_standard_margin/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 0c63670f7..53e3d3da6 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Margin and Margin Rate",
- "version": "16.0.1.0.0",
+ "version": "16.0.1.0.1",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
"depends": ["account"],
From 8e953cb91b7a917076c3fbaa9799006e79c40a0f Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sun, 3 Sep 2023 14:37:30 +0000
Subject: [PATCH 61/83] [UPD] README.rst
---
product_standard_margin/README.rst | 15 ++++---
.../static/description/index.html | 40 ++++++++++---------
2 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index 44d3b45e8..826b2b6a4 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -2,10 +2,13 @@
Product Margin and Margin Rate
==============================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:596f5e3407803f321b8176d8a58bd820d13dcab26d4fa2fd4060b458399f0549
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ Product Margin and Margin Rate
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-product_standard_margin
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/132/16.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=16.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
Add 2 fields on the product form that compute the standard (or theorical)
margin and markup based on the current values of sale and standard price
@@ -62,7 +65,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed
+If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
index 5f11a2151..7d2edc6c9 100644
--- a/product_standard_margin/static/description/index.html
+++ b/product_standard_margin/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
Product Margin and Margin Rate
-
-
Product Margin and Margin Rate
+
+
+
+
+
+
-
+
- This module will not work properly if used in a multicompany context
with product prices depending on the company.
-
+
Bugs are tracked on GitHub 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
@@ -414,16 +419,16 @@
Do not contact contributors directly about support or help with technical issues.
+
From c1e6cda915e19c6d1480b50221d4bb68c922e3d2 Mon Sep 17 00:00:00 2001
From: Cyril VINH-TUNG
Date: Mon, 20 Oct 2025 12:56:03 -1000
Subject: [PATCH 79/83] [IMP] Reintroducing percentpie widget for rate fields
as it works well in v18
---
.../static/description/product_form.png | Bin 16078 -> 14311 bytes
.../views/view_product_product.xml | 8 ++++----
.../views/view_product_template.xml | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/product_standard_margin/static/description/product_form.png b/product_standard_margin/static/description/product_form.png
index bd8146a0daace0d58b50f73f97b6d48fe41d7b31..377761d7f03cebdcc8d5874219361b4c371065c1 100644
GIT binary patch
literal 14311
zcmcJWbySq^yY2@S5fMR9uKyPHwzmTr*l?nY9&ySuvw81}>OyU$){
zoqg6`YoD_=e*n&m%sbEfKKFfHpZj|KWu-+?pW{D=Kp?1MpM~Th5Cl2!d;7De;5$Vg
z#>0;%wgO^`&%l@4vu}Rj-*|SyU+fet4eT6sZ1f?97MAAv^tO67`uY~OMwWJmkDK|x
zi>Mx6Bxs|rV`pq>@kY_uTpwbhZ_n_Ch4qc4o*nqf#KQK5iJhB?m79qTb52PB0(k=w
z6Z)j+l(;|dsQ6lipzHXM;q#&2lw8Ji$q#ymbbox)g3?J`*Y_6-u0i;{3AlQP0b)Uo
z)wpu6QD|ts$Wqgos|t*=15a9;XwPy~$*|Wv|FYq3S2R!;v67j<7|?gMovS9L;)y*7b2r2J88%u!m~{~#(ok}fk4
zr}Hc<&WyyLn9C&yMlzY{I>}IHp6tncbaImM@yBhQx$DKg;eH+JlP8I79hpqL^^WPP
zqn&XVwFdhx$^~j|cSvYfj<$MNLw^(t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(}@3>_upBbQCY{z-a*lN%Y*Nt17szYBr3!VgZ>AbhYhj-
diff --git a/product_standard_margin/views/view_product_product.xml b/product_standard_margin/views/view_product_product.xml
index 595ecfc28..fee59528c 100644
--- a/product_standard_margin/views/view_product_product.xml
+++ b/product_standard_margin/views/view_product_product.xml
@@ -12,8 +12,8 @@
position="after"
>
-
-
+
+
@@ -27,8 +27,8 @@
-
-
+
+
diff --git a/product_standard_margin/views/view_product_template.xml b/product_standard_margin/views/view_product_template.xml
index 96f2e0d00..9c2596845 100644
--- a/product_standard_margin/views/view_product_template.xml
+++ b/product_standard_margin/views/view_product_template.xml
@@ -15,10 +15,12 @@
/>
From 275261b3190eb18f55614c3ee7ee66e1105c01c2 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 23 Oct 2025 19:34:12 +0000
Subject: [PATCH 80/83] [BOT] post-merge updates
---
product_standard_margin/README.rst | 2 +-
product_standard_margin/__manifest__.py | 2 +-
product_standard_margin/static/description/index.html | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index 23a54aab8..f67ad26b5 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -11,7 +11,7 @@ Product Margin and Margin Rate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:9e5849b385f8af35fd8e3a9c3b9bbfbd2dc956098b1e72514b9cc7296b1c872b
+ !! source digest: sha256:b84c7634a4ed13a1e2decdd6db69ba64e6d194fd21e90aaa9b0a9bd3d5046d15
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 30c937f8d..2b9ffdc97 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Margin and Margin Rate",
- "version": "18.0.1.0.0",
+ "version": "18.0.1.1.0",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
"depends": ["account"],
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
index 1c7066c8b..a86539f70 100644
--- a/product_standard_margin/static/description/index.html
+++ b/product_standard_margin/static/description/index.html
@@ -372,7 +372,7 @@ Product Margin and Margin Rate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:9e5849b385f8af35fd8e3a9c3b9bbfbd2dc956098b1e72514b9cc7296b1c872b
+!! source digest: sha256:b84c7634a4ed13a1e2decdd6db69ba64e6d194fd21e90aaa9b0a9bd3d5046d15
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Add 2 fields on the product form that compute the standard (or
From 164884496e2eb11f8d09430a84ff492577e70f28 Mon Sep 17 00:00:00 2001
From: Vasil Stoev
Date: Wed, 3 Dec 2025 09:03:14 +0000
Subject: [PATCH 81/83] Translated using Weblate (German)
Currently translated at 100.0% (9 of 9 strings)
Translation: margin-analysis-18.0/margin-analysis-18.0-product_standard_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-18-0/margin-analysis-18-0-product_standard_margin/de/
---
product_standard_margin/i18n/de.po | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/product_standard_margin/i18n/de.po b/product_standard_margin/i18n/de.po
index f30879975..212969d78 100644
--- a/product_standard_margin/i18n/de.po
+++ b/product_standard_margin/i18n/de.po
@@ -6,27 +6,27 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2020-11-20 18:43+0000\n"
-"Last-Translator: André Volksdorf \n"
+"PO-Revision-Date: 2025-12-03 11:17+0000\n"
+"Last-Translator: Vasil Stoev \n"
"Language-Team: none\n"
"Language: de\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"
-"X-Generator: Weblate 3.10\n"
+"X-Generator: Weblate 5.10.4\n"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
msgid "Margin"
-msgstr ""
+msgstr "Marge"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
msgid "Margin (%)"
-msgstr ""
+msgstr "Marge (%)"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
@@ -36,6 +36,10 @@ msgid ""
"based on historical values). Take care of tax include and exclude. If no "
"sale price, the margin will be negativ."
msgstr ""
+"Die Marge ist [ Verkaufspreis (exkl. Steuern) - Kosten ] des "
+"Produktformulars (nicht basierend auf historischen Werten). Beachten Sie "
+"inkludierte und exkludierte Steuern. Wenn kein Verkaufspreis vorhanden ist, "
+"wird die Marge negativ sein."
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
@@ -45,12 +49,16 @@ msgid ""
"based on historical values).Take care of tax include and exclude.. If no "
"sale price set, will display 999.0"
msgstr ""
+"Die Margenrate ist [ Marge / Verkaufspreis (exkl. Steuern) ] des "
+"Produktformulars (nicht basierend auf historischen Werten). Beachten Sie "
+"inkludierte und exkludierte Steuern. Wenn kein Verkaufspreis festgelegt ist, "
+"wird 999.0 angezeigt"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
msgid "Markup (%)"
-msgstr ""
+msgstr "Aufschlag (%)"
#. module: product_standard_margin
#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
@@ -60,6 +68,10 @@ msgid ""
"based on historical values).Take care of tax include and exclude.. If no "
"cost price set, will display 999.0"
msgstr ""
+"Die Aufschlagsrate ist [ Marge / Kosten (exkl. Steuern) ] des "
+"Produktformulars (nicht basierend auf historischen Werten). Beachten Sie "
+"inkludierte und exkludierte Steuern. Wenn keine Kosten festgelegt sind, wird "
+"999.0 angezeigt"
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_template
@@ -69,7 +81,7 @@ msgstr "Produkt"
#. module: product_standard_margin
#: model:ir.model,name:product_standard_margin.model_product_product
msgid "Product Variant"
-msgstr ""
+msgstr "Produktvariante"
#. module: product_standard_margin
#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
From 7e0b5ba66d6b1166c0f15039c15e4bd9142dbdcd Mon Sep 17 00:00:00 2001
From: Shinnosuke Morita
Date: Tue, 24 Mar 2026 05:15:42 +0000
Subject: [PATCH 82/83] Added translation using Weblate (Japanese)
---
product_standard_margin/i18n/ja.po | 76 ++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 product_standard_margin/i18n/ja.po
diff --git a/product_standard_margin/i18n/ja.po b/product_standard_margin/i18n/ja.po
new file mode 100644
index 000000000..c3126dc78
--- /dev/null
+++ b/product_standard_margin/i18n/ja.po
@@ -0,0 +1,76 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * product_standard_margin
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 18.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: ja\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin
+msgid "Margin"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_margin_rate
+msgid "Margin (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin
+msgid ""
+"Margin is [ sale price (Wo Tax) - cost price ] of the product form (not "
+"based on historical values). Take care of tax include and exclude. If no "
+"sale price, the margin will be negativ."
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_margin_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_margin_rate
+msgid ""
+"Margin rate is [ Margin / sale price (Wo Tax) ] of the product form (not "
+"based on historical values).Take care of tax include and exclude.. If no "
+"sale price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__standard_markup_rate
+msgid "Markup (%)"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,help:product_standard_margin.field_product_product__standard_markup_rate
+#: model:ir.model.fields,help:product_standard_margin.field_product_template__standard_markup_rate
+msgid ""
+"Markup rate is [ Margin / cost price (Wo Tax) ] of the product form (not "
+"based on historical values).Take care of tax include and exclude.. If no "
+"cost price set, will display 999.0"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_template
+msgid "Product"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model,name:product_standard_margin.model_product_product
+msgid "Product Variant"
+msgstr ""
+
+#. module: product_standard_margin
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_product__list_price_vat_excl
+#: model:ir.model.fields,field_description:product_standard_margin.field_product_template__list_price_vat_excl
+msgid "Sale Price VAT Excluded"
+msgstr ""
From 716eaea34053a2ed1bbadcf0be3cf7997ca129b8 Mon Sep 17 00:00:00 2001
From: manuelcalerosolis
Date: Thu, 2 Apr 2026 10:40:11 +0200
Subject: [PATCH 83/83] [MIG] product_standard_margin: Migration to 19.0
---
product_standard_margin/README.rst | 12 ++++++------
product_standard_margin/__manifest__.py | 2 +-
product_standard_margin/models/product_product.py | 6 +++---
product_standard_margin/models/product_template.py | 6 +++---
.../static/description/index.html | 8 ++++----
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/product_standard_margin/README.rst b/product_standard_margin/README.rst
index f67ad26b5..4625c2d3b 100644
--- a/product_standard_margin/README.rst
+++ b/product_standard_margin/README.rst
@@ -21,13 +21,13 @@ Product Margin and Margin Rate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
- :target: https://github.com/OCA/margin-analysis/tree/18.0/product_standard_margin
+ :target: https://github.com/OCA/margin-analysis/tree/19.0/product_standard_margin
:alt: OCA/margin-analysis
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/margin-analysis-18-0/margin-analysis-18-0-product_standard_margin
+ :target: https://translation.odoo-community.org/projects/margin-analysis-19-0/margin-analysis-19-0-product_standard_margin
: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/margin-analysis&target_branch=18.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=19.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -52,7 +52,7 @@ OpenERP configuration (price type of all product price fields are set as
the same as the company currency). We don't take care of it cause
otherwise we should have added a dependency on sale module.
-.. |image1| image:: https://raw.githubusercontent.com/OCA/margin-analysis/18.0/product_standard_margin/static/description/product_form.png
+.. |image1| image:: https://raw.githubusercontent.com/OCA/margin-analysis/19.0/product_standard_margin/static/description/product_form.png
**Table of contents**
@@ -71,7 +71,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -117,6 +117,6 @@ Current `maintainer `__:
|maintainer-legalsylvain|
-This module is part of the `OCA/margin-analysis `_ project on GitHub.
+This module is part of the `OCA/margin-analysis `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/product_standard_margin/__manifest__.py b/product_standard_margin/__manifest__.py
index 2b9ffdc97..0296a6ec7 100644
--- a/product_standard_margin/__manifest__.py
+++ b/product_standard_margin/__manifest__.py
@@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Margin and Margin Rate",
- "version": "18.0.1.1.0",
+ "version": "19.0.1.1.0",
"author": "Camptocamp,GRAP,Odoo Community Association (OCA)",
"category": "Product",
"depends": ["account"],
diff --git a/product_standard_margin/models/product_product.py b/product_standard_margin/models/product_product.py
index bc1ede620..83a524150 100644
--- a/product_standard_margin/models/product_product.py
+++ b/product_standard_margin/models/product_product.py
@@ -31,7 +31,7 @@ class ProductProduct(models.Model):
standard_margin_rate = fields.Float(
compute="_compute_margin",
- string="Margin (%)",
+ string="Margin on Sales (%)",
store=True,
digits="Product Price",
help="Margin rate is [ Margin / sale price (Wo Tax) ] "
@@ -41,7 +41,7 @@ class ProductProduct(models.Model):
)
standard_markup_rate = fields.Float(
compute="_compute_margin",
- string="Markup (%)",
+ string="Markup Rate (%)",
store=True,
digits="Product Price",
help="Markup rate is [ Margin / cost price (Wo Tax) ] "
@@ -55,7 +55,7 @@ class ProductProduct(models.Model):
"lst_price",
"product_tmpl_id.list_price",
"standard_price",
- "taxes_id.price_include",
+ "taxes_id.price_include_override",
"taxes_id.amount",
"taxes_id.include_base_amount",
)
diff --git a/product_standard_margin/models/product_template.py b/product_standard_margin/models/product_template.py
index 8ff848885..549b70edc 100644
--- a/product_standard_margin/models/product_template.py
+++ b/product_standard_margin/models/product_template.py
@@ -29,7 +29,7 @@ class ProductTemplate(models.Model):
standard_margin_rate = fields.Float(
compute="_compute_margin",
- string="Margin (%)",
+ string="Margin on Sales (%)",
digits="Product Price",
help="Margin rate is [ Margin / sale price (Wo Tax) ] "
"of the product form (not based on historical values)."
@@ -38,7 +38,7 @@ class ProductTemplate(models.Model):
)
standard_markup_rate = fields.Float(
compute="_compute_margin",
- string="Markup (%)",
+ string="Markup Rate (%)",
digits="Product Price",
help="Markup rate is [ Margin / cost price (Wo Tax) ] "
"of the product form (not based on historical values)."
@@ -50,7 +50,7 @@ class ProductTemplate(models.Model):
@api.depends(
"list_price",
"standard_price",
- "taxes_id.price_include",
+ "taxes_id.price_include_override",
"taxes_id.amount",
"taxes_id.include_base_amount",
)
diff --git a/product_standard_margin/static/description/index.html b/product_standard_margin/static/description/index.html
index a86539f70..836435fc0 100644
--- a/product_standard_margin/static/description/index.html
+++ b/product_standard_margin/static/description/index.html
@@ -374,7 +374,7 @@ Product Margin and Margin Rate
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b84c7634a4ed13a1e2decdd6db69ba64e6d194fd21e90aaa9b0a9bd3d5046d15
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

Add 2 fields on the product form that compute the standard (or
theorical) margin and markup based on the current values of sale and
standard price present in the product form. We take care of taxe
@@ -382,7 +382,7 @@
Product Margin and Margin Rate
It will just compute it as follow: Margin : (Sale Price without tax -
Standard Price) / Sale Price without tax Markup : (Sale Price without
tax - Standard Price) / Standard Price
-
+
Note:
As this module will base his simple computation on sale and cost prices,
it suppose you have them both in the same currency (the price type must
@@ -415,7 +415,7 @@
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.