[FIX] crm,gamification: flexible reference to field

The field generation is most of the time following the pattern
`field_<table name>_<field name>`
but in case of name clash (e.g. res.partner.category - id and res.partner -
category_id), the id of ir.model.field is added at the end of the external id
during the field creation.

The more flexible way to link to an ir.model.field is to use the syntax
`search=[('model', '=', <model>), ('name', '=', <field name>)]`
to avoid errors as in #12192 when the "first" external id no longer exists.

Fixes #12192
Closes #12198
This commit is contained in:
Ronald Portier (Therp BV) 2016-05-27 15:04:20 +02:00 committed by Martin Trigaux
parent 63ca2d1b9f
commit d73648fe0d
No known key found for this signature in database
GPG Key ID: 7B0E288E7C0F83A7
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@
<field name="sequence">1</field>
<field name="kind">on_time</field>
<field name="filter_id" ref="filter_draft_lead"/>
<field name="trg_date_id" ref="field_crm_lead_create_date"/>
<field name="trg_date_id" search="[('model','=','crm.lead'),('name','=','create_date')]"/>
<field name="trg_date_range">5</field>
<field name="trg_date_range_type">day</field>
<field name="server_action_ids" eval="[(6,0,[ref('action_email_reminder_lead')])]"/>

View File

@ -20,7 +20,7 @@
<field name="computation_mode">count</field>
<field name="suffix">leads</field>
<field name="model_id" eval="ref('crm.model_crm_lead')" />
<field name="field_date_id" eval="ref('crm.field_crm_lead_create_date')" />
<field name="field_date_id" search="[('model','=','crm.lead'),('name','=','create_date')]" />
<!-- lead AND opportunity as don't want to be penalised for lead converted to opportunity -->
<field name="domain">[('user_id','=',user.id), '|', ('type', '=', 'lead'), ('type', '=', 'opportunity')]</field>
</record>