[IMP] account: improve display of invoices/bills in list view
Canceled and draft entries are the same color as posted entries. They should be in a different color (grey/blue) in order to be distinguished from other invoices/bills. Amount Due, a.k.a. amount_residual(_signed), is not 0 for draft and canceled entries. It should be 0 since they haven't been posted yet. A few tests have to be adapted to reflect this change in spec. Task=2801521 closes odoo/odoo#88295 X-original-commit: 498a4a52b5fbc5466d8d0652db10563ccba55032 Related: odoo/upgrade#3435 Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
@@ -1361,7 +1361,8 @@ class AccountMove(models.Model):
|
||||
'line_ids.amount_residual',
|
||||
'line_ids.amount_residual_currency',
|
||||
'line_ids.payment_id.state',
|
||||
'line_ids.full_reconcile_id')
|
||||
'line_ids.full_reconcile_id',
|
||||
'state')
|
||||
def _compute_amount(self):
|
||||
stored_ids = tuple(self.ids)
|
||||
if stored_ids:
|
||||
@@ -1437,7 +1438,7 @@ class AccountMove(models.Model):
|
||||
total_tax_currency += line.amount_currency
|
||||
total += line.balance
|
||||
total_currency += line.amount_currency
|
||||
elif line.account_id.user_type_id.type in ('receivable', 'payable'):
|
||||
elif line.account_id.user_type_id.type in ('receivable', 'payable') and move.state == 'posted':
|
||||
# Residual amount.
|
||||
total_to_pay += line.balance
|
||||
total_residual += line.amount_residual
|
||||
|
||||
@@ -424,6 +424,7 @@
|
||||
<tree string="Invoices"
|
||||
js_class="account_tree"
|
||||
decoration-info="state == 'draft'"
|
||||
decoration-muted="state == 'cancel'"
|
||||
expand="context.get('expand', False)"
|
||||
sample="1">
|
||||
<header>
|
||||
|
||||
@@ -43,6 +43,8 @@ class TestGenISRReference(AccountTestInvoicingCommon):
|
||||
|
||||
self.invoice.partner_bank_id = self.bank_acc_isr
|
||||
self.invoice.name = "INV/01234567890"
|
||||
# Post invoice to have the expected amount due (amount_residual)
|
||||
self.invoice.action_post()
|
||||
|
||||
expected_isr = "000000000000000012345678903"
|
||||
expected_isr_spaced = "00 00000 00000 00001 23456 78903"
|
||||
@@ -66,6 +68,8 @@ class TestGenISRReference(AccountTestInvoicingCommon):
|
||||
self.invoice.partner_bank_id = self.bank_acc_isr
|
||||
|
||||
self.invoice.name = "INV/123456789012345678901234567890"
|
||||
# Post invoice to have the expected amount due (amount_residual)
|
||||
self.invoice.action_post()
|
||||
|
||||
expected_isr = "567890123456789012345678901"
|
||||
expected_isr_spaced = "56 78901 23456 78901 23456 78901"
|
||||
|
||||
@@ -57,7 +57,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
|
||||
invoice = move_form.save()
|
||||
|
||||
self.assertAlmostEqual(self.product_A.lst_price * rate, invoice.amount_total)
|
||||
self.assertAlmostEqual(self.product_A.lst_price * rate, invoice.amount_residual)
|
||||
self.assertAlmostEqual(0, invoice.amount_residual)
|
||||
self.assertEqual(len(invoice.mapped("line_ids")), 2)
|
||||
self.assertEqual(len(invoice.mapped("line_ids.currency_id")), 1)
|
||||
|
||||
@@ -82,7 +82,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
|
||||
invoice = move_form.save()
|
||||
|
||||
self.assertAlmostEqual(self.product_A.lst_price * rate, invoice.amount_total)
|
||||
self.assertAlmostEqual(self.product_A.lst_price * rate, invoice.amount_residual)
|
||||
self.assertAlmostEqual(0, invoice.amount_residual)
|
||||
self.assertEqual(len(invoice.mapped("line_ids")), 2)
|
||||
self.assertEqual(len(invoice.mapped("line_ids.currency_id")), 1)
|
||||
|
||||
@@ -107,7 +107,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
|
||||
invoice = move_form.save()
|
||||
|
||||
self.assertAlmostEqual(self.product_A.lst_price * rate, invoice.amount_total)
|
||||
self.assertAlmostEqual(self.product_A.lst_price * rate, invoice.amount_residual)
|
||||
self.assertAlmostEqual(0, invoice.amount_residual)
|
||||
self.assertEqual(len(invoice.mapped("line_ids")), 2)
|
||||
self.assertEqual(len(invoice.mapped("line_ids.currency_id")), 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user