From b4f1e316e64e628928edeaef834bd1aec91d60b6 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 25 Apr 2018 17:06:51 +0200 Subject: [PATCH] [FIX] stock_account: average and anglo saxon Remove behaviour introduced by [1], if there's a price difference the price difference account will be used. This code block did not take into account the fact that out move have a negative price unit, resulting in inverted debit/credit. Furthermore, there's no special case for return of standard and fifo. [1] 1df16a189e7a4129480cb5574c9c0064026f9a89 opw-1828196 --- addons/stock_account/models/stock.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index c29215f2b79..d6800a1b7c7 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -528,17 +528,6 @@ class StockMove(models.Model): raise UserError(_("The cost of %s is currently equal to 0. Change the cost or the configuration of your product to avoid an incorrect valuation.") % (self.product_id.name,)) credit_value = debit_value - if self.product_id.cost_method == 'average' and self.company_id.anglo_saxon_accounting: - # in case of a supplier return in anglo saxon mode, for products in average costing method, the stock_input - # account books the real purchase price, while the stock account books the average price. The difference is - # booked in the dedicated price difference account. - if self.location_dest_id.usage == 'supplier' and self.origin_returned_move_id and self.origin_returned_move_id.purchase_line_id: - debit_value = self.origin_returned_move_id.price_unit * qty - # in case of a customer return in anglo saxon mode, for products in average costing method, the stock valuation - # is made using the original average price to negate the delivery effect. - if self.location_id.usage == 'customer' and self.origin_returned_move_id: - debit_value = self.origin_returned_move_id.price_unit * qty - credit_value = debit_value partner_id = (self.picking_id.partner_id and self.env['res.partner']._find_accounting_partner(self.picking_id.partner_id).id) or False debit_line_vals = { 'name': self.name,