Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

inherit and modify priority widget

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
xmlinheritancewidgetpriority
6 Răspunsuri
13714 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Akshay Bhadange
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Jusab Sida (jsi)
Cel mai bun răspuns

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
Imagine profil
Abandonează
Carlos DuAl
Autor

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__

Imagine profil
ayman mohammed adam
Cel mai bun răspuns

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
Imagine profil
Abandonează
Carlos DuAl
Autor

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
Autor

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!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
how to use priority widget in many2one field ? Rezolvat
widget priority
Imagine profil
Imagine profil
1
ian. 24
14492
(Odoo 16) widget: many2many_checkboxes need more features
xml widget odoo16features
Imagine profil
Imagine profil
1
mai 24
2801
Editing Views with XML - Please Help
invoice xml inheritance
Imagine profil
0
apr. 22
3614
How to use varibales in <t t-foreach tag
xml inheritance qweb
Imagine profil
3
aug. 20
28369
Resolving Overide Conflicts on xml views
xml inheritance override
Imagine profil
Imagine profil
2
feb. 17
3570
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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