How do i access the field product_id.product_tmpl_id.type
from the sale.order.line
model.
I have the following button in the xml view:
button name="print_report" string="Print" type="object" icon="gtk-print" attrs="{'invisible':[('product_id.product_tmpl_id.type', '!=', 'product')]}"/>.
With this statement , Odoo shows me the following error:
Uncaught Error: Campo desconocido product_id.product_tmpl_id.type en el dominio [["product_id.product_tmpl_id.type","!=","product"]]
I appreciate your help. Thank you
Are you sure that field product_id is declared into the view of the button? If so, and did not work yet, then you can try to create a related field into sale.order.line
type = fields.Selection(related='product_id.product_tmpl_id.type')
and use it into domain
[('type', '!=', 'product')]
(remember to put type field, even invisible, inside the view)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.