Skip to content
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

[15.0][FIX] sale_timesheet_rounded: avoid recomputing rounded amounts when not needed #590

Open
wants to merge 3 commits into
base: 15.0
Choose a base branch
from

Conversation

StephaneMangin
Copy link

@StephaneMangin StephaneMangin commented Jun 7, 2023

Superseed #585

This is causing the field to be set as computed, but there is no real change

We don't want to compute the field in these cases:

This is causing the field aal.project_id to be considered as computed, but it is not.
It will then call the @api.depends('project_id',...) on the computation of the unit_amount_rounded (even if there was no change on the value of aal.project_id.

@StephaneMangin StephaneMangin force-pushed the 15_fix_timesheet_rounded_when_posting_an_invoice branch 2 times, most recently from a6c43eb to c7733aa Compare June 7, 2023 14:23
@StephaneMangin StephaneMangin changed the title [15.0][FIX] sale_timesheet_rounded: avoid recomputing rounded amounts… [15.0][FIX] sale_timesheet_rounded: avoid recomputing rounded amounts when not needed Jun 7, 2023
@StephaneMangin StephaneMangin force-pushed the 15_fix_timesheet_rounded_when_posting_an_invoice branch 7 times, most recently from 51d9598 to 8ab89bf Compare June 8, 2023 14:30
@ivs-cetmix
Copy link
Member

Hi @StephaneMangin thank you for your contribution! Could you please rebase and check the tests again?

@StephaneMangin StephaneMangin force-pushed the 15_fix_timesheet_rounded_when_posting_an_invoice branch 2 times, most recently from 67e584a to b673910 Compare November 6, 2023 12:41
Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

Can you please:

  1. rewrite the 1st commit msg to include the explanation given in the description of the PR? (TIP: if you do it before, you get the description for free on the PR 😉 ). As you rewrite the commit pls drop the odoo version.
  2. can you explain what is the conflict in tests? We should try to avoid rebels modules as far as possible

@@ -14,7 +14,8 @@ odoo_test_flavor: Both
odoo_version: 15.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
rebel_module_groups:
- sale_timesheet_rounded
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the conflict in particular?

Choose a reason for hiding this comment

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

Hello, I don't remember the exact fault, but AFAIR this was a good idea. Is this a blocking comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is, if not justified. The issue is that when we increase the number of tests suites that will run.
So, what is the conflict? Can't we find a better way to prevent that? Eg: disable partly of fully this feature when not needed?

Choose a reason for hiding this comment

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

@sonhd91 worked on a fix for that in the context of the migration of this module to 17.0; he will backport it and follow-up here

Copy link

@sonhd91 sonhd91 Mar 27, 2024

Choose a reason for hiding this comment

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

@api.depends("timesheet_invoice_id.state")
def _compute_project_id(self):
field_rounded = self._fields["unit_amount_rounded"]
if self._context.get("timesheet_no_recompute", False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if self._context.get("timesheet_no_recompute", False):
if self.env.context.get("timesheet_no_recompute", False):

_inherit = "sale.advance.payment.inv"

def create_invoices(self):
"""Override method from sale/wizard/sale_make_invoice_advance.py
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a comment

Co-authored-by: Nils Hamerlinck <nilshamerlinck@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants