I Have a form 1 with ClassA and has two fields (the field_b and the field_c)
class ClassA(DeactivableMixin, ModelSQL,ModelView, MultiValueMixin): __name__ = 'incidents.classa' field_b = fields.Many2One('incidents.class_b','shipFR',ondelete='CASCADE') field_c = fields.Many2One('incidents.class_c', 'Suradic',ondelete='CASCADE')
And this is the code of the class called by the field_c :
class ClassC(DeactivableMixin, ModelView, ModelSQL, MultiValueMixin): __name__ = 'incidents.class_c' convention = fields.Char("Convention ") name = fields.Char("Name") def get_rec_name(self,convention ): return self.convention
code of the ClassB called by the field_b that exist in another form2
class ClassB(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin): __name__ = 'incidents.class_b' protocol = fields.One2Many('incidents.class_d','link_classB_D','Protocole Ariva')
in this ClassB i Have a problem on the field “protocol” which point on One2many relation(has 3 fields) , one of this field i defined it ''field_e" , i want it to take the content of another field point on many2one relation and exist in another class (this field is the field_c from the ClassA (i was put the code on the top of description).
and this is the ClassD which is called by the field “protocol” talking about the one2many relation table and has 3 fields , one of them i define it by ‘’ field_e" and i want it to take as i say the content of of another field which is field_c point on many2one relation :
class ClassD(DeactivableMixin, ModelView, ModelSQL, MultiValueMixin): __name__ = 'incidents.class_d' link_classB_D = fields.Many2One('incidents.class_b', ondelete='CASCADE', states=STATES depends=DEPENDS) field_e = fields.Char("Seam") @fields.depends('field_e') def on_change_field_e(self): pool = Pool() parameterup = Pool().get('incidents.classa') parameterups, = parameterup.search([ ('field_c', '=', 'field_c.convention'), ], limit=1) for line in self.field_e: line.field_e = parameterups.field_e
My problem here on how correctly i must call the field that point many2one relation and that exist in ClassA to make one field from the 3 fields that Affiliates to table one2many and exist on ClassD take the content of it.
Ps: the field that point on the relation one2many and the field point point on the relation many2one they are from different classes linked by another class.
i tried to do that with the method on_change_field_e but nothing shown and still empty