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

[17.0][MIG] stock_orderpoint_generator #18

Open
wants to merge 32 commits into
base: 17.0
Choose a base branch
from

Conversation

astirpe
Copy link
Member

@astirpe astirpe commented May 24, 2024

No description provided.

Cyril Gaudin and others added 30 commits May 24, 2024 11:49
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.
Currently translated at 50.7% (38 of 75 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_orderpoint_generator/sl/
With initial wrong values we can carry a computing error to the
subsequent moves.
A new option for auto computing minimum and maximum values depending on
the actual delivered items for a period of time
Currently translated at 23.6% (18 of 76 strings)

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/it/
Currently translated at 23.6% (18 of 76 strings)

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/it/
Currently translated at 23.6% (18 of 76 strings)

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/
The Size attribute is already defined in the point_of_sale module so
when both modules are installed an error occurs in the tests. This is
solved by changing the name of the attribute in the tests of the
stock_orderpoint_generator module.

TT41548
Currently translated at 20.0% (18 of 90 strings)

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/it/
Currently translated at 100.0% (90 of 90 strings)

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_orderpoint_generator
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_orderpoint_generator/
@astirpe astirpe marked this pull request as ready for review May 24, 2024 09:56
@astirpe
Copy link
Member Author

astirpe commented May 24, 2024

@rousseldenis
moved here!

@api.model_create_multi
def create(self, vals_list):
products = super().create(vals_list)
for product in products.filtered(lambda pp: pp.auto_orderpoint_template_ids):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for product in products.filtered(lambda pp: pp.auto_orderpoint_template_ids):
for product in products.filtered("auto_orderpoint_template_ids"):

Copy link

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 Nov 10, 2024
@rousseldenis
Copy link
Contributor

/ocabot migration stock_orderpoint_generator

Copy link
Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

Little change

("company_id", "=", False),
("company_id", "=", template.company_id.id),
]
template.allowed_warehouse_ids = self.env["stock.warehouse"].search(domain)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to do the search outside the loop and then grouping templates per company and filter.

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Nov 17, 2024
@PicchiSeba
Copy link
Contributor

Hello @astirpe , I started working on the migration to 16.0 of this same module #27. Would you mind isolating the changes made to add the allowed_warehouse_ids/allowed_location_ids fields in a separate commit? This way I can cherry-pick it in my PR and preserve your authorship.

Copy link
Contributor

@PicchiSeba PicchiSeba left a comment

Choose a reason for hiding this comment

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

Code review:

We should squash administrative commits.

The commits def4859 and 9f3d791 should be squashed into f4e3ff0

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.