Hello,
I'm trying to modify a priority widget so that instead of having only 3 priority levels, it has 5.
This is the section of the code in the main module's view that contains the priority widget (in bold)
[...]
<record model="ir.ui.view" id="crm_case_claims_tree_view">
<field name="name">CRM - Claims Tree</field>
<field name="model">crm.claim</field>
<field name="arch" type="xml">
<tree string="Claims">
<field name="name"/>
<field name="partner_id"/>
<field name="user_id"/>
<field name="date"/>
<field name="stage_id"/>
<field name="date_action_next"/>
<field name="action_next"/>
<field name="date_deadline"/>
<field name="categ_id" string="Type"/>
<field name="date_closed" invisible="1"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="crm_case_claims_form_view">
<field name="name">CRM - Claims Form</field>
<field name="model">crm.claim</field>
<field name="arch" type="xml">
<form string="Claim">
<header>
<field name="stage_id" widget="statusbar" clickable="True"/>
</header>
<sheet string="Claims">
<group>
<field name="name"/>
<field name="date"/>
</group>
<group colspan="4" col="4" groups="base.group_user">
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/>
<field name="priority" widget="priority"/>
<field name="section_id" groups="base.group_multi_salesteams"/>
<field name="date_deadline"/>
</group>
[...]
in the .py file, priority is defined as
'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),
In my module, I'm trying to inherit the previous view using
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="crm_claim_mod_view">
<field name="name">crm.claim.mod.view</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<field name="priority" position="replace">
<field name="priorityNew" widget="priorityNew"
</field>
</field>
</record>
</data>
</openerp>
and in my .py I have defined
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp.osv import fields
AVAILABLE_PRIORITIES = [
('0', 'Low'),
('1', 'Normal'),
('2', 'High'),
('3', 'Very High'),
('4', 'Max'),
]
class crm_claim_mod(models.Model):
_inherit = "crm.claim"
_description = "Claims modification"
priorityNew = fields.selection(AVAILABLE_PRIORITIES, 'Priority', select=True)
@api.model
def create(self,vals):
vals['stage_id']='1'
return super(crm_claim_mod,self).create(vals)
But I keep getting this error message
Error details:
Field `priorityNew` does not exist
Error context:
View `crm.claim.mod.view`
[view_id: 1641, xml_id: carlosUpgrade.crm_claim_mod_view, model: crm.claim, parent_id: 1016]" while parsing /home/carlos/dbTest/codigo/mods/carlosUpgrade/crm_claim_mod_view.xml:4, near
<record model="ir.ui.view" id="crm_claim_mod_view">
<field name="name">crm.claim.mod.view</field>
<field name="model">crm.claim</field>
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
<field name="arch" type="xml">
<field name="priority" position="replace">
<field name="priorityNew" widget="priorityNew"/>
</field>
</field>