Hi,
I'm trying to make a custom module that sets a default property_account_payable_id to a new user every time i create a new supplier.
I tried adding an invisible field "supplier_rank" to check if the user thats going to be created is a supplier or not.
<xpath expr="//field[@name='property_account_payable_id']" position="after">
<field name="supplier_rank" invisible="1"/>
</xpath>
And through python i tried taking that fields value but it returns an empty string
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
res = super(ResPartner, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu,
)
if view_type == 'form':
payable_xml = etree.XML(res['arch'])
for node in payable_xml.xpath("//field[@name='supplier_rank']"):
for i in node.getiterator():
print(i.text)
res['arch'] = etree.tostring(payable_xml)
return res