Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Developing a new popup in stock_picking, basic doubts about how to generate the popup

Odebírat

Get notified when there's activity on this post

This question has been flagged
stock_pickingpopuppopupwindowodooV8
1 Odpovědět
9092 Zobrazení
Avatar
E.M.

I am trying to develop a new popup for stock_picking which will display the move.lines and allow user to select them and print a custom report with selected ones.

As a first try I want to generate the popup with just a couple of fields of the stock.picking.


- Do I have to use models.Transient or models.Model?

- Do I have to give it a different _name="label.picking" or just extend "stock.picking" and use it?

- Do I have to use view_id field in the button controller?


This is the model:


# -*- coding: utf-8 -*-
from openerp import models, fields
class LabelPicking(models.TransientModel):
_name = "label.picking"
_inherit = "stock.picking"
def view_tree_print_dispatch_items(self):
return {
'type': 'ir.actions.act_window',
'name': 'view_tree_print_dispatch_items',
'view_type': 'tree',
'view_mode': 'tree',
'res_model': 'label.picking',
'target': 'new',
}


And this is the XML:

<?xml version="1.0" encoding="utf-8" ?>
<openerp>
<data>
<record model="ir.ui.view" id="stock.view_picking_form_item_labels">
<field name="name">stock.picking.form.item_labels</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='state']" position="before">
<button name="view_tree_print_dispatch_items" string="Imprimir Items" type="object"/>
</xpath>
</field>
</record>

<record id="view_tree_print_dispatch_items" model="ir.ui.view">
<field name="name">Labels Dispatch Items Tree</field>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>-
<field name="origin"/>-
</tree>
</field>
</record>

</data>
</openerp>
 
2
Avatar
Zrušit
Avatar
Jose M. González
Nejlepší odpověď

Hi, 

this example may help, in my case i use popup to update other model and return the original view. (this popup is launched from button)

#modelo temporal para popup.

class refuse_leave(osv.osv_memory):

_name = "refuse.leave"

_description = "Reason that order is not delivered"

_columns = {

'refusal_explanation': fields.text('Refusal explanation', required=True),

'return_reasons_type': fields.many2one('delivery.return.reasons.type','Return type', required=True),

}

     

     #botón de guardar la información introducida en el popup

def refuse_leave(self,cr, uid, ids, context=None):

data = self.read(cr,uid,ids)[0] 

return_reason = data['refusal_explanation']

return_type = data['return_reasons_type'][0]

if return_reason == "" or( len(return_reason)< 5):

raise osv.except_osv(_('Error'), _('Motivo no válido'))

else:

delivery_route_line_obj = self.pool.get('delivery.route.line')

record_id = context.get('delivery_line_id')

tipo_incidencia = context.get('tipo_entrega')     

[ operaciones que tenga que realizar ]

return True

refuse_leave()


<!-- xml con el modelo del popup --> <?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

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

<field name="name">Leave Refuse</field>

<field name="model">refuse.leave</field>

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

<form string="Refuse_Leave"> <!-- position="attributes"-->

<separator string="Información de recepción de pedido" />

<attribute name="string"> Seleccione el motivo por el cual el pedido no se entregó correctamente del siguiente desplegable:<br></br></attribute>

<!-- <div style="float:left; widht:30%;">

<field name="return_reasons_type" />

</div> -->

<group colspan="0" col="0">

<div><b>Razones</b> </div><newline />

<field name="return_reasons_type" nolabel="1" />

<field name="refusal_explanation" nolabel="1" placeholder="Indique el motivo por el que no se pudo entregar es pedido..." />

<small>

<b>Información</b><br></br>

Es obligatorio que indique algún texto de por qué este pedido no fue entregado correctamente.

</small>

</group>

<footer>

<button string="Guardar motivo" class="oe_highlight" type="object" name="refuse_leave" />

<button string="Salir" special="cancel" /> <!-- class="oe_link" -->

</footer>

</form>

</field>

</record>

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

<field name="name">Leave Refuse</field>

<field name="type">ir.actions.act_window</field>

<field name="res_model">refuse.leave</field>

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

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

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

</record>

</data>

</openerp>

<!-- xml que lanzará el popup -->

...

<button name="action_received_with_exception" string="Received with exception"

type="object" states="delivered" />



#python desde donde lanza la acción del botón

def action_received_with_exception (self, cr, uid, ids, context=None):

context.update({

'tipo_entrega' : 'ok_con_incidencias',

'delivery_line_id': ids[0],

})

try:

return {

'name': 'Causas de devolución de pedido',

'view_type': 'form',

"view_mode": 'form',

'res_model': 'refuse.leave',

'type': 'ir.actions.act_window',

'target': 'new',

'flags': {'action_buttons': False},

'context': context,

}

except ValueError:

raise osv.except_osv(_('Error'))

1
Avatar
Zrušit
E.M.
Autor

It helps, now I am trying a transient model which inherits from stock_picking, how do you move a given ID (or parameter) from stock_picking to the popup model/form when you click the button?

Jose M. González

with that question I have also fought x-D with this code: [code] context.update({ 'tipo_entrega' : 'ok_con_incidencias', 'delivery_line_id': value that you want, }) [/code] you can pass the info in the context to popup because you add param 'context': context ( see -> #python desde donde lanza la acción del botón). And you obtain the pass value in this line: record_id = context.get('delivery_line_id') ( see -> #modelo temporal para popup.). May the Force be with you !!!

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Press a button and display a form in a popup, how? Vyřešeno
qweb popup popupwindow odooV8
Avatar
Avatar
Avatar
2
pro 23
39142
Popup Form, do i need to create a new model? Vyřešeno
models popup popupwindow odooV8
Avatar
Avatar
1
úno 16
8774
Odoo pop up
time popup popupwindow
Avatar
0
dub 24
2552
Can't validate stock.picking with product on multi-location
stock_picking validateerror odooV8
Avatar
0
zář 19
71
Launch popup to select a certain type of product in the sale.order.line view
sale.order.line popup popupwindow
Avatar
0
kvě 24
4347
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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