-
Notifications
You must be signed in to change notification settings - Fork 117
[IMP] l10n_fr_account: delivery date added on french invoices #4859
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
base: 18.0-rd-accounting-onboarding-malb
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,3 +20,16 @@ def _get_view(self, view_id=None, view_type='form', **options): | |
| def _compute_l10n_fr_is_company_french(self): | ||
| for record in self: | ||
| record.l10n_fr_is_company_french = record.country_code in record.company_id._get_france_country_codes() | ||
|
|
||
| @api.depends('country_code', 'move_type') | ||
| def _compute_show_delivery_date(self): #EXTEND 'account' | ||
| super()._compute_show_delivery_date() | ||
| for move in self: | ||
| if move.l10n_fr_is_company_french: | ||
| move.show_delivery_date = move.is_sale_document() | ||
|
|
||
| def _post(self, soft=True): | ||
| for move in self: | ||
| if move.show_delivery_date and not move.delivery_date: | ||
| move.delivery_date = move.invoice_date or fields.Date.context_today(self) | ||
| return super()._post(soft) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Care with the super that if in the execution the delivery date is modified then the behavior would be different so i would put the super at the beginning of the function to be extra safe
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't understand this, if I put super at the beginning what would the function return ? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also when doing extension of compute it's nice to have a comment like # EXTEND 'account'
if you look at the code you should be able to find many example