Skip to content

Commit 1b19fb6

Browse files
committed
[FIX] account: show sent status on invoices and added filter
Purpose ------- Improve visibility of whether a customer invoice has been sent or not using the "Send & Print" feature. With the rise of electronic invoicing and general accounting needs, it's helpful to clearly distinguish sent from unsent invoices in the list view. Changes ------- - Added a "Sent" column (optional, hidden by default) next to the invoice status in the customer invoices list view. - Added the filter "Sent": shows invoices that have been sent via the "Send & Print" feature. How to test ----------- 1. Go to Accounting > Customers > Invoices. 2. Click the optional columns icon on the list view to show the "Sent" column. 3. Send one invoice via the "Send" button in the form view. 4. Or Select multiple invoices from the list view and use "Action > Send & Print" to send them. 5. The "Sent" column should update accordingly. 6. Use the "Sent invoices" and "Not sent invoices" filters to check the expected results.
1 parent 6819f50 commit 1b19fb6

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

addons/account/models/account_move.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,16 @@ def _sequence_year_range_monthly_regex(self):
597597
string='Terms and Conditions',
598598
compute='_compute_narration', store=True, readonly=False,
599599
)
600+
status_move_sent = fields.Selection(
601+
selection=[
602+
('not_sent', "Not Sent"),
603+
('sent', "Sent"),
604+
],
605+
readonly=True,
606+
string="Sent Status",
607+
default='not_sent',
608+
compute='_compute_status_move_sent',
609+
)
600610
is_move_sent = fields.Boolean(
601611
readonly=True,
602612
copy=False,
@@ -754,6 +764,11 @@ def init(self):
754764
# COMPUTE METHODS
755765
# -------------------------------------------------------------------------
756766

767+
@api.depends('is_move_sent')
768+
def _compute_status_move_sent(self):
769+
for move in self:
770+
move.status_move_sent = 'sent' if move.is_move_sent else 'not_sent'
771+
757772
@api.depends('move_type', 'partner_id')
758773
def _compute_invoice_default_sale_person(self):
759774
# 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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,12 @@
548548
invisible="payment_state == 'invoicing_legacy' or move_type == 'entry'"
549549
optional="show"
550550
/>
551+
<field name="status_move_sent"
552+
string="Sent"
553+
widget="badge"
554+
decoration-success="status_move_sent == 'sent'"
555+
decoration-danger="status_move_sent == 'not_sent'"
556+
optional="hide" />
551557
<field name="move_type" column_invisible="context.get('default_move_type', True)"/>
552558
<field name="abnormal_amount_warning" column_invisible="1"/>
553559
<field name="abnormal_date_warning" column_invisible="1"/>
@@ -1581,6 +1587,11 @@
15811587
<filter name="not_secured" string="Not Secured" domain="[('secured', '=', False), ('state', '=', 'posted')]"
15821588
groups="account.group_account_secured,base.group_no_one"/>
15831589
<separator/>
1590+
<filter name="sent"
1591+
string="Sent"
1592+
domain="[('is_move_sent', '=', True)]"
1593+
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
1594+
/>
15841595
<filter name="not_sent"
15851596
string="Not Sent"
15861597
domain="[('is_move_sent', '=', False)]"

0 commit comments

Comments
 (0)