~torbat-j/+junk/ncdierp

« back to all changes in this revision

Viewing changes to ierp_loan/wizard/report_6_collateral_wizard.py

  • Committer: erka
  • Date: 2014-10-21 08:43:45 UTC
  • Revision ID: erka-20141021084345-vb5veh7pk63zeys9
Зээл болон худалдан авалтын классын дагуу нэмэлт талбаруудыг нэмэв.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
import time
 
3
from openerp.osv import osv, fields
 
4
import datetime
 
5
from dateutil import parser
 
6
from openerp.tools.translate import _
 
7
 
 
8
class collateral_report_wizard(osv.osv_memory):
 
9
        _name = 'collateral.report.wizard'
 
10
        _description = 'Collateral Report Wizard'
 
11
        
 
12
        _columns = {
 
13
                'note':fields.char(u'Тайлангийн нэр',size=64,readonly=True),
 
14
                'from_date': fields.date(u'Эхлэх огноо',required=True),
 
15
                'to_date': fields.date(u'Дуусах огноо',required=True),
 
16
        }
 
17
        
 
18
        _defaults = {
 
19
        'note': u'Барьцаа хөрөнгийн тайлан',
 
20
        'from_date': lambda * a: time.strftime('%Y-01-01'),
 
21
        'to_date': fields.date.context_today,
 
22
    }
 
23
        def print_report(self, cr, uid, ids, context=None):
 
24
                data = self.read(cr,uid,ids,[])[0]
 
25
                print data,'------------------------'
 
26
                context['from_date'] = data['from_date']
 
27
                context['to_date'] = data['to_date']
 
28
                
 
29
                return {
 
30
            'type'         : 'ir.actions.report.xml',
 
31
            'context':context,
 
32
            'report_name'   : 'collateral',
 
33
            'datas': {
 
34
                    'model':'loan.payment',
 
35
                    'id': context.get('active_ids') and context.get('active_ids')[0] or False,
 
36
                    'ids': context.get('active_ids') and context.get('active_ids') or [],
 
37
                    'report_type': 'pdf',
 
38
                    'form':data,
 
39
                },
 
40
            'nodestroy': False
 
41
        }
 
42
        
 
43
collateral_report_wizard()