Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
stock_pickingpopuppopupwindowodooV8
1 Odpowiedz
9089 Widoki
Awatar
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
Awatar
Odrzuć
Awatar
Jose M. González
Najlepsza odpowiedź

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
Awatar
Odrzuć
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 !!!

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Press a button and display a form in a popup, how? Rozwiązane
qweb popup popupwindow odooV8
Awatar
Awatar
Awatar
2
gru 23
39134
Popup Form, do i need to create a new model? Rozwiązane
models popup popupwindow odooV8
Awatar
Awatar
1
lut 16
8771
Odoo pop up
time popup popupwindow
Awatar
0
kwi 24
2549
Can't validate stock.picking with product on multi-location
stock_picking validateerror odooV8
Awatar
0
wrz 19
71
Launch popup to select a certain type of product in the sale.order.line view
sale.order.line popup popupwindow
Awatar
0
maj 24
4347
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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