Skip to content

Commit 602f3ff

Browse files
committed
[IMP] account: add a column for invoice status on the invoice list view and a 'sent' search filter
It would be easier for the user to see which invoices are sent or not in his list view, so a column was added to show which invoices were sent and which were not, also a filter for the 'not sent' invoices was in the search view but there was no filter for 'sent' invoices, that was added as well. task-5231300
1 parent 9ae5720 commit 602f3ff

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

addons/account/models/account_move.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,16 @@ 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+
618+
is_move_sent_label = fields.Selection(
619+
selection=[
620+
("sent", "Sent"),
621+
("not_sent","Not sent")
622+
],
623+
string='Invoice Sent',
624+
compute='_compute_is_move_sent_label'
625+
)
626+
617627
is_being_sent = fields.Boolean(
618628
help="Is the move being sent asynchronously",
619629
compute='_compute_is_being_sent'
@@ -765,6 +775,11 @@ def init(self):
765775
# COMPUTE METHODS
766776
# -------------------------------------------------------------------------
767777

778+
@api.depends('is_move_sent')
779+
def _compute_is_move_sent_label(self):
780+
for move in self:
781+
move.is_move_sent_label = "sent" if move.is_move_sent else "not_sent"
782+
768783
@api.depends('move_type', 'partner_id')
769784
def _compute_invoice_default_sale_person(self):
770785
# We want to modify the sale person only when we don't have one and if the move type corresponds to this condition

addons/account/views/account_move_views.xml

Lines changed: 12 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_label"
553+
string="Send Status"
554+
widget="badge"
555+
decoration-success="is_move_sent"
556+
decoration-danger="not is_move_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"/>
@@ -1594,6 +1601,11 @@
15941601
<filter name="not_secured" string="Not Secured" domain="[('secured', '=', False), ('state', '=', 'posted')]"
15951602
groups="account.group_account_secured,base.group_no_one"/>
15961603
<separator/>
1604+
<filter name="sent"
1605+
string="Sent"
1606+
domain="[('is_move_sent', '=', True)]"
1607+
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
1608+
/>
15971609
<filter name="not_sent"
15981610
string="Not Sent"
15991611
domain="[('is_move_sent', '=', False)]"

0 commit comments

Comments
 (0)