~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-29 09:37:27 UTC
  • Revision ID: popkar77@gmail.com-20120829093727-14mxsq818t2kcvzo
1.凭证变成一页打印2张2.科目名字输出全名3.方向由余额决定

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
                "WHERE fiscalyear_id='%s' and special = 'False' "\
46
46
                "ORDER BY date_start asc ")% (int(fiscalyear_id)))
47
47
        res = cr.dictfetchall()
 
48
        print res
48
49
        return res[0]['id']
49
50
 
50
51
    _defaults = {
67
68
        account = self.pool.get('account.account').browse(cr, uid, datas['account_id'][0], context=context)
68
69
        #if(account.code[0:4] == '1001' or account.code[0:4] == '1002'):
69
70
        if(account.code[0:3] == '210' or account.code < '114' and account.code > '0'):
 
71
            datas['account_code'] = account.code[0:4]
70
72
            if(account.currency_id):
71
73
                report_name = 'account.currency_cash_journal'
72
74
            else:
73
75
                report_name = 'account.cash_journal'
74
 
        elif datas.get('product',''):
 
76
        elif datas.get('product', False):
75
77
            report_name =  'account.stock_ledger'
76
78
        else:
77
79
            report_name = 'account.threecolumns_ledger'
108
110
        }
109
111
    
110
112
    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']
 
113
        period_obj = self.pool.get('account.period')
 
114
        ids = period_obj.find(cr, uid, context=context)
 
115
        fiscalyear_id = period_obj.browse(cr, uid, ids[0]).fiscalyear_id.id
 
116
        period_ids = period_obj.search(cr, uid, [('special','=','False'),('fiscalyear_id','=',fiscalyear_id)],order='date_start asc')
 
117
        #cr.execute(("SELECT date_start ,fiscalyear_id,id "\
 
118
                #"FROM account_period "\
 
119
                #"WHERE fiscalyear_id='%s' and special = 'False' "\
 
120
                #"ORDER BY date_start asc ")% (int(fiscalyear_id)))
 
121
        #res = cr.dictfetchall()
 
122
        return period_ids[0]
119
123
 
120
124
    _defaults = {
121
125
        'company_id':lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),