[REF] point_of_sale: remove unreachable block

When generating invoice for PoS orders, if a cash rounding is applied,
a cash rounding line is generated. Thus it is not possible to have
`rounding_applied` and NOT `rounding_line`.

closes odoo/odoo#114122

Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
This commit is contained in:
Ahmad Khanalizadeh
2023-04-06 10:40:46 +02:00
parent 3c6013e5ae
commit a5178ab86f
+3 -21
View File
@@ -521,30 +521,12 @@ class PosOrder(models.Model):
account_id = new_move.invoice_cash_rounding_id.loss_account_id.id
else:
account_id = new_move.invoice_cash_rounding_id.profit_account_id.id
if rounding_line:
if rounding_line_difference:
rounding_line.with_context(check_move_validity=False).write({
'debit': rounding_applied < 0.0 and -rounding_applied or 0.0,
'credit': rounding_applied > 0.0 and rounding_applied or 0.0,
'account_id': account_id,
'price_unit': rounding_applied,
})
else:
self.env['account.move.line'].with_context(check_move_validity=False).create({
if rounding_line_difference:
rounding_line.with_context(check_move_validity=False).write({
'debit': rounding_applied < 0.0 and -rounding_applied or 0.0,
'credit': rounding_applied > 0.0 and rounding_applied or 0.0,
'quantity': 1.0,
'amount_currency': rounding_applied,
'partner_id': new_move.partner_id.id,
'move_id': new_move.id,
'currency_id': new_move.currency_id if new_move.currency_id != new_move.company_id.currency_id else False,
'company_id': new_move.company_id.id,
'company_currency_id': new_move.company_id.currency_id.id,
'display_type': 'rounding',
'sequence': 9999,
'name': new_move.invoice_cash_rounding_id.name,
'account_id': account_id,
'price_unit': rounding_applied,
})
else:
if rounding_line: