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

[IMP] No negative by default #258

Closed
wants to merge 2 commits into from
Closed

Conversation

levkar
Copy link

@levkar levkar commented Sep 10, 2016

It is better to have no negative by default if this module is installed

@pedrobaeza
Copy link
Member

WIth this change, you are breaking current tests for other modules, as now you activate the control in all the products. You should inhibit the check when making other tests, but enable it for testing your own module. Look here to see an example: https://github.com/OCA/bank-payment/blob/ea8ec6a7d388d5b5c98dcd1002ad1b766a47dee7/account_payment_transfer_reconcile_batch/models/payment_order.py#L28-L29

@levkar
Copy link
Author

levkar commented Sep 10, 2016

Thanks for the hint!

@pedrobaeza
Copy link
Member

pedrobaeza commented Sep 12, 2016

I prefer that you include the test environment check on the logic itself, not in the default value of the boolean, so that you can decide on each moment how to behave, not only at the beginning. As you are changing also the logic in other PR, maybe you can include both changes in the same PR.

check_no_negative = fields.Boolean(
'Check no negative',
default=_get_default_no_negative_policy,
Copy link

Choose a reason for hiding this comment

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

Use lambda to allow inheritance lambda s: s._get_default_no_negative_policy()

Copy link

Choose a reason for hiding this comment

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

Although I agree with @pedrobaeza comment which would remove this entirely

@lasley lasley added this to the 8.0 milestone Sep 15, 2016
@Cedric-Pigeon
Copy link

@levkar Hello, do you plan to achieve this PR ? Is it still usefull ? Thanks

@levkar
Copy link
Author

levkar commented Jun 29, 2017

I am closing this pull request since there is an alternative #137 and it works as intended in this PR. Moreover stock_disallow_negative module replaces stock_no_negative module on V10 #275 which makes investment to this module meaningless.

@levkar levkar closed this Jun 29, 2017
jaredkipe pushed a commit to hibou-io/oca-stock-logistics-workflow that referenced this pull request May 6, 2019
…#258)

And improve the wording

* Add an option to automatically generate rules

When a product variant is created with a (or several) rule template(s), it
automatically generates (on the fly) the corresponding rule(s). When a rule template
is modified, it automatically updates the existing rules of the linked
products (it uses the mechanism in place, disable the old and create a
fresh one). The latter update is done by a cron because it might take a
long time to update all the products reordering rules.

* Add documentation

* Copy orderpoint views to orderpoint templates

Unfortunately we cannot rely on the possibility to copy a view with
"inherit_id" + "mode=primary" in Odoo 9.0 in this use case (precisely
with a model that is a "copy by prototype").

The explanation:

We "copy by prototype" the model "stock.warehouse.orderpoint" to a new
"stock.warehouse.orderpoint.template" model (with both _inherit and
different _name). Before this commit, we were reusing the
stock.warehouse.orderpoint's views, just making the changes needed for
the templates. Thing is: when a third (unrelated) addon adds a column on
the model, the ORM doesn't add the column in the
stock.warehouse.orderpoint.template model. So the templates' views
complains about this unexisting field.

Therefore, copy-pasting the view ensure that changes on
'stock.warehouse.orderpoint' does not have any side effect on the
templates.

From Odoo 10.0, the "copy by prototype" reports the changes made on the
"prototype" model to the "copy" so we should be able to revert to the
"inherit_id" + "mode=primary" views.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants