[FIX] account: switch to refund an invoice with downpayment
If you create a Downpayment invoice from a Sale Order with a fixed
amount bigger than the amount of the SO, when you create the regular
invoice it creates a credit note but all lines are "positive" when only
the downpayment line should be.
Based the implementation existing before d8d47f9ff8
https://github.com/odoo/odoo/blob/3363e55cac2a121c29842a0b2463f940bdd866a4/addons/account/models/account_move.py#L3339
X-original-commit: 5432809bbb80c539ba11fb9aa6973669c30f5827
Part-of: odoo/odoo#101994
This commit is contained in:
@@ -3378,15 +3378,14 @@ class AccountMove(models.Model):
|
||||
'partner_bank_id': False,
|
||||
'currency_id': move.currency_id.id,
|
||||
})
|
||||
move.write({
|
||||
'line_ids': [
|
||||
Command.update(line.id, {
|
||||
'quantity': -line.quantity,
|
||||
})
|
||||
for line in move.line_ids
|
||||
if line.display_type == 'product' and line.quantity < 0
|
||||
]
|
||||
})
|
||||
if move.amount_total < 0:
|
||||
move.write({
|
||||
'line_ids': [
|
||||
Command.update(line.id, {'quantity': -line.quantity})
|
||||
for line in move.line_ids
|
||||
if line.display_type == 'product'
|
||||
]
|
||||
})
|
||||
|
||||
def action_register_payment(self):
|
||||
''' Open the account.payment.register wizard to pay the selected journal entries.
|
||||
|
||||
Reference in New Issue
Block a user