Skip to content

[18.0][IMP] product_contract - remove unnecessary defaults#1315

Open
anthonissen-a wants to merge 1 commit intoOCA:18.0from
acsone:18.0-product_contract_remove_defaults-aan
Open

[18.0][IMP] product_contract - remove unnecessary defaults#1315
anthonissen-a wants to merge 1 commit intoOCA:18.0from
acsone:18.0-product_contract_remove_defaults-aan

Conversation

@anthonissen-a
Copy link
Copy Markdown

The default attributes are no longer necessary since the fields are set by the compute method with a precompute attribute.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @sbejaoui,
some modules you are maintaining are being modified, check this out!

@pedrobaeza pedrobaeza changed the title [IMP] product_contract - remove unnecessary defaults [18.0][IMP] product_contract - remove unnecessary defaults Oct 7, 2025
@yvaucher
Copy link
Copy Markdown
Member

yvaucher commented Oct 16, 2025

👍

By the way according to odoo official doc, the default value disables the precompute.

image

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 22, 2026
@pedrobaeza pedrobaeza added this to the 18.0 milestone Feb 23, 2026
Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Looking at the code, we are not going to have the proper value in the line init, as the compute is not assigning any default value.

@anthonissen-a
Copy link
Copy Markdown
Author

Hi @pedrobaeza, thanks for your review.
Since the fields have precompute=True, the compute function will be triggered at line init. As @yvaucher mentioned, the tags default and precompute can't be used together because they have conflicting behaviors.

@pedrobaeza
Copy link
Copy Markdown
Member

I understood the contrary: the default is applied instead of the compute.

@anthonissen-a
Copy link
Copy Markdown
Author

Exactly, and therefore the default should be removed, to allow a proper use of the precompute.

@pedrobaeza
Copy link
Copy Markdown
Member

But that can't be done if the compute is not providing the same default value, which is not the case.

@yvaucher
Copy link
Copy Markdown
Member

@pedrobaeza Please read again the offical doc warning (see my post upper).

default and precompute are incompatible, thus one must go.

Are you saying that we should move the default values in the "init" values of the compute?

For instance 'recurring_interval: 1

It could make sense even for the compute acting as an onchange on the view that if you change the product to a non contract product. As you want plausible default values.

@pedrobaeza
Copy link
Copy Markdown
Member

OK to renew the compute method

@anthonissen-a
Copy link
Copy Markdown
Author

Do you have a case where these values are used in another context than with products of type contract ? Otherwise, the values of these fields will be overwritten by the compute when a product of type contract is set.

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 1, 2026
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.

5 participants