Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Artificial Intelligence
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Property Management
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Problem with a wizard

Subscriure's

Get notified when there's activity on this post

This question has been flagged
3 Respostes
7384 Vistes
Avatar
Uillino

I'm trying to create a wizard.

This is the view code:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_mymodule_wizard_form" model="ir.ui.view">
<field name="name">Wizard</field>
<field name="model">mymodule.wizard</field>
<field name="arch" type="xml">
<form string="mymodule Wizard">
<sheet>
<group name="top">
<group name="left">
<h1>Demo Wizard</h1>
</group>
<group name="right">
<button type="object"
name="crea_servizio"
string="Crea Servizio"/>
<button type="object"
name="crea_attivita"
string="Crea Attivita"/>
</group>
</group>
</sheet>
<footer>
<button string="cancella" special="cancel"/>
</footer>
</form>
</field>
</record>

<record id="view_mymodule_wizard" model="ir.actions.act_window">

<field name="name">Selezione link</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mymodule.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>

<!-- Action to open To-do Task list -->
<act_window id="action_mymodule_wizard" name="Attività / Servizio" res_model="mymodule.wizard" view_mode="tree,form" />
<!-- Menu item to open To-do Task list -->
<menuitem id="menu_mymodule_wizard" name="Menu mymodule Wizard" parent="mail.mail_feeds" sequence="40" action="action_mymodule_wizard" />

</data>
</openerp>

and this is the py file:

# -*- encoding: utf-8 -*-
from openerp import models, api

class wizard(models.TransientModel):
_name = 'mymodule.wizard'
_description = "Wizard per la scelta dell'azione"

@api.multi
def crea_attivita(self):
return {
'type': 'ir.actions.act_window',
'res_model': 'mymodule.tbl_attivita',
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
}

def crea_servizio(self):
return {
'type': 'ir.actions.act_window',
'res_model': 'mymodule.tbl_servizio',
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
}

This is mymodule.py:

# -*- encoding: utf-8 -*-
from openerp import models, fields

class mymodule_attivita(models.Model):
_name = 'mymodule.tbl_attivita'
_description = 'Tabella Attivita'

scode_attivita_contr = fields.Char('Code', size=1, required=True)
sdescrizione = fields.Text('Descrizione', equired=True)

class mymodule_servizio(models.Model):
_name = 'mymodule.tbl_servizio'
_description = 'Tabella Servizio'

scode_servizio = fields.Char('Code', size=1, required=True)
sdescrizione = fields.Text('Descrizione', required=True)

I have two problems.

1) When I click on "Crea servizio" in the wizard, I get this error:

Traceback (most recent call last):
File "/home/openerp/openerp/http.py", line 530, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/openerp/openerp/http.py", line 567, in dispatch
result = self._call_function(**self.params)
File "/home/openerp/openerp/http.py", line 303, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/openerp/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/openerp/openerp/http.py", line 300, in checked_call
return self.endpoint(*a, **kw)
File "/home/openerp/openerp/http.py", line 796, in __call__
return self.method(*args, **kw)
File "/home/openerp/openerp/http.py", line 396, in response_wrap
response = f(*args, **kw)
File "/home/openerp/openerp/addons/web/controllers/main.py", line 953, in call_button
action = self._call_kw(model, method, args, {})
File "/home/openerp/openerp/addons/web/controllers/main.py", line 941, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
TypeError: crea_servizio() takes exactly 1 argument (5 given)

Instead, everything is ok with the other button (Crea Attivita).

2) I'm not able to make an action when I click on "Crea Attivita". I see the module 'mymodule' in the pop up, but I don't know I I have to do for writing in the db.

This is mymodule_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_mymodule_attivita" model="ir.ui.view">
<field name="name">mymodule Attivita</field>
<field name="model">mymodule.tbl_attivita</field>
<field name="arch" type="xml">
<form string="mymodule Attivita">
<sheet>
<notebook>
<page string="Tab 1">
<group name="top">
<group name="left">
<field name="scode_attivita_contr"/>
<field name="sdescrizione"/>
</group>
</group>
</page>
<page string="Tab 2">
<group name="top">
<group name="left">
<field name="id" attrs="{'invisible': [('write_date', '=', False)]}"/>
<field name="write_date" attrs="{'invisible': [('write_date', '=', False)]}"/>

</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

<record id="view_mymodule_servizio" model="ir.ui.view">
<field name="name">mymodule Servizio</field>
<field name="model">mymodule.tbl_servizio</field>
<field name="arch" type="xml">
<form string="mymodule Servizio">
<sheet>
<group name="top">
<group name="left">
<field name="id" attrs="{'invisible': [('write_date', '=', False)]}"/>
<field name="write_date" attrs="{'invisible': [('write_date', '=', False)]}"/>
</group>
<group name="left">
<field name="scode_servizio"/>
<field name="sdescrizione"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

<!-- Action to open To-do Task list -->
<act_window id="action_mymodule_attivita" name="Attivita" res_model="mymodule.tbl_attivita" view_mode="tree,form" />
<act_window id="action_mymodule_servizio" name="Servizio" res_model="mymodule.tbl_servizio" view_mode="tree,form" />
<!-- Menu item to open To-do Task list -->
<menuitem id="menu_mymodule_attivita" name="Menu mymodule Attivita" parent="mail.mail_feeds" sequence="20" action="action_mymodule_attivita" />
<menuitem id="menu_mymodule_servizio" name="Menu mymodule Servizio" parent="mail.mail_feeds" sequence="30" action="action_mymodule_servizio" />

</data>
</openerp>

Could you help me, please?

0
Avatar
Descartar
Avatar
Tangaraj
Best Answer

Always create transiant model for wizard.

class wiz_form(models.TransientModel):

_name = 'wiz'

tname=fields.Char('Name 1')

pname= fields.Char('Name 2')

state = fields.Selection([('step1', 'step1'),('step2', 'step2')])


@api.multi

def action_next(self):

 return True


@api.multi

def action_previous(self):

return True

Proceed your xml part like this.


<?xml version='1.0' encoding='UTF-8'?>

<openerp>

<data>

<record model="ir.ui.view" id="wizard_with_step_form_id">

<field name="name">wiz.form</field>

<field name="model">wiz</field>

<field name="type">form</field>

<field name="arch" type="xml">

<form string="Wizard with step" version="7.0">

<sheet>

<group>

<field name="tname" />

<field name="pname" />

<field name="state" />

</group>

</sheet>

<footer>

<button name="action_next" string="Next" type="object" />

<button name="action_previous" string="Previous" type="object"

class="oe_highlight" />

</footer>

</form>

</field>

</record>

<record model="ir.actions.act_window" id="action_wizc_ids">

<field name="name">wiz.form</field>

<field name="res_model">wiz</field>

<field name="view_mode">form</field>

<field name="target">new</field>

</record>

</data>

</openerp>

Dont forget to create init file for wizard..

and dnt forget to import in main init.pls try it for your case and put it in openerp data[''wizard/wiz.xml'] top most end

1
Avatar
Descartar
Uillino
Autor

Thank you for your help. I need some explanation. First of all, I haven't understood if I have to raplace my wizard.py and wizard_view.xml files with yours. Then, What I have to set as "step1" and "step2"?

Avatar
PY
Best Answer

1. Put @api.multi before your method.

2. Try to add:

"view_id": self.env.ref("mymodule.view_mymodule_attivita"),

to the dictionnary returned by the crea_attivita method.

1
Avatar
Descartar
Avatar
Uillino
Autor Best Answer

Thank you!

Any advice about the other problem?

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

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

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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