This commit is contained in:
2026-04-28 11:27:35 +02:00
parent 98893647f6
commit 2cdcbe7303
2 changed files with 15 additions and 3 deletions

View File

@@ -1963,17 +1963,25 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin):
move_line_.amount_second_currency = -original_amount
if amount < 0:
lot_has_sale_invoice = (
move_line.lot
and (move_line.lot.sale_invoice_line
or move_line.lot.sale_invoice_line_prov))
move_line.debit = Decimal(0)
move_line.credit = -amount
move_line.account = gl.product.account_stock_used if not (move_line.lot.sale_invoice_line or move_line.lot.sale_invoice_line_prov) else gl.product.account_stock_out_used
move_line.account = gl.product.account_stock_used if not lot_has_sale_invoice else gl.product.account_stock_out_used
move_line.account = gl.product.account_cogs_used if gl.fee else move_line.account
move_line_.credit = Decimal(0)
move_line_.debit = -amount
move_line_.account = gl.product.account_stock_in_used
else:
lot_has_sale_invoice = (
move_line.lot
and (move_line.lot.sale_invoice_line
or move_line.lot.sale_invoice_line_prov))
move_line.debit = amount
move_line.credit = Decimal(0)
move_line.account = gl.product.account_stock_used if not (move_line.lot.sale_invoice_line or move_line.lot.sale_invoice_line_prov) else gl.product.account_stock_out_used
move_line.account = gl.product.account_stock_used if not lot_has_sale_invoice else gl.product.account_stock_out_used
move_line.account = gl.product.account_cogs_used if gl.fee else move_line.account
move_line_.debit = Decimal(0)
move_line_.credit = amount