[FIX] sale_stock: delivered quantity blocked by expense policy
Use case to reproduce
- Set a product to be expensed
- set the expense_policy to something else than no
- Do a delivery order with a picking
- Validate the picking
-> Delivered quantity to 0 and impossible to create an invoice
if the invoice_policy is delivered_quantity
It happens due to this commit 48ea59d46e
What does it do:
- The move could be generated by an expense.
- If the move has 'no' as expense policy thus we won't add it in the invoice
Problem we can't guess if the move come from an expense or not (limitation).
This commit increments the delivered quanity if the product can
not be expense anymore
opw-777139
This commit is contained in:
@@ -22,7 +22,7 @@ class StockMove(models.Model):
|
||||
result = super(StockMove, self).action_done()
|
||||
|
||||
# Update delivered quantities on sale order lines
|
||||
sale_order_lines = self.filtered(lambda move: move.procurement_id.sale_line_id and move.product_id.expense_policy == 'no').mapped('procurement_id.sale_line_id')
|
||||
sale_order_lines = self.filtered(lambda move: move.procurement_id.sale_line_id and (not move.product_id.can_be_expensed or move.product_id.expense_policy=='no')).mapped('procurement_id.sale_line_id')
|
||||
for line in sale_order_lines:
|
||||
line.qty_delivered = line._get_delivered_qty()
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user