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

how to return different views in a method? Please someone help me.. Thanks in advance

Abonare

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

Această întrebare a fost marcată
2 Răspunsuri
6873 Vizualizări
Imagine profil
Alcaline

I've created a wizard that views the account.move.line and i want the data of this to be filter by DATE, PERIOD, and FISCAL YEAR using the domain. but when i run it, it does not pop up the wizard and automatically close the whole wizard. Can someone please help me in this problem?

 

Here is my code:

.xml:

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

            <field name="name">Extended Tax Report</field>

            <field name="model">biz1.tax.report</field>

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

                <form string="Filter" version="7.0">

                    <sheet>

                        <label string="" />  <!-- binding for inherited views -->

                        <group col="4">

                            <field name="chart_account_id" widget='selection'

                                on_change="onchange_chart_id(chart_account_id, context)" />

                            <field name="company_id" invisible="1" />

                            <field name="fiscalyear_id" domain="[('company_id','=',company_id)]" />

                            <field name="target_move" />

                        </group>

                        <notebook tabpos="up" colspan="4">

                            <page string="Filters" name="filters">

                                <group>

                                    <field name="filter" on_change="onchange_filter(filter, fiscalyear_id)" />

                                </group>

                                <group string="Dates"

                                    attrs="{'invisible':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}">

                                    <field name="date_from" />

                                    <field name="date_to" />

                                </group>

                                <group string="Periods"

                                    attrs="{'invisible':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}">

                                    <field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" />

                                    <field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" />

                                </group>

                            </page>

                            <page string="Journals" name="journal_ids">

                                <field name="journal_ids" />

                            </page>

                        </notebook>

                        <footer>

                            <button name="check_report" string="Print" type="object"

                                default_focus="1" class="oe_highlight" />

                            or

                            <button string="Cancel" class="oe_link" special="cancel" />

                        </footer>

                        <button icon="gtk-cancel" special="cancel" string="Cancel" />

                        <button icon="gtk-ok" name="action_button_ok" string="Filter Data"

                            type="object" />

                    </sheet>

                </form>

            </field>

        </record>

        

        

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

            <field name="name">Extended Tax Report</field>

            <field name="res_model">biz1.tax.report</field>

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

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

            <field name="view_id" ref="biz1_tax_views"/>

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

        </record>

        <menuitem icon="STOCK_JUSTIFY_FILL" name="Tax Report" id="menu_tax_report"

            parent="account.menu_finance_entries" action="action_tax_reports"

            sequence="11" />

.py

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

      account_ids = []

      account_tax_ids = self.pool.get('account.tax').search(cr,uid,[('id','!=',0)],context= context)

      netsvc.Logger().notifyChannel("\n0000000000  ", netsvc.LOG_INFO, ''+str(account_tax_ids))

      for account_tax in self.pool.get('account.tax').browse(cr,uid,account_tax_ids,context=context):

          netsvc.Logger().notifyChannel("\n111111111  ", netsvc.LOG_INFO, ''+str(account_tax))

          account_ids.append(account_tax.account_collected_id.id)

          account_ids.append(account_tax.account_paid_id.id)

#           netsvc.Logger().notifyChannel("\n  ", netsvc.LOG_INFO, ''+str(finish))

      action1 = []  

      for wizard in self.browse(cr,uid,ids, context=context):

          netsvc.Logger().notifyChannel("\n222222  ", netsvc.LOG_INFO, ''+str(account_tax))

         

          if wizard.filter == 'date':

               netsvc.Logger().notifyChannel("\n333333333  ", netsvc.LOG_INFO, ''+str(wizard.search_selection))

               action1 = {

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

                    'res_model': 'account.move.line',

                    'view_mode': 'tree',

                    'view_type': 'tree',

                    'domain':[('date','>=',wizard.date_from), ('date', '<=', wizard.date_to)] ,

                    'views': [(False, 'tree')],

                    'target': 'new',

                     }

              

          elif wizard.filter == 'period':

          

              action1= {

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

                    'res_model': 'account.move.line',

                    'view_mode': 'tree',

                    'view_type': 'tree',

                    'domain':[('period_id','>=',wizard.period_from), ('period_id','<=',wizard.period_to)] ,

                    'views': [(False, 'tree')],

                    'target': 'new',

                     }

        

          return action1

   

0
Imagine profil
Abandonează
Aldennis

I've done this before but using a different approach. In your .py file, using search function, get all the record ids of the account_move_line records that you want to display. Filter it according to your needs (i.e. Date, Period and Fiscal Year) and put all of these ids in one list (move_line_ids). Then in your action1 domain put: [('id','in',(move_line_ids))], Make your 'target':'current'. Hope this helps.

Aldennis

This is my return method: return { 'name':_(title), 'view_mode': 'tree', 'view_id': view_id, 'view_type': 'form', 'res_model': 'account.move.line', 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'current', 'domain': [('id','in',(move_line_ids))], 'context': {}, 'limit': limit, }

Aldennis

The 'limit' attribute is optional. In my case, I want to display all records in one page if it is greater than 80. You also need to have both 'view_mode' and 'view_type' included in your return.

Imagine profil
Ivan
Cel mai bun răspuns

You have to have an else in the if-elif structure just in case.

AFAIK you need to put form,tree in the view_mode (tree alone does not work).

'views': [(False, 'tree')] is not required if you don't have specific view to call.

In general, check that your return value is a proper action call.

0
Imagine profil
Abandonează
Alcaline
Autor

i'll try this Ivan thanks.

Alcaline
Autor

hi Ivan i've already try this one but nothing happen. the output is still the same. the wizard is automatically closing. when i click the button.

Ivan

Can you post what is returned from that method? Log the return value before the return statement.

Imagine profil
Ben Bernard
Cel mai bun răspuns

I think you forget to set the 'view_id' key for action dictionary.

0
Imagine profil
Abandonează
Ivan

@Bernard view_id is not compulsory if you don't have any specific view in mind. It will just take the first view based on the model and type requested ordered by priority and then name.

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
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