}
product_template()
+ class product_product(osv.osv):
+ _inherit = "product.product"
-
++
+ def do_change_standard_price(self, cr, uid, ids, datas, context=None):
+ """ Changes the Standard Price of Product 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:
+
+ """
+ product_obj=self.browse(cr, uid, ids, context=context)[0]
+ stock_price_diff_account = product_obj.property_account_creditor_price_difference and product_obj.property_account_creditor_price_difference.id or False
-
++
+ if not stock_price_diff_account:
+ stock_price_diff_account = product_obj.categ_id.property_account_creditor_price_difference_categ and product_obj.categ_id.property_account_creditor_price_difference_categ.id or False
+ if not stock_price_diff_account:
- raise osv.except_osv(_('Error!'),_('There is no price diffrent account defined ' \
++ raise osv.except_osv(_('Error!'),_('There is no price difference account defined ' \
+ 'for this product: "%s" (id: %d)') % (product_obj.name, product_obj.id,))
+ datas['stock_input_account'] = stock_price_diff_account
+ datas['stock_output_account'] = stock_price_diff_account
-
++
+ return super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context)
-
++
+ product_product()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: