-
Notifications
You must be signed in to change notification settings - Fork 12
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
[3811][11.0][REF] stock_ext_sst #356
Conversation
target="new" | ||
view_type="form" | ||
/> | ||
</odoo> |
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.
End with a whitespace.
"license": "AGPL-3", | ||
"depends": [ | ||
"stock", | ||
"stock_quant_list_view", |
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.
@kanda999 Please check if we should reverse the dependencies. In fact, please check if we can get rid of stock_quant_list_view by delegating necessary changes on stock.quant list to other existing modules.
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.
@AungKoKoLin1997
We can remove this module by moving stock_quant.py to product_yahoo_auction_sst and adjusting the view in stock_quant_list_view.
stock_quant_list_view contains product_ext_sst as a dependency, so product_yahoo_aution_sst is installed.
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.
product_publish_cron
module depended on the stock_ext_sst
module.
Could you check and update this PR?
@AungKoKoLin1997 Can you please summarize all the changes in the top comment. |
# Using mapped to gather all product_tmpl_id records | ||
product_templates = quants.mapped('product_id.product_tmpl_id') | ||
product_templates.sudo().write(values) |
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.
Shouldn't this suffice?
# Using mapped to gather all product_tmpl_id records | |
product_templates = quants.mapped('product_id.product_tmpl_id') | |
product_templates.sudo().write(values) | |
quants.mapped("product_id").sudo().write(values) |
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, I'm a bit confused about the scope as stock_quant_status_update also seems to update yahoo_product_state_id
of the product. Please check to make sure we are not duplicating functions.
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 checked with the customer and they can update yahoo_product_state_id
alone. And they have an operation to update yahoo_product_state_id
whenever they publish the website.
If each function were to stand alone, it need two operations to publish the product on the website, and it would be difficult to know which product's yahoo_product_state_id
was updated.
list_price = fields.Float( | ||
related="product_id.product_tmpl_id.list_price", string="Sale Price", | ||
) | ||
product_id = fields.Many2one(auto_join=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.
Please correct me if you have a different understanding of the reason of this change.
product_id = fields.Many2one(auto_join=True,) | |
# To improve search performance by product. | |
product_id = fields.Many2one(auto_join=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 delivery
as a dependency?
Add website
as a dependency.
_inherit = "stock.quant" | ||
|
||
website_published = fields.Boolean( | ||
related="product_id.product_tmpl_id.website_published", |
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.
related="product_id.product_tmpl_id.website_published", | |
related="product_id.website_published", |
_inherit = "stock.quant" | ||
|
||
yahoo_product_state_id = fields.Many2one( | ||
related="product_id.product_tmpl_id.yahoo_product_state_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.
related="product_id.product_tmpl_id.yahoo_product_state_id", | |
related="product_id.yahoo_product_state_id", |
if self.yahoo_product_state_id.id == int( | ||
self.env["ir.config_parameter"] | ||
.sudo() | ||
.get_param("stock_ext_sst.picking_product_state_id") | ||
.get_param("stock_quant_status_update.picking_product_state_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.
This is bad. Move this part outside the for loop.
Add a migration script to update the param key, or communicate with @kanda999 to cover this part manually.
@@ -16,11 +16,12 @@ def action_stock_quant_status_update(self): | |||
active_ids = context.get("active_ids", []) | |||
quants = self.env["stock.quant"].browse(active_ids) | |||
values = {"yahoo_product_state_id": self.yahoo_product_state_id.id} | |||
parmas_product_state_id = int( |
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 is parmas
? You mean param
?
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.
Code review.
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 and code review
3811
This PR does-
stock_ext_sst
tostock_quant_attribute
)stock_ext_sst
tostock_quant_attribute
product_yahoo_auction_sst
yahoo_product_state_id
tostock_quant_list_view
stock_quant_product_publish
for publishing products and assigning the yahoo_product_state_id from stock quant modelstock_quant_status_update
that updatesyahoo_product_state_id
for products and updates the quantity_done in stock_move depends onyahoo_product_state_id