-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
[IMP] accounting v16. Yeeeeaah #96134
Conversation
6684bb9
to
2c44bce
Compare
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.
WIP
- JS not reviewed
- some unnecessary diff (like in tests), might be worth moving those in dedicated ref commit(s)
vals['partner_bank_id'] = partner_banks[vals['payment_values']['payment_type']] | ||
vals['lines'] = lines | ||
batch_vals.append(vals) | ||
return batch_vals |
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.
what's that diff? not related to the task?
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.
My task uncovered a nasty bug. It isn't related to the task, but tests were failing.
I'll do a back port
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.
👍
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.
WIP
b9839c1
to
c0a982a
Compare
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.
- changes in odoo/tests should not be here
- next: enterprise branch
@@ -782,6 +782,10 @@ tour.stepUtils.openBuggerMenu("li.breadcrumb-item.active:contains('OP/')"), | |||
trigger:".o_field_widget[name=invoice_date] input", | |||
content: _t('Set the invoice date'), | |||
run: "text 01/01/2020", | |||
}, { | |||
trigger: ".modal-footer .btn-primary:contains('Ok')", | |||
content: _t('Aknowledge warning'), |
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.
what warning?
@@ -307,6 +299,7 @@ def test_in_invoice_line_onchange_product_2_with_fiscal_pos(self): | |||
}) | |||
|
|||
uom_dozen = self.env.ref('uom.product_uom_dozen') | |||
self.env.user.groups_id += self.env.ref('uom.group_uom') |
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.
c0a982a
to
376b132
Compare
a98af4d
to
7e12acb
Compare
@odoo/rd-security
The code is only moved. It should also be safe because it is getting values that are built from |
574d7a3
to
207b9ca
Compare
When renumbering the moves, a lot of recomputes were executed, specially after Yeeeeaah was merged (a.k.a. odoo/odoo#96134). None of those recomputes is needed. The entry number we're adding here has no impact on taxes, invoices, or anything related. We can just skip all that stuff and make renumbering actually be able to finish in less than 100 years. @moduon MT-2806
Using an attribute in the context to force the change of the state of the accounting entries for CABA and Exchange Differential to "draft." This is to allow the deletion of these entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the button_cancel method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconcile and reconcile process. [1] odoo@1de5c98 Related: odoo#96134
When renumbering the moves, a lot of recomputes were executed, specially after Yeeeeaah was merged (a.k.a. odoo/odoo#96134). None of those recomputes is needed. The entry number we're adding here has no impact on taxes, invoices, or anything related. We can just skip all that stuff and make renumbering actually be able to finish in less than 100 years. @moduon MT-2806
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 Related: odoo#96134
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 closes #170067 Related: #96134 Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 Related: odoo#96134 X-original-commit: 506786d
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 closes #172432 Related: #96134 X-original-commit: 506786d Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 Related: odoo#96134 X-original-commit: 506786d
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 closes #172456 Related: #96134 X-original-commit: 506786d Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 Related: odoo#96134 X-original-commit: 9cf5a94
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 Related: odoo#96134 X-original-commit: 9cf5a94
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 closes #173417 Related: #96134 X-original-commit: 9cf5a94 Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 Related: odoo#96134 X-original-commit: fe1d3ec
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 closes #173943 Related: #96134 X-original-commit: fe1d3ec Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
The restrictions on `button_draft` method on account move was moved to a new method to allow inherit and mute the restrictions in necessary cases for some customizations. A user case is the next: Allow the deletion of cash basis or Exchange Differential entries to facilitate the accounting audit process. As the number of lines in the accounting entries generated by these transactions can grow significantly, this occurs each time a payment that has generated CABA or Exchange Differential entries is canceled or unreconciled, reverse lines are generated for these entries. Setting the posted journal entries to "draft" when canceling by using the `button_cancel` method was introduced in [1], this not allow to delete the CABA or Exchange Differential entries generated in the unreconciled and reconcile process. [1] 1de5c98 closes odoo#172456 Related: odoo#96134 X-original-commit: 506786d Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
TLDR:
to improve perfs.
The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
create
andwrite
before showing the values
This comes with numerous advantages:
intercompany, ...)
from 2 minutes to 4 seconds to create an invoice with 500 lines
instead of having the values being copied from various places.
onchange
that disabled the recursivity of it,which was unexpected and needed to be managed manually in all the
onchange methods
This means that:
or invoice values, more specifically the Tax Summary widget.
It is now
will need to be recomputed anyways, erasing previously set values
(i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
This is because such a behavior was undefined (how is changing the balance going
to affect the unit price? How is the amount currency going to affect it?)
Implementation Details
The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the
create
andwrite
functions.In order to reduce code duplication, it has been implemented using
context managers used in both
account.move
andaccount.move.line
These context managers help comparing the values before/after, acting
like a local
onchange
, but getting benefit from the dirty flags fromthe
compute
dependences.This is relying on computed fields on the move (
needed_terms
) and onthe lines (
compute_all_tax
) which contain the values needed for therelated move.
Depending on the needed values and the existing values (
term_key
andtax_key
, respectively) the context manager will determine what needsto be created/updated/deleted.
Some related changes are to produce a
dict
instead of astr
for thetax_totals
(previouslytax_totals_json
) fields, by simplicity toreduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)
By simplicity, and also because it makes more sense, some boolean fields
have been merged into
display_type
:is_rounding_line
exclude_from_invoice_tab
is_anglo_saxon_line
The
price_unit
,quantity
and other "invoice fields" are now not setanymore on lines that are not product lines since it didn't make any
sense to have it.
Performances
You have to keep in mind that a simple
create
didn't compute a lot offields, for instance not taxes were set, no payment terms,...
Now it does.
Another metric that can be used is running the test suite with
--test-tags=/account
(onlyaccount
installed)Why this commit title?
Someone told me that this was the perfect way of naming your commits.
c04065a