Skip to content

Commit

Permalink
[15.0][FIX] product_supplierinfo_for_customer_sale: onchange NewId
Browse files Browse the repository at this point in the history
  • Loading branch information
ilo committed Aug 22, 2024
1 parent 9c631e8 commit d479b81
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions product_supplierinfo_for_customer_sale/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Contributors
* Sergio Teruel <[email protected]>
* Lois Rilo <[email protected]>
* Juany Davila <[email protected]>
* Italo Lopes <[email protected]>

Maintainers
~~~~~~~~~~~
Expand Down
14 changes: 8 additions & 6 deletions product_supplierinfo_for_customer_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ def _update_description(self):
"""
# We need to repeat the search here, as passing the value by context or any
# other trick makes the ORM to do ugly things in "onchange" mode
customerinfo = self.product_id._select_customerinfo(
partner=self.order_partner_id
)
if customerinfo.product_code:
# Avoid to put the standard internal reference
self = self.with_context(display_default_code=False)
customerinfo = self.env["product.customerinfo"]
if self.product_id:
customerinfo = self.product_id._select_customerinfo(
partner=self.order_partner_id
)
if customerinfo.product_code:
# Avoid to put the standard internal reference
self = self.with_context(display_default_code=False)
res = super()._update_description()
if customerinfo.product_code:
self.name = f"[{customerinfo.product_code}] {self.name}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
* Sergio Teruel <[email protected]>
* Lois Rilo <[email protected]>
* Juany Davila <[email protected]>
* Italo Lopes <[email protected]>
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Sergio Teruel &lt;<a class="reference external" href="mailto:sergio.teruel&#64;tecnativa.com">sergio.teruel&#64;tecnativa.com</a>&gt;</li>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Juany Davila &lt;<a class="reference external" href="mailto:juany.davila&#64;forgeflow.com">juany.davila&#64;forgeflow.com</a>&gt;</li>
<li>Italo Lopes &lt;<a class="reference external" href="mailto:italo.lopes&#64;camptocamp.com">italo.lopes&#64;camptocamp.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down

0 comments on commit d479b81

Please sign in to comment.