Skip to content

Commit bcd626e

Browse files
committed
[IMP] account: add send status in invoices list view and created related filters
When an invoice is sent there is no other way to ee it than in the form view by the button send & print thus I added an optional hide field in the list view that shows the send status and made 2 filters sent and not sent to easily differenciate those incoices task-5231328
1 parent 9ae5720 commit bcd626e

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

addons/account/models/account_move.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,15 @@ def _sequence_year_range_monthly_regex(self):
618618
help="Is the move being sent asynchronously",
619619
compute='_compute_is_being_sent'
620620
)
621-
621+
send_status = fields.Selection(
622+
selection=[
623+
('sent', "Sent"),
624+
('not_sent', "Not sent")
625+
],
626+
string="Send Status",
627+
compute='_compute_send_status', readonly=True,
628+
copy=False,
629+
)
622630
invoice_user_id = fields.Many2one(
623631
string='Salesperson',
624632
comodel_name='res.users',
@@ -786,6 +794,14 @@ def _compute_is_being_sent(self):
786794
for move in self:
787795
move.is_being_sent = bool(move.sending_data)
788796

797+
@api.depends('is_being_sent')
798+
def _compute_send_status(self):
799+
for move in self:
800+
if move.is_move_sent:
801+
move.send_status = 'sent'
802+
else:
803+
move.send_status = 'not_sent'
804+
789805
def _compute_payment_reference(self):
790806
for move in self.filtered(lambda m: (
791807
m.state == 'posted'

addons/account/views/account_move_views.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,12 @@
549549
invisible="payment_state == 'invoicing_legacy' or move_type == 'entry'"
550550
optional="show"
551551
/>
552+
<field name="send_status"
553+
widget="badge"
554+
decoration-success="send_status == 'sent'"
555+
decoration-muted="send_status == 'not_sent'"
556+
optional="hide"
557+
/>
552558
<field name="move_type" column_invisible="context.get('default_move_type', True)"/>
553559
<field name="abnormal_amount_warning" column_invisible="1"/>
554560
<field name="abnormal_date_warning" column_invisible="1"/>
@@ -1599,6 +1605,11 @@
15991605
domain="[('is_move_sent', '=', False)]"
16001606
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
16011607
/>
1608+
<filter name="sent"
1609+
string="Sent"
1610+
domain="[('is_move_sent', '=', True)]"
1611+
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
1612+
/>
16021613
<separator/>
16031614
<filter name="out_invoice"
16041615
string="Invoices"

0 commit comments

Comments
 (0)