Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

wizard form value browsing [Closed]

By
gpkarthick
on 5/2/13, 10:32 AM 2,167 views

The Question has been closed

by
Sudhir Arya (SA)
on 05/19/2014 13:33:18

class lead_target_wizard(osv.osv_memory): _name = 'lead.target.wizard' _description = 'lead target wizard report'

_columns = {
    'target_selection': fields.selection([('daily','daily'),('weekly','weekly'),('monthly','monthly')], 'Selection',select=True),
    }
def check_report(self, cr, uid, ids, context=None):
    datas = {}
    if context is None:
        context = {}
    data = self.read(cr, uid, ids, [], context=context)[0]
    datas = {
         'ids': context.get('active_ids',[]),
         'model': 'account.invoice',
         'form': data
    }
    return {
        'type': 'ir.actions.report.xml',
        'report_name': 'leadtarget_crm.lead',
        'datas': datas,
    }

lead_target_wizard()

#####################and I have a XML File################ <openerp> <data>

    <record id="crm_lead_target_view" model="ir.ui.view">
        <field name="name">Lead Target</field>
        <field name="model">lead.target.wizard</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Target Lead">
                <group colspan="4" col="6">
                    <field name="target_selection"/>
                </group>
                <separator colspan="4"/>
                <group colspan="4" col="6">
                    <button special="cancel" string="Cancel" icon="gtk-cancel"/>
                    <button name="check_report" string="Print" type="object" icon="gtk-print"/>
                </group>
            </form>
        </field>
    </record>

    <record id="action_lead_target" model="ir.actions.act_window">
        <field name="name">Lead Target111</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">lead.target.wizard</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="crm_lead_target_view"/>
        <field name="target">new</field>
    </record>

    <record model="ir.values" id="crm_lead_target_report_values">
        <field name="model_id" ref="account.model_account_invoice" />
        <field name="object" eval="1" />
        <field name="name">Lead Target</field>
        <field name="key2">client_print_multi</field>
        <field name="value" eval="'ir.actions.act_window,' + str(ref('action_lead_target'))" />
        <field name="key">action</field>
        <field name="model">crm.lead</field>
    </record>   

</data>

</openerp>

##############UPto this are working fine, and wizard form is open I need to browse the selection field val in my report folder python file how to do this can any one help me ##########

mport time from report import report_sxw #from tools import amount_to_text_en import pooler from tools import amount_to_text #from tools.amount_to_text import amount_to_text_infrom tools.translate import _

class lead_target(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(lead_target, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time,
'get_name':self.get_name, #'get_parenttax':self.get_parenttax, }) self.context = context def get_name(self, form): here I need to get the selection value daily, weekly, monthly print target_selection, "print the selection field value how to get that" plz can any one help me............

1

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 5/2/13, 10:44 AM

You can do so by data['form'['your_field_name']

def get_name(self, form):
    print form['target_selection]

This will print value selected in wizard.

thanks friend Mr.sudhir arya it's working fine

gpkarthick
on 5/3/13, 2:39 AM

ok it is working fine we can browse the wizard form selection value but i could not browse the crm.lead table(self.pool.get(crm.lead) not working) how to do that plz ans me

gpkarthick
on 5/3/13, 7:39 AM

What error/problem you are facing during crm.lead browse?

Sudhir Arya (SA)
on 5/3/13, 8:33 AM

i tried to browse the crm.lead in that same function it's show me a error, cr is not defined plz tell me how to browse val (get_name function)

gpkarthick
on 5/3/13, 10:04 AM

in report parsing py you cannot ur cr, uid directly. You should use self.cr, self.uid. It will work.

Sudhir Arya (SA)
on 5/5/13, 2:21 AM

thank you very much Mr.arya It's working fine I added one more question search method compare of current date which is date format with date_open is crm_lead field which is string format. i Have given the code just look at that............. advance thanks

gpkarthick
on 5/6/13, 6:54 AM

I have arrised a quistion in this subject name(wizard report error __new__() takes exactly 1 argument (2 given)) -----> i know you can this question plz read it and ans me advanced thanks

gpkarthick
on 5/8/13, 7:54 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/2/13, 10:32 AM
Seen: 2167 times
Last updated: 3/16/15, 8:10 AM