This question has been flagged
1 Reply
3782 Views

can someone help me when i want to generate report im using wizard there is date parameter but it is not appear

Blockquote 'date_to': fields.date("To Date", required=True), }

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

def create_vat(self, cr, uid, ids, context=None):
    if context is None:
        context = {}
    datas = {'ids': context.get('active_ids', [])}
    datas['model'] = 'param.slow.movng.report'
    datas['form'] = self.read(cr, uid, ids)[0]
    #Modified by YH on 03 April 2013 for task [6112]
    return {
        'view_type' : 'report',
        'view_mode' : 'report',
        'view_id' : False,
        'type': 'ir.actions.report.xml',
        'report_name': 'slow.moving.report',
        'datas': datas,
        'nodestroy': True,
        'target' : 'new',
    }
    #End Modified

param_slow_moving_report()

Blockquote <openerp> <data>

    <record id="view_param_machine_efficiency_report" model="ir.ui.view">
        <field name="name">Daily Machine Efficiency (by machine) Report</field>
        <field name="model">param.machine.efficiency.report</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
        <form string="Machine Efficiency Report">                
            <separator string="Machine Efficiency Report" colspan="4"/>
            <label colspan="4" nolabel="1" string="This menu prints Machine Efficinecy Report"/>
            <newline/>
            <field name="date_from"/>
            <field name="date_to"/>            
            <group col="2" colspan="4">
                <button icon='gtk-cancel' special="cancel"  string="Cancel" />
                <button name="create_vat" string="Print" colspan="1" type="object" icon="gtk-ok"/>
            </group>
        </form>
        </field>
    </record>
</data>

</openerp>

Avatar
Discard

Hi , u said your date param is not appearing , can u let us know where ? your view or your report ?

Best Answer

Hi ,

u said your date param is not appearing ? from what i see is that in your create_vat function which you are trying to pass the "datas" into the report that you are calling and this is not the right way to pass the data to the report,

if you are using RML report to print report then for it to pick up your custom data, you need to do something like this ...

class slow_moving_report(report_sxw.rml_parse, common_report_header):

 def some_custom_fields ...

report_sxw.report_sxw('slow.moving.report', 'your.module', 'addons/your_module/report/slow_moving_report.rml', parser=your_module , header="internal")

you can take any module , i.e. sales module and look into the folder report and take a look how how it was created.

Avatar
Discard