-
-
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
[16.0][mig] sale_last_price_info #2471
[16.0][mig] sale_last_price_info #2471
Conversation
Changed website in manifest
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-12.0/sale-workflow-12.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_last_price_info/
Currently translated at 100.0% (7 of 7 strings) Translation: sale-workflow-12.0/sale-workflow-12.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_last_price_info/es/
Currently translated at 100.0% (7 of 7 strings) Translation: sale-workflow-12.0/sale-workflow-12.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_last_price_info/de/
Currently translated at 100.0% (7 of 7 strings) Translation: sale-workflow-12.0/sale-workflow-12.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_last_price_info/zh_CN/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-13.0/sale-workflow-13.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_last_price_info/
Currently translated at 100.0% (8 of 8 strings) Translation: sale-workflow-13.0/sale-workflow-13.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_last_price_info/zh_CN/
Currently translated at 100.0% (8 of 8 strings) Translation: sale-workflow-13.0/sale-workflow-13.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_last_price_info/es/
Currently translated at 100.0% (11 of 11 strings) Translation: sale-workflow-14.0/sale-workflow-14.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_last_price_info/ca/
Currently translated at 100.0% (11 of 11 strings) Translation: sale-workflow-14.0/sale-workflow-14.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_last_price_info/nl/
Currently translated at 72.7% (8 of 11 strings) Translation: sale-workflow-14.0/sale-workflow-14.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_last_price_info/fr_FR/
Currently translated at 100.0% (8 of 8 strings) Translation: sale-workflow-14.0/sale-workflow-14.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_last_price_info/fr/
Currently translated at 100.0% (8 of 8 strings) Translation: sale-workflow-14.0/sale-workflow-14.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_last_price_info/de/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-15.0/sale-workflow-15.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_last_price_info/
Currently translated at 100.0% (8 of 8 strings) Translation: sale-workflow-15.0/sale-workflow-15.0-sale_last_price_info Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_last_price_info/it/
/ocabot migration sale_last_price_info |
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
sale_last_price_info/__manifest__.py
Outdated
"website": "https://github.com/OCA/sale-workflow", | ||
"category": "Sales", | ||
"license": "AGPL-3", | ||
"contributors": [ |
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 not a valid entry. Should be in CONTRIBUTORS.rst only.
If some of them (or you) want to adopt as maintainer, you should add a "maintainers":[<github login>, ...]
instead
"""Get last sale price, last sale date and last customer""" | ||
so_line_obj = self.env["sale.order.line"] | ||
for product in self: | ||
line = so_line_obj.search( |
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.
Something has to be done here as this will generate as many queries as products in recordset.
limit=1, | ||
order="date_order_sale_last_price_info desc", | ||
) | ||
product.last_sale_date = fields.Datetime.to_string( |
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.last_sale_date = fields.Datetime.to_string( | |
product.update({ | |
"last_sale_date" : fields.Datetime.to_string(line.date_order_sale_last_price_info), | |
"last_sale_price": line.price_unit, | |
"last_customer_id": line.order_id.partner_id, | |
}) |
product.last_sale_price = line.price_unit | ||
product.last_customer_id = line.order_id.partner_id | ||
|
||
last_sale_price = fields.Float(compute="_compute_last_sale") |
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.
Fields definitions should be on top
self.price_unit = 100.0 | ||
|
||
def test_sale_last_price_info_demo(self): | ||
sale_line = self.sale_line_model.search( |
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's better to rely on new records created in test. Then, don't search but rely on the record values you've just created.
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 and functional review
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at dc6b04d. Thanks a lot for contributing to OCA. ❤️ |
No description provided.