I have the following situation:
An object A has a view with a field many2one of the object B, and B has a many2one of the object C.
A also has a related field A1 which displays a field (C1) in the object C, but we can select its value directly in A view.
I can select an existing B or create a new one. The same with C.
When I select to create new B and C I get the form view for the new object C.
How can I set the value in C1 to be equal to A1?
I'm trying with:
def default_get(self, cr, uid, fields, context=None):
_logger.info('Inside bdd_project.default_get')
if context is None:
context = {}
res = super(bdd_project, self).default_get(cr, uid, fields, context=context)
pl_obj = self.pool.get('bdd.pricelist')
pl = pl_obj.browse(cr, uid, context.get('cus_id'), context=context)
if 'cus_id' in fields:
_logger.info('Inside if cus_id: value %s', pl.cus_id)
res.update({'cus_id': pl.cus_id})
return res
where bdd_project would represent the object C and bdd_pricelist would be A.
pl.cus_id is returning None.