Skip to content

[IMP] account: add invoice sent status column and filter #4821

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

Open
wants to merge 1 commit into
base: 18.0-rd-accounting-onboarding-malb
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,14 @@ def _sequence_year_range_monthly_regex(self):
)
is_being_sent = fields.Boolean(
help="Is the move being sent asynchronously",
compute='_compute_is_being_sent'
compute='_compute_is_being_sent',
)
send_status_display = fields.Selection(
selection=[
('sent', 'Sent'),
('not_sent', 'Not Sent'),
],
compute='_compute_send_status_display'
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the selection field instead of a char 👀


invoice_user_id = fields.Many2one(
Expand Down Expand Up @@ -774,6 +781,11 @@ def _compute_invoice_default_sale_person(self):
def _compute_is_being_sent(self):
for move in self:
move.is_being_sent = bool(move.sending_data)

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

def _compute_payment_reference(self):
for move in self.filtered(lambda m: (
Expand Down
15 changes: 14 additions & 1 deletion addons/account/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,14 @@
invisible="payment_state == 'invoicing_legacy' or move_type == 'entry'"
optional="show"
/>
<field name="send_status_display"
string="Send Status"
widget="badge"
decoration-danger="is_move_sent == False"
decoration-success="is_move_sent == True"
invisible="state == 'draft'"
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,8 +1589,13 @@
<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 Invoices"
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"
string="Not Sent Invoices"
domain="[('is_move_sent', '=', False)]"
invisible="context.get('default_move_type') in ('in_invoice', 'in_refund', 'in_receipt')"
/>
Expand Down