From 0c2c86c28eb2bf6aa40dc801cac233f75d821fd8 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 19 Aug 2011 12:39:49 +0530 Subject: [PATCH 1/2] [FIX] mrp:cost price not update when the price of a raw material change lp bug: https://launchpad.net/bugs/747056 fixed bzr revid: aag@tinyerp.com-20110819070949-98a1t2156jxt0z9l --- addons/mrp/product.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/addons/mrp/product.py b/addons/mrp/product.py index 7301527f68e..d45b296162e 100644 --- a/addons/mrp/product.py +++ b/addons/mrp/product.py @@ -54,42 +54,6 @@ class product_product(osv.osv): "bom_ids": fields.one2many('mrp.bom', 'product_id','Bill of Materials'), } - def do_change_standard_price(self, cr, uid, ids, datas, context=None): - """ Changes the Standard Price of Product and parent products and creates an account move accordingly. - @param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal - @param context: A standard dictionary - @return: - """ - if context is None: - context = {} - res = super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context=context) - bom_obj = self.pool.get('mrp.bom') - change = context.get('change_parent_price', False) - def _compute_price(bom): - price = 0.0 - if bom.bom_id and change: - if bom.bom_id.bom_lines: - for bom_line in bom.bom_id.bom_lines: - prod_price = self.read(cr, uid, bom_line.product_id.id, ['standard_price'])['standard_price'] - price += bom_line.product_qty * prod_price - - accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id, context) - - datas = { - 'new_price': price, - 'stock_output_account': accounts['stock_account_output'], - 'stock_input_account': accounts['stock_account_input'], - 'stock_journal': accounts['stock_journal'] - } - super(product_product, self).do_change_standard_price(cr, uid, [bom.bom_id.product_id.id], datas, context) - _compute_price(bom.bom_id) - return price - - bom_ids = bom_obj.search(cr, uid, [('product_id', 'in', ids)]) - - for bom in bom_obj.browse(cr, uid, bom_ids, context=context): - _compute_price(bom) - def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} From d3154cb060b4b1036d5f5ac6d5fa7cfdd5707f1d Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 23 Aug 2011 17:40:59 +0530 Subject: [PATCH 2/2] [ADD]: Add Comment bzr revid: aag@tinyerp.com-20110823121059-6caeh1mr9jzvdnv8 --- addons/mrp/__openerp__.py | 2 +- addons/mrp/product.py | 2 ++ addons/mrp/wizard/__init__.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 0eb8c89c6c0..f8dc5bc6ffd 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -75,7 +75,7 @@ Dashboard provided by this module: 'wizard/change_production_qty_view.xml', 'wizard/mrp_price_view.xml', 'wizard/mrp_workcenter_load_view.xml', - 'wizard/mrp_change_standard_price_view.xml', +# 'wizard/mrp_change_standard_price_view.xml', 'mrp_view.xml', 'mrp_report.xml', 'company_view.xml', diff --git a/addons/mrp/product.py b/addons/mrp/product.py index d45b296162e..9731d93f84b 100644 --- a/addons/mrp/product.py +++ b/addons/mrp/product.py @@ -53,6 +53,8 @@ class product_product(osv.osv): _columns = { "bom_ids": fields.one2many('mrp.bom', 'product_id','Bill of Materials'), } + +# Removed do_change_standard_price for the fix of lp:747056 def copy(self, cr, uid, id, default=None, context=None): if not default: diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py index fec48938222..83dd1971c5b 100644 --- a/addons/mrp/wizard/__init__.py +++ b/addons/mrp/wizard/__init__.py @@ -23,7 +23,7 @@ import mrp_product_produce import mrp_price import mrp_workcenter_load import change_production_qty -import mrp_change_standard_price +#import mrp_change_standard_price # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: