-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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] stock: improvement of putaway usability #30889
Conversation
@sle-odoo for review please :) |
def _compute_product_template_id(self): | ||
for record in self: | ||
if record.product_id: | ||
record.product_tmpl_id = record.product_id.product_tmpl_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.
not sure if it is useful
de75408
to
d4749a4
Compare
d4749a4
to
8963d48
Compare
All changes are been done @sle-odoo |
class StockPutawayRule(models.Model): | ||
_name = 'stock.putaway.rule' | ||
_order = 'sequence,product_id' | ||
_description = 'Putaway Rule' |
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.
@svs-odoo also needs a _rec_name
set as there is no name
field on this model?
8963d48
to
a12c2ed
Compare
a12c2ed
to
a08d02e
Compare
aa73d3e
to
d54b74d
Compare
d54b74d
to
2d8bd53
Compare
f2a97b2
to
b08601d
Compare
b08601d
to
344ff5a
Compare
344ff5a
to
4525a9d
Compare
@sle-odoo Commits was squashed. Must wait for runbot, but it was green before to squash, so I think it's OK ! |
addons/stock/models/product.py
Outdated
self.ensure_one() | ||
domain = ['|', | ||
('product_id', '=', self.id), | ||
('category_id', '=', self.product_tmpl_id.categ_id.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.
domain = [
'|',
('product_id', '=', self.id),
('category_id', '=', self.product_tmpl_id.categ_id.id),
]
is more readable
also i would create an helper to return the action instead of calling the public method of product_tmpl with an argument
in the product_template you could
@api.model
def _get_action_view_related_putaway_rules(domain):
return {
'name': _('Putaway Rules'),
'type': 'ir.actions.act_window',
'res_model': 'stock.putaway.rule',
'view_type': 'list',
'view_mode': 'list',
'domain': domain,
}
and call this helper in the two action_view_related_putaway_rules
addons/stock/models/product.py
Outdated
@@ -593,6 +601,20 @@ def action_open_quants(self): | |||
action['context'] = {'search_default_internal_loc': 1} | |||
return action | |||
|
|||
def action_view_related_putaway_rules(self, **params): |
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.
we don't usually use **params in Odoo + i don't think it's the proper way to do things in a method called by a button in a form
pleae remove this arg and create a private method to return the action as per my previous comment
thank you :)
4525a9d
to
a03d942
Compare
def _default_category_id(self): | ||
if self.env.context.get('active_model') == 'product.category': | ||
return self.env.context.get('active_id') | ||
return None |
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.
You can remove the return None
PutAwayStrategy model was deleted and FixedPutAwayStrategy model was renamed into PutAwayRule. Now, each location can contain multiple putaway rules, each rule applying either on product or on product category. The purpose is to: - Add more visibility on putaway settings (with a stat button on product, product category and location views, and a submenu item in Product configuration menu). - Change putaway model to avoid redundancy. Task #1935169
a03d942
to
d6b6eff
Compare
robodoo r+ |
PutAwayStrategy model was deleted and FixedPutAwayStrategy model was renamed into PutAwayRule. Now, each location can contain multiple putaway rules, each rule applying either on product or on product category. The purpose is to: - Add more visibility on putaway settings (with a stat button on product, product category and location views, and a submenu item in Product configuration menu). - Change putaway model to avoid redundancy. Task #1935169 closes #30889
Merged, thanks! |
PutAwayStrategy model was deleted and FixedPutAwayStrategy model was renamed into PutAwayRule.
Now, each location can contain multiple putaway rules, each rule applying either on product or on product category.
The purpose is to:
Task #1935169
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr