Skip to content

[IMP] account: Add more visibility about the sent status of invoice #4807

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
10 changes: 10 additions & 0 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,11 @@ def _sequence_year_range_monthly_regex(self):
tracking=True,
help="It indicates that the invoice/payment has been sent or the PDF has been generated.",
)
move_sent_status = fields.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.

nitpicking here but you split in multiple line for readability, also small rule of thumbs that i like:

  • Use double quotes when the user see the info (so here Sent and Not Sent could be in double quotes)
  • use single quotes otherwise

string='Move Sent Status',
compute='_compute_move_sent_status'
)
is_being_sent = fields.Boolean(
help="Is the move being sent asynchronously",
compute='_compute_is_being_sent'
Expand Down Expand Up @@ -775,6 +780,11 @@ 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_move_sent_status(self):
for record in self:
record.move_sent_status = 'sent' if record.is_move_sent else 'not_sent'

def _compute_payment_reference(self):
for move in self.filtered(lambda m: (
m.state == 'posted'
Expand Down
12 changes: 12 additions & 0 deletions addons/account/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,13 @@
<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"/>
<field name="move_sent_status"
optional="hide"
string="Sent Status"
widget="badge"
decoration-success="move_sent_status == 'sent'"
decoration-danger="move_sent_status == 'not_sent'"
/>
</list>
</field>
</record>
Expand Down Expand Up @@ -1581,6 +1588,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