-
-
Notifications
You must be signed in to change notification settings - Fork 695
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
[11.0][MIG] stock_putaway_product #380
Conversation
You should remove the extra module here, and don't make to depend this one on it. If you want the extra feature, you install the other module. If not (as most people), then you don't. |
@pedrobaeza Actually the extra module is required here because it adds the method field back that |
Then you will need to create another glue module between then, but you can't force people that want the putaway strategy at product level but don't want other strategies except fixed location to also install the other module. |
@asaunier what @pedrobaeza means here is that you shouldn't include the commits of the PR for @pedrobaeza the other module is simply a dependency. Fixed location is the name of the standard odoo behavior. The same name was kept from v10. |
Well, I insist that the module shouldn't be a dependency. To have the putaway strategy at product level you don't need the field to say what strategy to use. Do you understand me? |
@pedrobaeza The module The module in the current PR So let me insist on my argument against your insistence but If you mean that the module |
Hi there, I'm also find more convenient to have a module listing the putaway methods for a given product. We'll need to develop more methods in a near future, so having a generic module to gather a same manner to define them sounds good to me. @pedrobaeza what is bad with this ? Do you think it is better that each module providing putawy method define its own ? I don't understand may be ? @lreficent @jbeficent any opinion ? This is on the dependency chain of DDMRP wip. |
The PR is now ready. The last commit 6811080 ( The actual changes are done by commit d695c17 What it does:
@jgrandguillaume I have checked in the Odoo UI the changes were consistent but having an expert user test would make sense as well, thanks :) |
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.
apart from some minor things, a fall back variant should be present for strategies, imo
stock_putaway_product/README.rst
Outdated
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/153/10.0 |
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.
this should point to 11.0 ;)
* Jos De Graeve - Apertoso N.V. <Jos.DeGraeve@apertoso.be> | ||
* Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com> | ||
* Denis Roussel - ACSONE SA/NV <denis.roussel@acsone.eu> | ||
* Thomas Fossoul - WINK SA/NV <tfossoul@wink.be> |
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.
consider adding yourself as a contributor
stock_putaway_product/__init__.py
Outdated
@@ -0,0 +1,5 @@ | |||
# © 2016 Jos De Graeve - Apertoso N.V. <Jos.DeGraeve@apertoso.be> |
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.
© -> Copyright
adding
# Copyright 2018 Camptocamp SA
would be a good move ;)
same for other files as well
product_putaway_ids = fields.One2many( | ||
comodel_name='stock.product.putaway.strategy', | ||
inverse_name='product_tmpl_id', | ||
string="Product stock locations") |
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.
not blocking but I would be consistent with formatting and change the last row to
string="Product stock locations",
)
""" Custom redefinition of fields_view_get to adapt the context | ||
to product variants. | ||
""" | ||
res = super(ProductProduct, self).fields_view_get(view_id=view_id, |
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.
super in python3 no longer requires explicit class and instance definition, also I'd change the formatting
|
||
@api.model | ||
def _get_putaway_options(self): | ||
ret = super(ProductPutaway, self)._get_putaway_options() |
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.
same as above
strategy = product.product_putaway_ids.filtered( | ||
lambda strategy: (strategy.putaway_id == self)) | ||
if not strategy: | ||
strategy = product.product_tmpl_id.product_putaway_ids.filtered( |
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.
I think that a fallback variant is still required. As if, for whatever reason, Not product, nor it's template has a strategy -> this will fail. And this is pretty much possible as we saw during fixing of the tests.
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.
It indeed makes sense. Here is what I suggest with 83d1bfa:
- if
method == 'per_product'
and if a strategy has been found:
return strategy.fixed_location_id.id
(as formerly) - else fall back to the parent class
putaway_apply
function
# right location to update stock. | ||
@api.model | ||
def default_get(self, fields): | ||
res = super(StockChangeProductQty, self).default_get(fields) |
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.
update super ;)
… and Warehouse/Manager can access to the product form. After this PR, all users can access to the product form, but only users that belong to the group "Warehouse/User" can access to the section for Putaway strategies in the Inventory tab.
What I was trying to say is to remove the need of the strategy type and only relies in the one2many table. You don't need to say "My strategy is 'per product'", but only to add products with their locations in the strategy, and when getting the putaway location, look at that table. If there's a match, then put it. If not, call super. Do you understand me? |
My opinion here is more in line with @jgrandguillaume I think is better to specifically select the strategy you want to apply (it will more user friendly I think). It also does not add that much complexity in the development side, in fact it ease the migration as the functionality keep exatly the same and it allows to add more strategies in the future without any extra complexity in the inheritance chain to make the current methods and the new ones coexist (in this sense you just select the method you want to apply among the ones installed). |
OK |
@@ -13,7 +12,7 @@ class StockChangeProductQty(models.TransientModel): | |||
# right location to update stock. | |||
@api.model | |||
def default_get(self, fields): | |||
res = super(StockChangeProductQty, self).default_get(fields) | |||
res = super().default_get(fields) |
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 means empty super?
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.
New in Python 3. It saves you to put class and instance
@yvaucher Perhaps you could remove the "work in progress" label since the PR is ready for reviewing. Thanks :) |
Sorry, I have seen the PR before but it miss this code from v8. Only if it's interesting for someone. |
FYI, Odoo has integrated in master (v12) the possibility of defining putaway strategy per product: |
thanks a lot @pedrobaeza |
@pedrobaeza Nice! At least they did it. |
Migration of module stock_putaway_product to Odoo 11.
Requires the new stock_putaway_method module introduced by #379 to restore the
method
selector removed from thestock
module of Odoo 11. As for now I have cherry-picked it into this branch.Still investigating problems with
product_tmpl_id
...Depends on: