← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~camptocamp/margin-analysis/7.0-port-product_get_cost_field-yvr into lp:margin-analysis

 

Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/margin-analysis/7.0-port-product_get_cost_field-yvr into lp:margin-analysis.

Requested reviews:
  Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c): code review, no tests
  Pedro Manuel Baeza (pedro.baeza): code review, no test

For more details, see:
https://code.launchpad.net/~camptocamp/margin-analysis/7.0-port-product_get_cost_field-yvr/+merge/190347

Portage of product_get_cost_field
-- 
https://code.launchpad.net/~camptocamp/margin-analysis/7.0-port-product_get_cost_field-yvr/+merge/190347
Your team Margin Analysis Core Editors is subscribed to branch lp:margin-analysis.
=== modified file 'product_get_cost_field/__openerp__.py'
--- product_get_cost_field/__openerp__.py	2013-09-11 08:08:22 +0000
+++ product_get_cost_field/__openerp__.py	2013-11-05 16:09:39 +0000
@@ -30,10 +30,10 @@
  Provides an overridable method on product which compute the cost_price field of a product. 
  By default it just return the value of standard_price field, but using the product_cost_incl_bom
  module, it will return the costing from the bom.
- 
+
  As it is a generic module, you can also setup your own way of computing the cost_price for your 
  product.
- 
+
  All our modules to compute margin are based on it, so you'll ba able to use them in your own way.
  """,
  'website': 'http://www.camptocamp.com/',
@@ -41,7 +41,7 @@
  'update_xml': ['product_view.xml'],
  'demo_xml': [],
  'tests': [],
- 'installable': False,
+ 'installable': True,
  'auto_install': False,
  'license': 'AGPL-3',
  'application': False

=== added file 'product_get_cost_field/i18n/fr.po'
--- product_get_cost_field/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ product_get_cost_field/i18n/fr.po	2013-11-05 16:09:39 +0000
@@ -0,0 +1,33 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* product_get_cost_field
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-11-05 15:57+0000\n"
+"PO-Revision-Date: 2013-11-05 15:57+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_get_cost_field
+#: help:product.product,cost_price:0
+msgid "The cost price is the standard price or, if the product has a bom, the sum of all standard price of its components. it take also care of the bom costing like cost per cylce."
+msgstr "Le prix coûtant est le prix standard ou, si le produit est défini par une nomenclature, la somme de tout les prix standard de ses composants. les coûts de la nomenclature comme le coût par cycle sont pris en compte."
+
+#. module: product_get_cost_field
+#: model:ir.model,name:product_get_cost_field.model_product_product
+msgid "Product"
+msgstr "Article"
+
+#. module: product_get_cost_field
+#: model:ir.model.fields,field_description:product_get_cost_field.field_product_product_cost_price
+#: field:product.product,cost_price:0
+msgid "Cost Price (incl. BoM)"
+msgstr "Prix coûtant (BoM incl.)"
+

=== modified file 'product_get_cost_field/i18n/nl.po'
--- product_get_cost_field/i18n/nl.po	2012-12-23 12:12:06 +0000
+++ product_get_cost_field/i18n/nl.po	2013-11-05 16:09:39 +0000
@@ -35,7 +35,3 @@
 msgid "Cost Price (incl. BoM)"
 msgstr "Kostprijs (incl. kosten)"
 
-#. module: product_get_cost_field
-#: constraint:product.product:0
-msgid "Error: Invalid ean code"
-msgstr "Fout: ongeldige ean code"

=== added file 'product_get_cost_field/i18n/product_get_cost_field.pot'
--- product_get_cost_field/i18n/product_get_cost_field.pot	1970-01-01 00:00:00 +0000
+++ product_get_cost_field/i18n/product_get_cost_field.pot	2013-11-05 16:09:39 +0000
@@ -0,0 +1,33 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* product_get_cost_field
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-11-05 15:57+0000\n"
+"PO-Revision-Date: 2013-11-05 15:57+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_get_cost_field
+#: help:product.product,cost_price:0
+msgid "The cost price is the standard price or, if the product has a bom, the sum of all standard price of its components. it take also care of the bom costing like cost per cylce."
+msgstr ""
+
+#. module: product_get_cost_field
+#: model:ir.model,name:product_get_cost_field.model_product_product
+msgid "Product"
+msgstr ""
+
+#. module: product_get_cost_field
+#: model:ir.model.fields,field_description:product_get_cost_field.field_product_product_cost_price
+#: field:product.product,cost_price:0
+msgid "Cost Price (incl. BoM)"
+msgstr ""
+

=== modified file 'product_get_cost_field/product_get_cost_field.py'
--- product_get_cost_field/product_get_cost_field.py	2012-07-12 13:56:17 +0000
+++ product_get_cost_field/product_get_cost_field.py	2013-11-05 16:09:39 +0000
@@ -28,14 +28,23 @@
 class Product(Model):
     _inherit = 'product.product'
 
+    def _compute_purchase_price(self, cr, uid, ids,
+                                context=None):
+        res = {}
+        products = self.browse(cr, uid, ids)
+        if isinstance(ids, (int, long)):
+            res = products.standard_price
+        elif isinstance(ids, list):
+            for product in self.browse(cr, uid, ids, context=context):
+                res[product.id] = product.standard_price
+        return res
+
     def _cost_price(self, cr, uid, ids, field_name, arg, context=None):
         if context is None:
             context = {}
         logger = logging.getLogger('product.get_cost_field')
         logger.debug("get cost field _cost_price %s, %s, %s", field_name, arg, context)
-        res = {}
-        for product in self.browse(cr, uid, ids):
-            res[product.id] = product.standard_price
+        res = self._compute_purchase_price(cr, uid, ids, context=context)
         return res
 
     def get_cost_field(self, cr, uid, ids, context=None):


References