I extended res_partner and linked to a "unique code" model like this:
Partner Model :
class Partner(models.Model): _inherit='res.partner'... anagrafiche_codiceunivoco_ids = fields.One2many('utilitypower.codiceunivoco','id_anagrafica',string ='Anagrafica Codice Univoco')
CodiceUnivoco model:
class CodiceUnivoco(models.Model): _name ='utilitypower.codiceunivoco' _description = 'Codice Univoco' codice = fields.Char('Codice Univoco',required=True) id_anagrafica = fields.Many2one('res.partner', string='Cliente')
Res_partner view :
<xpath expr="//notebook" position="inside"> <page name="codice_univoco" string="Codice Univoco"> <field name="anagrafiche_codiceunivoco_ids" string="Codice Univoco" widget="one2many_list" > <tree> <field name="codice"></field> </tree> </field> </page>
codiceunivoco_view :
<record id="view_form_codiceunivoco" model="ir.ui.view"> <field name="name">Codice Univoco Form</field> <field name="model">utilitypower.codiceunivoco</field> <field name="arch" type="xml"> <form string="Codice Univoco"> <header></header> <sheet> <group> <field name="codice"></field> <field name="id_anagrafica" widget="man2one_list" /> </group> </sheet> </form> </field> </record>
what I want is that when from the res_partner view I add a record to "univocal code" (via widget one2many_list) and the module view of "univocal code" opens, the record with the client is set with the one from which I opened the module or in alternatively the customer field is hidden.
How can i do this?