[18.0][MIG] sale_order_line_input: Migration to 18.0#3458
Closed
[18.0][MIG] sale_order_line_input: Migration to 18.0#3458
Conversation
[UPD] README.rst [UPD] Update sale_order_line_input.pot
[UPD] Update sale_order_line_input.pot [UPD] README.rst Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-12.0/sale-workflow-12.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_order_line_input/
[UPD] README.rst
Currently translated at 100.0% (17 of 17 strings) Translation: sale-workflow-12.0/sale-workflow-12.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_order_line_input/zh_CN/ Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-12.0/sale-workflow-12.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_order_line_input/
[UPD] Update sale_order_line_input.pot [UPD] README.rst
to solve a pypi upload issue
Since v13 the customer field on res.partner model has been disappeared, so when we try to add a value on the field order_partner_id we get an error. sale_order_line_input 13.0.1.1.0
…any domains don't work. Taxes empty
[MIG] sale_order_line_input: Migration to 14.0
[UPD] Update sale_order_line_input.pot [UPD] README.rst [IMP] update dotfiles [ci skip] [UPD] README.rst [UPD] README.rst
…d to show order from order line
Currently translated at 100.0% (22 of 22 strings) Translation: sale-workflow-16.0/sale-workflow-16.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_line_input/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: sale-workflow-17.0/sale-workflow-17.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_line_input/
Currently translated at 100.0% (18 of 18 strings) Translation: sale-workflow-17.0/sale-workflow-17.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_line_input/it/
Currently translated at 100.0% (18 of 18 strings) Translation: sale-workflow-17.0/sale-workflow-17.0-sale_order_line_input Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_line_input/it/
Member
|
/ocabot migration sale_order_line_input |
rousseldenis
reviewed
Dec 5, 2024
| for onchange_method in new_so._onchange_methods["partner_id"]: | ||
| onchange_method(new_so) | ||
| order_vals = new_so._convert_to_write(new_so._cache) | ||
| self.order_id = SaleOrder.create(order_vals) |
Contributor
There was a problem hiding this comment.
I'm still reluctant to creates in onchanges...
Contributor
Author
There was a problem hiding this comment.
If I understand correctly, you mean that create shouldn't be used in onchange. Perhaps using @api.depends could solve this problem?
order_id = fields.Many2one("sale.order", string="Sale Order", compute="_compute_order_id", store=True)
@api.depends("order_partner_id")
def _compute_order_id(self):
"""Create order automatically when order_partner_id changes"""
for line in self:
if line.order_partner_id and not line.order_id:
SaleOrder = self.env["sale.order"]
new_so = SaleOrder.new({"partner_id": line.order_partner_id.id})
# Apply the onchange methods (e.g., computing taxes)
for onchange_method in new_so._onchange_methods["partner_id"]:
onchange_method(new_so)
order_vals = new_so._convert_to_write(new_so._cache)
line.order_id = SaleOrder.create(order_vals)I also have a question that is not clear to me regarding the process, shouldn't these types of changes be handled in a section other than migration? Thanks!
5725a9b to
a611d1f
Compare
aae2633 to
3f1a309
Compare
3f1a309 to
0ac5b5c
Compare
carlosdauden
approved these changes
May 5, 2025
Contributor
carlosdauden
left a comment
There was a problem hiding this comment.
Maybe we can remove the button as clicking on the order_id gives the same result.
Comment on lines
+37
to
+45
| options='{"no_open": True, "no_create": True}' | ||
| /> | ||
| <button | ||
| title="Open order" | ||
| name="action_sale_order_form" | ||
| type="object" | ||
| icon="fa-external-link" | ||
| class="oe_stat_button" | ||
| /> |
Contributor
There was a problem hiding this comment.
Suggested change
| options='{"no_open": True, "no_create": True}' | |
| /> | |
| <button | |
| title="Open order" | |
| name="action_sale_order_form" | |
| type="object" | |
| icon="fa-external-link" | |
| class="oe_stat_button" | |
| /> | |
| options='{"no_create": True}' | |
| /> |
Comment on lines
+54
to
+57
|
|
||
| def action_sale_order_form(self): | ||
| self.ensure_one() | ||
| return self.order_id.get_formview_action() |
Contributor
There was a problem hiding this comment.
Suggested change
| def action_sale_order_form(self): | |
| self.ensure_one() | |
| return self.order_id.get_formview_action() |
5 tasks
Member
|
Superseded by #3795 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration to 18.0