Odoo Help

1
4 Answers
2
Avatar

subbarao

--subbarao--

873
| 4 1 4
Chennai, India
--subbarao--


subbarao
1/4/19, 5:49 AM

Hello Leke,

Please try the following code in xml for product_id field 

inherit and update the existing domain

domain_new = old_domain + [('sup_product_code','=',parent.supplier_code)]

<field name="product_id' domain="domain_new"/>


before this add new field on Purchase Order supplier_code and update this field on partner onchange function.

0
Denis Lorenzo
1/4/19, 3:51 AM

Try this: 

return {'domain': {'product_id': [('partner_id.supplier_code', '=', self.sup_product_code)]}}

without quotes. I think everything else is correct

1 Comment
Leke Onile-ere
1/4/19, 4:10 AM

Hi Denis. My onchange method is in the purchase.order object however the field im trying to apply the domain to is in the purchase.order.line object how would i do this?

0
Nitin Kantak
1/4/19, 8:46 AM

Apply a domain to the field which is in the purchase.order.line as follows:

return {'domain': {'product_id': [('partner_id.supplier_code''='self.order_id.sup_product_code)]}}

* here order_id is just an example . You have to mention many2one field in purchase.order.line containing object purchace.order . 

Ask a Question
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now