Fix COGS computation with negative quantity
issue3287 review976002 (transplanted from b041a5be1444d626bd9105f28f6861c7695ffaa9)
This commit is contained in:
1 parent
8fdc9befac
commit
c2e4537b98
1 file changed
+8
-1
+8
-1
@@ -74,10 +74,17 @@ class InvoiceLine:
|
||||
type_ = 'out_supplier'
|
||||
elif self.invoice.type == 'out_credit_note':
|
||||
type_ = 'in_customer'
|
||||
if self.quantity < 0:
|
||||
direction, target = type_.split('_')
|
||||
if direction == 'in':
|
||||
direction = 'out'
|
||||
else:
|
||||
direction = 'in'
|
||||
type_ = '%s_%s' % (direction, target)
|
||||
|
||||
moves.sort(key=operator.attrgetter('effective_date'))
|
||||
cost = Move.update_anglo_saxon_quantity_product_cost(
|
||||
self.product, moves, self.quantity, self.unit, type_)
|
||||
self.product, moves, abs(self.quantity), self.unit, type_)
|
||||
cost = self.invoice.currency.round(cost)
|
||||
|
||||
anglo_saxon_move_lines = self._get_anglo_saxon_move_lines(cost, type_)
|
||||
|
||||
Reference in new issue
Block a user