[FIX] purchase: move with zero qty
- Create a product FIFO / Real-Time valuation - Create a PO with 1 unit, validate, receive the picking - Create the corresponding vendor bill, but do not validate - Unlock the picking and change the received quantity to 0.0 - Validate the invoice A traceback because of a zero division occurs. When searching for the stock moves linked to the PO, we should filter out the ones with a zero quantity. opw-1843543
This commit is contained in:
committed by
Nicolas Martinelli
parent
1dbeda0157
commit
d9fc5bca7e
@@ -161,7 +161,10 @@ class AccountInvoice(models.Model):
|
||||
#for average/fifo/lifo costing method, fetch real cost price from incomming moves
|
||||
valuation_price_unit = i_line.purchase_line_id.product_uom._compute_price(i_line.purchase_line_id.price_unit, i_line.uom_id)
|
||||
stock_move_obj = self.env['stock.move']
|
||||
valuation_stock_move = stock_move_obj.search([('purchase_line_id', '=', i_line.purchase_line_id.id), ('state', '=', 'done')])
|
||||
valuation_stock_move = stock_move_obj.search([
|
||||
('purchase_line_id', '=', i_line.purchase_line_id.id),
|
||||
('state', '=', 'done'), ('product_qty', '!=', 0.0)
|
||||
])
|
||||
if self.type == 'in_refund':
|
||||
valuation_stock_move = valuation_stock_move.filtered(lambda m: m._is_out())
|
||||
elif self.type == 'in_invoice':
|
||||
|
||||
Reference in New Issue
Block a user