Skip to content

Commit c72bfe9

Browse files
committed
[IMP] account: add more visibility about the sent status of invoices
In the account module, we want to help customers visualize which invoice has been sent or not. task-5231288
1 parent 9ae5720 commit c72bfe9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

addons/account/models/account_move.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,14 @@ def _sequence_year_range_monthly_regex(self):
614614
tracking=True,
615615
help="It indicates that the invoice/payment has been sent or the PDF has been generated.",
616616
)
617+
is_move_sent_value = fields.Selection(
618+
selection=[
619+
('sent', "Sent"),
620+
('not_sent', "Not Sent")
621+
],
622+
copy=False,
623+
compute='_compute_is_move_sent_value'
624+
)
617625
is_being_sent = fields.Boolean(
618626
help="Is the move being sent asynchronously",
619627
compute='_compute_is_being_sent'
@@ -840,6 +848,11 @@ def _compute_journal_id(self):
840848
for move in self.filtered(lambda r: r.journal_id.type not in r._get_valid_journal_types()):
841849
move.journal_id = move._search_default_journal()
842850

851+
@api.depends('is_move_sent')
852+
def _compute_is_move_sent_value(self):
853+
for move in self:
854+
move.is_move_sent_value = 'sent' if move.is_move_sent else 'not_sent'
855+
843856
def _get_valid_journal_types(self):
844857
if self.is_sale_document(include_receipts=True):
845858
return ['sale']

addons/account/views/account_move_views.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,13 @@
549549
invisible="payment_state == 'invoicing_legacy' or move_type == 'entry'"
550550
optional="show"
551551
/>
552+
<field name="is_move_sent_value"
553+
string="Sent"
554+
widget="badge"
555+
decoration-danger="is_move_sent_value == 'not_sent'"
556+
decoration-success="is_move_sent_value == 'sent'"
557+
optional="hide"
558+
/>
552559
<field name="move_type" column_invisible="context.get('default_move_type', True)"/>
553560
<field name="abnormal_amount_warning" column_invisible="1"/>
554561
<field name="abnormal_date_warning" column_invisible="1"/>
@@ -1595,10 +1602,14 @@
15951602
groups="account.group_account_secured,base.group_no_one"/>
15961603
<separator/>
15971604
<filter name="not_sent"
1598-
string="Not Sent"
1605+
string="Not Sent Invoices"
15991606
domain="[('is_move_sent', '=', False)]"
16001607
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
16011608
/>
1609+
<filter name="sent"
1610+
string="Sent Invoices"
1611+
domain="[('is_move_sent', '=', True)]"
1612+
/>
16021613
<separator/>
16031614
<filter name="out_invoice"
16041615
string="Invoices"

0 commit comments

Comments
 (0)