Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivouspalvelut
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Kurssit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

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

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

print value of a field in wizard to report?

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
wizardv6.1valuesprintreport
3 Vastaukset
17486 Näkymät
Avatar
evon_dun

I need to pass the value of my two fields i.e date_from n date_to from my wizard to the report it calls/prints. Following is my code. This is working fine but only problem is i am not able to find how to print these two fields. Any help is appreciated.

class my_wizard_report(osv.osv_memory):

    _name = 'my.wizard.report'
##    _inherit = 'account.invoice'
    _description = 'Test Report'  

    _columns = {
        'date_from':fields.date('Date From',store=True),
        'date_to':fields.date('Date To',store=True),
        'invoice_ids':fields.many2many('account.invoice', string='Filter on invoices',help="Only selected invoices will be printed"),
    }

    _defaults = {
        'date_from': lambda *a: time.strftime('%Y-%m-%d'),
        'date_to': lambda *a: time.strftime('%Y-%m-%d'),
    }

    def print_report(self, cr, uid, ids, context=None):
        datas = {}
        if context is None:
            context = {}
        data = self.read(cr, uid, ids,['date_from', 'date_to', 'invoice_ids'], context=context)
        date_from = data[0]['date_from'] 
        date_to = data[0]['date_to']
        obj = self.pool.get('account.invoice')
        ids = obj.search(cr, uid, [('date_invoice','>=',date_from),('date_invoice','<=',date_to)])
        datas = {
                 'ids': ids,
                 'model': 'account.invoice',
                 'form': data
                }
        return {'type': 'ir.actions.report.xml', 'report_name': 'account.invoice.rnd5c3tV', 'datas': datas}





my_wizard_report()



<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

<!-- cancel order  -->

        <record id="view_my_wiz_form" model="ir.ui.view">
            <field name="name">print.report.form</field>
            <field name="model">my.wizard.report</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Print Report">
                    <group colspan="4" >
                        <field name="date_from" filter_domain="[('date_invoice','&gt;=',self)]" />
                        <field name="date_to" filter_domain="[('date_invoice','&lt;=',self)]"  />
                    </group>
                        <separator string="Print Only" colspan="4" />
                        <group colspan = "4">
                            <field name="invoice_ids" colspan="4" nolabel="1"/>
                        </group>
                    <group colspan="4" col="6">                     
                        <button  icon="gtk-ok" name="print_report" string="Print" type="object"/>
                   </group>
               </form>
            </field>
        </record>

        <record id="action_my_wiz_form" model="ir.actions.act_window">
            <field name="name">Print Report</field>
            <field name="res_model">my.wizard.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
           <field name="view_id" ref="view_my_wiz_form"/>
           <field name="target">new</field>        
        </record>

        <act_window id="action_my_wiz_form_values"
            key2="client_action_multi" name="Print Report"
            res_model="my.wizard.report" src_model="add.penalty"
            view_mode="form" target="new" view_type="form"/>

    </data>
</openerp>

C:\fakepath\screen2.png

C:\fakepath\screen1.png

C:\fakepath\reports.png

0
Avatar
Hylkää
Avatar
Abhishek H Menon
Paras vastaus

Use data = self.read(cr, uid, ids,)[-1] in your print_report method and you will get the details that you entered via the wizard. It will a dictionary in which you will have keys and values as per the above defined fields

0
Avatar
Hylkää
Avatar
Anuradha
Paras vastaus
I didnt understand your requirement properly, If you want to print something you can use
import logging 
_logger = logging.getLogger(__name__)
_logger.info('Create a with vals ..............................%s', res)
Is that your requirement?
0
Avatar
Hylkää
evon_dun
Tekijä

I don't understand what you said above but my requirement is very simple. The report is created by me already using Openoffice(base report designer) then i created a wizard in my custom module, i defined two fields date_from and date_to on the wizard and whatever dates are selected there i want to print them on my report which i called from here. Now its clear i hope. Please let me know if you have a solution to it.

evon_dun
Tekijä

I added few screen shots above.

Anuradha

@evon sorry I dnt have any idea :(

Avatar
babis peroukas
Paras vastaus

I copy the code from sale.py that I edited to send some fields to my invoice.

   def _prepare_invoice(self, cr, uid, order, lines, context=None):
    """Prepare the dict of values to create the new invoice for a
       sales order. This method may be overridden to implement custom
       invoice generation (making sure to call super() to establish
       a clean extension chain).

       :param browse_record order: sale.order record to invoice
       :param list(int) line: list of invoice line IDs that must be
                              attached to the invoice
       :return: dict of value to create() the invoice
    """
    if context is None:
        context = {}
    journal_ids = self.pool.get('account.journal').search(cr, uid,
        [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)],
        limit=1)
    if not journal_ids:
        raise osv.except_osv(_('Error!'),
            _('Please define sales journal for this company: "%s" (id:%d).') % (order.company_id.name, order.company_id.id))
    invoice_vals = {
        'name': order.client_order_ref or '',
        'origin': order.name,
        'type': 'out_invoice',
        'reference': order.client_order_ref or order.name,
        'account_id': order.partner_id.property_account_receivable.id,
        'partner_id': order.partner_invoice_id.id,
        'journal_id': journal_ids[0],
        'invoice_line': [(6, 0, lines)],
        'currency_id': order.pricelist_id.currency_id.id,
        'comment': order.note,
        'payment_term': order.payment_term and order.payment_term.id or False,
        'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
        'date_invoice': context.get('date_invoice', False),
        'company_id': order.company_id.id,
        'user_id': order.user_id and order.user_id.id or False,
        'x_destplace': order.x_destplace,
        'x_loadplace': order.x_loadplace,
        'x_vehivle': order.x_vehicle
    }

    # Care for deprecated _inv_get() hook - FIXME: to be removed after 6.1
    invoice_vals.update(self._inv_get(cr, uid, order, context=context))
    return invoice_vals

I 've added the x_ fields in both models (sales.order and account.invoice) and with this addition to the code (in invoice_vals) it just copies their values. So if you want to send those values to your invoice and then print it you have to create something like a _prepare_invoice function.

0
Avatar
Hylkää
evon_dun
Tekijä

the account.invoice model doesn't contain these fields, these are in the wizard.

babis peroukas

Ah then you have to send those fields from your form to the account.invoice. Wait a minute I 'll copy a code.

babis peroukas

sry I dont know how to post a code clearly

babis peroukas

Also check this video http://www.youtube.com/watch?v=5dDoPcm6pVM

Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
repport that contains the list of users
wizard print report reports
Avatar
0
maalisk. 15
4378
Printing report from the form view...
wizard print report record browse
Avatar
Avatar
1
maalisk. 15
10670
Change PDF report name on wizard
wizard report
Avatar
Avatar
2
heinäk. 24
4188
Blank report PDF from Wizard Ratkaistu
wizard report
Avatar
Avatar
2
huhtik. 24
3712
External ID not found in the system
wizard report
Avatar
4
lokak. 20
6635
Yhteisö
  • Kurssit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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