~openerp-chinese-team/openerp-china/openerp-china

« back to all changes in this revision

Viewing changes to oecn_account_print/wizard/oecn_account_print_wizard.py

  • Committer: JoshuaJan
  • Date: 2012-08-22 09:24:05 UTC
  • Revision ID: popkar77@gmail.com-20120822092405-349syo9uytkkzeit
修改报表样式

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    _name = 'detail.ledger'
30
30
    _descript = 'Detail Ledger(Cash journal, Foreign Currency journal, Stock Ledger, Three columns ledger)'
31
31
    _columns = {
32
 
        'account_id':fields.many2one('account.account', 'Account', required=True),
 
32
        'account_id':fields.many2one('account.account', 'Account', required=True, domain=[('type','!=','view')]),
33
33
        'company_id':fields.many2one('res.company', 'Company', required=True),
34
 
        'period_from':fields.many2one('account.period', 'Period From', required=True),
35
 
        'period_to':fields.many2one('account.period', 'Period To', required=True),
 
34
        'period_from':fields.many2one('account.period', 'Period From', required=True, domain=[('special','=',False)]),
 
35
        'period_to':fields.many2one('account.period', 'Period To', required=True, domain=[('special','=', False)]),
36
36
        'partner':fields.many2one('res.partner', 'Partner'),
37
37
        'product':fields.many2one('product.product','Product'),
38
38
    }
42
42
        fiscalyear_id = self.pool.get('account.period').browse(cr, uid, ids[0]).fiscalyear_id
43
43
        cr.execute(("SELECT date_start ,fiscalyear_id,id "\
44
44
                "FROM account_period "\
45
 
                "WHERE fiscalyear_id='%s' "\
 
45
                "WHERE fiscalyear_id='%s' and special = 'False' "\
46
46
                "ORDER BY date_start asc ")% (int(fiscalyear_id)))
47
47
        res = cr.dictfetchall()
48
48
        return res[0]['id']
49
49
 
50
50
    _defaults = {
51
51
        'company_id':lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
52
 
        'period_to':lambda s, cr, uid, c:s.pool.get('account.period').find(cr, uid, context=c)[0],
 
52
        'period_to':lambda s, cr, uid, c:s.pool.get('account.period').find(cr, uid, context={'account_period_prefer_normal':True})[0],
53
53
        'period_from':_get_period_from
54
54
    }
55
55
 
92
92
    _name = 'general.ledger'
93
93
    _description = 'General Ledger'
94
94
    _columns = {
95
 
        'account_ids':fields.many2many('account.account', 'general_ledger_account_account_rel','general_ledger_id','account_id', 'Account', required=True),
 
95
        'account_ids':fields.many2many('account.account', 'general_ledger_account_account_rel','general_ledger_id','account_id', 'Account', required=True, domain=[('type','!=','view')]),
96
96
        'company_id':fields.many2one('res.company', 'Company', required=True),
97
 
        'period_from':fields.many2one('account.period', 'Period From', required=True),
98
 
        'period_to':fields.many2one('account.period', 'Period To', required=True),
 
97
        'period_from':fields.many2one('account.period', 'Period From', required=True, domain=[('special','=',False)]),
 
98
        'period_to':fields.many2one('account.period', 'Period To', required=True, domain=[('special','=',False)]),
99
99
    }
100
100
 
101
101
    def print_report(self, cr, uid, ids, context=None):
106
106
            'report_name':'account.general_ledger',
107
107
            'datas':datas,
108
108
        }
 
109
    
 
110
    def _get_period_from(self, cr, uid, data, context=None):
 
111
        ids = self.pool.get('account.period').find(cr, uid, context=context)
 
112
        fiscalyear_id = self.pool.get('account.period').browse(cr, uid, ids[0]).fiscalyear_id
 
113
        cr.execute(("SELECT date_start ,fiscalyear_id,id "\
 
114
                "FROM account_period "\
 
115
                "WHERE fiscalyear_id='%s' and special = 'False' "\
 
116
                "ORDER BY date_start asc ")% (int(fiscalyear_id)))
 
117
        res = cr.dictfetchall()
 
118
        return res[0]['id']
 
119
 
 
120
    _defaults = {
 
121
        'company_id':lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
 
122
        'period_to':lambda s, cr, uid, c:s.pool.get('account.period').find(cr, uid, context={'account_period_prefer_normal':True})[0],
 
123
        'period_from':_get_period_from
 
124
    }    
109
125
 
110
126
general_ledger()
111
127
# vim:expandtab:smartindent:tabstop=4;softtabstop=4;shiftwidth=4;