Skip to content

[FIX] account: show sent status on invoices and added filter #4813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,16 @@ def _sequence_year_range_monthly_regex(self):
string='Terms and Conditions',
compute='_compute_narration', store=True, readonly=False,
)
status_move_sent = fields.Selection(
selection=[
('not_sent', "Not Sent"),
('sent', "Sent"),
],
readonly=True,
string="Sent Status",
default='not_sent',
compute='_compute_status_move_sent',
)
is_move_sent = fields.Boolean(
readonly=True,
copy=False,
Expand Down Expand Up @@ -754,6 +764,11 @@ def init(self):
# COMPUTE METHODS
# -------------------------------------------------------------------------

@api.depends('is_move_sent')
def _compute_status_move_sent(self):
for move in self:
move.status_move_sent = 'sent' if move.is_move_sent else 'not_sent'

@api.depends('move_type', 'partner_id')
def _compute_invoice_default_sale_person(self):
# We want to modify the sale person only when we don't have one and if the move type corresponds to this condition
Expand Down
11 changes: 11 additions & 0 deletions addons/account/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,12 @@
invisible="payment_state == 'invoicing_legacy' or move_type == 'entry'"
optional="show"
/>
<field name="status_move_sent"
string="Sent"
widget="badge"
decoration-success="status_move_sent == 'sent'"
decoration-danger="status_move_sent == 'not_sent'"
optional="hide" />
<field name="move_type" column_invisible="context.get('default_move_type', True)"/>
<field name="abnormal_amount_warning" column_invisible="1"/>
<field name="abnormal_date_warning" column_invisible="1"/>
Expand Down Expand Up @@ -1581,6 +1587,11 @@
<filter name="not_secured" string="Not Secured" domain="[('secured', '=', False), ('state', '=', 'posted')]"
groups="account.group_account_secured,base.group_no_one"/>
<separator/>
<filter name="sent"
string="Sent"
domain="[('is_move_sent', '=', True)]"
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
/>
<filter name="not_sent"
string="Not Sent"
domain="[('is_move_sent', '=', False)]"
Expand Down