Skip to content
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
10 changes: 10 additions & 0 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ 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')],
compute="_compute_is_sent",
copy=False
)
Comment on lines +343 to +347

Choose a reason for hiding this comment

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

Rule of thumbs in python, use double quotes when it's something the user will see otherwise use single quotes

Suggested change
invoice_sent_status = fields.Selection(
selection=[('sent', 'Sent'), ('not_sent', 'Not sent')],
compute="_compute_is_sent",
copy=False
)
invoice_sent_status = fields.Selection(
selection=[
('sent', "Sent"),
('not_sent', "Not sent"),
],
compute='_compute_is_sent',
copy=False
)


# === Date fields === #
invoice_date = fields.Date(
Expand Down Expand Up @@ -781,6 +786,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
2 changes: 1 addition & 1 deletion addons/account/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ResCompany(models.Model):
'padding': 5,
'use_date_range': True,
'company_id': self.id,
'prefix': 'BATCH/%(year)s/',
'prefix': 'PAY/%(year)s/',

Choose a reason for hiding this comment

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

This change is good but i think that if runbot was working like a normal pr, you would have a lot of test failing 👀 Take a look at addons/account/tests/test_account_payment_register.py 😄 Run the tests and check the ones that fails and fix them 😄

}),
)

Expand Down
2 changes: 1 addition & 1 deletion addons/account/views/account_menuitem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<menuitem id="menu_finance_entries" name="Accounting" sequence="4" groups="account.group_account_readonly">
<menuitem id="menu_action_move_journal_line_form" action="action_move_journal_line" groups="account.group_account_readonly" sequence="1"/>
<menuitem id="menu_action_account_moves_all" action="action_account_moves_all" groups="account.group_account_readonly" sequence="10"/>
<menuitem id="menu_action_analytic_lines_tree" name="Analytic Items" action="analytic.account_analytic_line_action_entries" groups="account.group_account_invoice,account.group_account_readonly,analytic.group_analytic_accounting" sequence="31"/>
<menuitem id="menu_action_analytic_lines_tree" name="Analytic Items" action="analytic.account_analytic_line_action_entries" groups="analytic.group_analytic_accounting" sequence="31"/>
</menuitem>
<menuitem id="menu_finance_reports" name="Reporting" sequence="20" groups="account.group_account_readonly,account.group_account_invoice">
<menuitem id="account_reports_partners_reports_menu" name="Partner Reports" sequence="3"/>
Expand Down
4 changes: 3 additions & 1 deletion addons/account/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@
<field name="name" string="Journal Item" filter_domain="[
'|', '|', '|',
('name', 'ilike', self), ('ref', 'ilike', self), ('account_id', 'ilike', self), ('partner_id', 'ilike', self)]"/>
<field name="amount_currency" filter_domain="[('amount_currency', '&gt;=', self)]" />

Choose a reason for hiding this comment

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

You used the amount_currency but i don't think that really what we want 👀 The amount currency will be the same as the balance or debit and credit when we have the same currency but it could happen that you do a transaction in dollars when your company is in euro and so the amount_currency will be different. Here we want to be able to search on the balance or debit and credit together 😄
also amount currency could be negative then your code will not work 👀

<field name="name"/>
<field name="ref"/>
<field name="invoice_date"/>
Expand Down Expand Up @@ -523,7 +524,7 @@
<field name="invoice_date" optional="show" column_invisible="context.get('default_move_type') not in ('in_invoice', 'in_refund', 'in_receipt')" readonly="state != 'draft'" string="Bill Date" decoration-warning="abnormal_date_warning"/>
<field name="invoice_date" optional="show" column_invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund', 'out_receipt')" readonly="state != 'draft'" string="Invoice Date" decoration-warning="abnormal_date_warning"/>
<field name="date" optional="hide" string="Accounting Date" readonly="state in ['cancel', 'posted']"/>
<field name="invoice_date_due" widget="remaining_days" optional="show" invisible="payment_state in ('paid', 'in_payment', 'reversed')"/>
<field name="invoice_date_due" widget="remaining_days" optional="show" invisible="payment_state in ('paid', 'in_payment', 'reversed') or state == 'cancel'"/>
<field name="invoice_origin" optional="hide" string="Source Document"/>
<field name="payment_reference" optional="hide" column_invisible="context.get('default_move_type') in ('out_invoice', 'out_refund', 'out_receipt')"/>
<field name="ref" optional="hide"/>
Expand All @@ -549,6 +550,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"/>

Choose a reason for hiding this comment

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

Maybe it would be nice to have a filter for the invoice sent, look at <filter name="not_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
14 changes: 14 additions & 0 deletions addons/l10n_fr_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ def _get_view(self, view_id=None, view_type='form', **options):
shipping_fields[0].attrib.pop("groups", None)
return arch, view

@api.depends('country_code', 'move_type')
def _compute_show_delivery_date(self):
# EXTENDS 'account'
super()._compute_show_delivery_date()
for move in self:
if move.country_code == 'FR':

Choose a reason for hiding this comment

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

Let's use l10n_fr_is_company_french instead 👀 Check why and tell me 😄

move.show_delivery_date = move.is_sale_document()

def _post(self, soft=True):
for move in self:
if move.country_code == 'FR' and move.is_sale_document() and not move.delivery_date:

Choose a reason for hiding this comment

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

you can use show_delivery_date 👀

move.delivery_date = move.invoice_date or fields.Date.context_today(self)
return super()._post(soft)

Choose a reason for hiding this comment

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

In general we put the super on top of the function, because it would happens that the delivery date is modified else where and so the change will not work, also always add the comment for the extend when doing an extension 😄


@api.depends('company_id.country_code')
def _compute_l10n_fr_is_company_french(self):
for record in self:
Expand Down