diff --git a/addons/stock_account/product.py b/addons/stock_account/product.py index 2e49d42d6d8..8572d670438 100644 --- a/addons/stock_account/product.py +++ b/addons/stock_account/product.py @@ -168,7 +168,7 @@ class product_product(osv.osv): self.valuation = 'manual_periodic' return {} - def do_change_standard_price(self, cr, uid, ids, new_price, context=None): + def do_change_standard_price(self, cr, uid, ids, new_price, account_id, context=None): """ Changes the Standard Price of Product and creates an account move accordingly.""" location_obj = self.pool.get('stock.location') move_obj = self.pool.get('account.move') @@ -190,11 +190,11 @@ class product_product(osv.osv): # Accounting Entries amount_diff = abs(diff * qty) if diff * qty > 0: - debit_account_id = datas['expense'].id + debit_account_id = account_id credit_account_id = datas['stock_valuation'].id else: debit_account_id = datas['stock_valuation'].id - credit_account_id = datas['expense'].id + credit_account_id = account_id lines = [(0, 0, {'name': _('Standard Price changed'), 'account_id': debit_account_id, diff --git a/addons/stock_account/wizard/stock_change_standard_price.py b/addons/stock_account/wizard/stock_change_standard_price.py index a90a9961694..340d2010699 100644 --- a/addons/stock_account/wizard/stock_change_standard_price.py +++ b/addons/stock_account/wizard/stock_change_standard_price.py @@ -66,6 +66,6 @@ class change_standard_price(osv.osv_memory): rec_ids = prod_obj.browse(cr, uid, rec_id, context=context).product_variant_ids.mapped('id') else: rec_ids = [rec_id] - prod_obj = self.pool.get('product.product') - prod_obj.do_change_standard_price(cr, uid, rec_ids, new_price, context) + res = self.browse(cr, uid, ids, context=context)[0] + self.pool.get('product.product').do_change_standard_price(cr, uid, rec_ids, new_price, res.counterpart_account_id.id, context=context) return {'type': 'ir.actions.act_window_close'}