-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[ADD] sale_stock_partner_warehouse #3044
[ADD] sale_stock_partner_warehouse #3044
Conversation
e40e34c
to
d3e90d7
Compare
], | ||
"depends": [ | ||
"sale_stock", | ||
"delivery", |
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.
why delivery
?
If it's only for the view, you can simply use <group name="sale" position="inside">
.
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 removed dependency
_inherit = "sale.order" | ||
|
||
warehouse_id = fields.Many2one( | ||
compute="_compute_warehouse_id", store=True, precompute=True |
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.
why precompute
?
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.
To compute the value before the record creation
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.
@santostelmo As warehouse_id is defined in sale_stock, you don't need to repeat the properties. Just override _compute_warehouse_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.
@santostelmo I know, I mean... why do you need that? I guess it's because the wh is supposed to be already there on create.
If there's a motivation, it's worth to add a comment there.
d3e90d7
to
6932b67
Compare
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.
LGTM!!
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
sale_warehouse_id = fields.Many2one("stock.warehouse", string="Sale Warehouse") |
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.
IMHO, this should be company dependent.
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 agree. The company of the partner, if defined must be consistent with the one set in the warehouse
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.
Actually after thinking about that I think we don't want to have sale_warehouse_id
dependent of the company. We want to be able to select any warehouse from active companies.
With that option a Sale can be created in a company A and Delivered from the Warehouse of the company B
compute="_compute_warehouse_id", store=True, precompute=True | ||
) | ||
|
||
@api.depends("user_id", "company_id", "partner_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.
You don't need to repeat user_id and company_id. Odoo will append partner_id to depends list
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.
Thank you I updated that
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.
Functional review on runboat! LGTM!
@simahawk Could you update your review ? |
6932b67
to
4d0cea5
Compare
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.
Minor remark, LG otherwise
_inherit = "sale.order" | ||
|
||
warehouse_id = fields.Many2one( | ||
compute="_compute_warehouse_id", store=True, precompute=True |
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.
@santostelmo I know, I mean... why do you need that? I guess it's because the wh is supposed to be already there on create.
If there's a motivation, it's worth to add a comment there.
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 1d4ae62. Thanks a lot for contributing to OCA. ❤️ |
Description
Allow to choose by default a warehouse on SO based on a Partner parameter.
If the warehouse parameter is completed, then this value would be the default one on the sale.
If empty, then the warehouse on sale would be the standard default warehouse.