Skip to content

Commit 982c838

Browse files
committed
[IMP] account: Add more visibility about the sent status of invoice
This commit aims to add a new column "Sent Status" to invoice list view. And a filter for "sent" invoices. task-4908901
1 parent 6819f50 commit 982c838

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

addons/account/models/account_move.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,11 @@ def _sequence_year_range_monthly_regex(self):
603603
tracking=True,
604604
help="It indicates that the invoice/payment has been sent or the PDF has been generated.",
605605
)
606+
move_sent_status = fields.Selection(
607+
[('sent', 'Sent'), ('not_sent', 'Not Sent')],
608+
string='Move Sent Status',
609+
compute='_compute_move_sent_status'
610+
)
606611
is_being_sent = fields.Boolean(
607612
help="Is the move being sent asynchronously",
608613
compute='_compute_is_being_sent'
@@ -775,6 +780,11 @@ def _compute_is_being_sent(self):
775780
for move in self:
776781
move.is_being_sent = bool(move.sending_data)
777782

783+
@api.depends('is_move_sent')
784+
def _compute_move_sent_status(self):
785+
for record in self:
786+
record.move_sent_status = 'sent' if record.is_move_sent else 'not_sent'
787+
778788
def _compute_payment_reference(self):
779789
for move in self.filtered(lambda m: (
780790
m.state == 'posted'

addons/account/views/account_move_views.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,13 @@
551551
<field name="move_type" column_invisible="context.get('default_move_type', True)"/>
552552
<field name="abnormal_amount_warning" column_invisible="1"/>
553553
<field name="abnormal_date_warning" column_invisible="1"/>
554+
<field name="move_sent_status"
555+
optional="hide"
556+
string="Sent Status"
557+
widget="badge"
558+
decoration-success="move_sent_status == 'sent'"
559+
decoration-danger="move_sent_status == 'not_sent'"
560+
/>
554561
</list>
555562
</field>
556563
</record>
@@ -1581,6 +1588,11 @@
15811588
<filter name="not_secured" string="Not Secured" domain="[('secured', '=', False), ('state', '=', 'posted')]"
15821589
groups="account.group_account_secured,base.group_no_one"/>
15831590
<separator/>
1591+
<filter name="sent"
1592+
string="Sent"
1593+
domain="[('is_move_sent', '=', True)]"
1594+
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
1595+
/>
15841596
<filter name="not_sent"
15851597
string="Not Sent"
15861598
domain="[('is_move_sent', '=', False)]"

0 commit comments

Comments
 (0)