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] stock: improvement of putaway usability #30889

Closed
wants to merge 1 commit into from

Conversation

svs-odoo
Copy link
Contributor

@svs-odoo svs-odoo commented Feb 6, 2019

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

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@svs-odoo
Copy link
Contributor Author

svs-odoo commented Feb 6, 2019

@sle-odoo for review please :)

@C3POdoo C3POdoo added the RD research & development, internal work label Feb 6, 2019
def _compute_product_template_id(self):
for record in self:
if record.product_id:
record.product_tmpl_id = record.product_id.product_tmpl_id
Copy link
Contributor

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

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Feb 6, 2019
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Feb 7, 2019
@svs-odoo
Copy link
Contributor Author

svs-odoo commented Feb 7, 2019

All changes are been done @sle-odoo

class StockPutawayRule(models.Model):
_name = 'stock.putaway.rule'
_order = 'sequence,product_id'
_description = 'Putaway Rule'
Copy link
Collaborator

@Yenthe666 Yenthe666 Feb 7, 2019

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?

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Feb 7, 2019
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Feb 7, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Feb 7, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Feb 12, 2019
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Feb 15, 2019
@svs-odoo svs-odoo force-pushed the master-change-putaway-svs branch 2 times, most recently from f2a97b2 to b08601d Compare February 15, 2019 08:23
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Feb 15, 2019
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Feb 18, 2019
@svs-odoo
Copy link
Contributor Author

@sle-odoo Commits was squashed. Must wait for runbot, but it was green before to squash, so I think it's OK !

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Feb 18, 2019
self.ensure_one()
domain = ['|',
('product_id', '=', self.id),
('category_id', '=', self.product_tmpl_id.categ_id.id)]
Copy link
Contributor

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

@@ -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):
Copy link
Contributor

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 :)

@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Feb 18, 2019
def _default_category_id(self):
if self.env.context.get('active_model') == 'product.category':
return self.env.context.get('active_id')
return None
Copy link
Contributor

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

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Feb 18, 2019
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
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Feb 25, 2019
@sle-odoo
Copy link
Contributor

robodoo r+

robodoo pushed a commit that referenced this pull request Feb 25, 2019
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
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses merging 👷 and removed merging 👷 labels Feb 25, 2019
@robodoo
Copy link
Contributor

robodoo commented Feb 25, 2019

Merged, thanks!

@robodoo robodoo closed this Feb 25, 2019
@fw-bot fw-bot deleted the master-change-putaway-svs branch October 19, 2019 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants