Skip to content

Commit c8a23cc

Browse files
committed
[IMP] account: add more visibility about the sent status of invoice
1 parent 63bd24d commit c8a23cc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

addons/account/models/account_move.py

Lines changed: 14 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_string = fields.Selection(
618+
selection=[
619+
("not_sent", "Not Sent"),
620+
("sent", "Sent")
621+
],
622+
copy=False,
623+
compute='_compute_is_move_sent_string'
624+
)
617625
is_being_sent = fields.Boolean(
618626
help="Is the move being sent asynchronously",
619627
compute='_compute_is_being_sent'
@@ -840,6 +848,12 @@ 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_string(self):
853+
for move in self:
854+
move.is_move_sent_string = "sent" if move.is_move_sent else "not_sent"
855+
856+
843857
def _get_valid_journal_types(self):
844858
if self.is_sale_document(include_receipts=True):
845859
return ['sale']

addons/account/views/account_move_views.xml

Lines changed: 10 additions & 0 deletions
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_string"
553+
string="Sent"
554+
widget="badge"
555+
decoration-danger="is_move_sent_string == 'not_sent'"
556+
decoration-success="is_move_sent_string == '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"/>
@@ -1600,6 +1607,9 @@
16001607
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
16011608
/>
16021609
<separator/>
1610+
<filter string="Sent invoices" name="sent" domain="[('is_move_sent', '=', True)]"/>
1611+
<filter string="Not sent invoices" name="not_sent" domain="[('is_move_sent', '=', False)]"/>
1612+
<separator/>
16031613
<filter name="out_invoice"
16041614
string="Invoices"
16051615
domain="[('move_type', '=', 'out_invoice')]"

0 commit comments

Comments
 (0)