Skip to content
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
11 changes: 11 additions & 0 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ def _sequence_year_range_monthly_regex(self):
copy=False,
domain=[('display_type', 'in', ('product', 'line_section', 'line_note'))],
)
invoice_sent_status = fields.Selection(
selection=[('sent', "Sent"), ('not_sent', "Not sent")],

Choose a reason for hiding this comment

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

Suggested change
selection=[('sent', "Sent"), ('not_sent', "Not sent")],
selection=[
('sent', "Sent"),
('not_sent', "Not sent")
],

Choose a reason for hiding this comment

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

missing this change 👀

compute='_compute_is_sent',

Choose a reason for hiding this comment

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

Convention for the compute it should generally be like this, you take the name of the field as the name of compute (except if the compute is present on multiple field)

Suggested change
compute='_compute_is_sent',
compute='_compute_invoice_sent_status',

copy=False,
store=True
)

# === Date fields === #
invoice_date = fields.Date(
Expand Down Expand Up @@ -781,6 +787,11 @@ def _compute_invoice_default_sale_person(self):
else:
move.invoice_user_id = False

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

@api.depends('sending_data')
def _compute_is_being_sent(self):
for move in self:
Expand Down
10 changes: 10 additions & 0 deletions addons/account/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@
invisible="payment_state == 'invoicing_legacy' or move_type == 'entry'"
optional="show"
/>
<field name="invoice_sent_status" string="Sent" optional="hide" widget="badge" decoration-success="is_move_sent" decoration-warning="not is_move_sent"/>
<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 @@ -1594,6 +1595,15 @@
<filter name="not_secured" string="Not Secured" domain="[('secured', '=', False), ('state', '=', 'posted')]"
groups="account.group_account_secured,base.group_no_one"/>
<separator/>
<filter name="invoice_sent_status"
string="Sent invoices"
domain="[('invoice_sent_status', '=', 'sent')]"
/>
<filter name="invoice_sent_status"
string="Not sent invoices"
domain="[('invoice_sent_status', '=', 'not_sent')]"
/>
Comment on lines +1598 to +1605

Choose a reason for hiding this comment

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

Just look at the one below, the not_sent is already present so let's do the same but for sent, no need to add those extra 😄

<separator/>
<filter name="not_sent"
string="Not Sent"
domain="[('is_move_sent', '=', False)]"
Expand Down