Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

inherit and modify priority widget

Subscribe

Get notified when there's activity on this post

This question has been flagged
xmlinheritancewidgetpriority
6 Replies
13709 Views
Avatar
Carlos DuAl

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>
0
Avatar
Discard
Avatar
Akshay Bhadange
Best Answer

Hello Everyone,
I think you just need to follow some simple steps just mentioned below.


1) In Python File Create a field

priority = fields.Selection([
(0, 'Very Low'),
(1, 'Low'),
(2, 'Medium'),
(3, 'High')])


2) In View file Create field 

<field name="priority" widget="priority"/>
0
Avatar
Discard
Avatar
Jusab Sida (jsi)
Best Answer

If you use new api, there must be 'Selection' instead of 'selection'...Try this one

priorityNew = fields.Selection(AVAILABLE_PRIORITIES, 'Priority', select=True)                    

(put crm_claim in depends, if not)

Hope this will help you...

0
Avatar
Discard
Carlos DuAl
Author

Hi, thanks for your answer, but if I use Selection, I get this error 2016-05-27 07:19:14,151 3295 CRITICAL base openerp.modules.module: Couldn't load module carlosUpgrade 2016-05-27 07:19:14,151 3295 CRITICAL base openerp.modules.module: 'module' object has no attribute 'Selection' I have crm_claim in the depends section of __openerp__

Avatar
ayman mohammed adam
Best Answer

Hi,

i think you don't need to modify or change the priority widget, you must use it by the same name in xml code and determine your levels on the selection fields.

if you want 5 levels you must start from '0' to  '5' , thats mean 5 levels ,

if you want 3 levels you must start from '0' to  '3' , thats mean 5 levels and so on.

example if you  need 3 levels

priorityNew = fields.selection(

[

('0', 'Low'),

('1', 'Normal'),

('2', 'High'),

('3', 'Very High'),

 

]

, 'Priority', select=True)

0
Avatar
Discard
Carlos DuAl
Author

The thing is that priorities are set in the original module as _colums: { 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'),

Carlos DuAl
Author

Sorry about my previous post, I sent it by mistake before finishing writing it The thing is that priorities are set in the original module as _colums: { 'priority': fields.selection([('0','Low'), ('1','Normal'), ('2','High')], 'Priority'), ...} And I can't access (and modify) those values to add more priorities in my module, so that's why I'm trying to completely replace it

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
how to use priority widget in many2one field ? Solved
widget priority
Avatar
Avatar
1
जन॰ 24
14488
(Odoo 16) widget: many2many_checkboxes need more features
xml widget odoo16features
Avatar
Avatar
1
मई 24
2799
Editing Views with XML - Please Help
invoice xml inheritance
Avatar
0
अप्रैल 22
3613
How to use varibales in <t t-foreach tag
xml inheritance qweb
Avatar
3
अग॰ 20
28368
Resolving Overide Conflicts on xml views
xml inheritance override
Avatar
Avatar
2
फ़र॰ 17
3568
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now