12
by Jeff Wang
Change account move form |
1 |
# -*- encoding: utf-8 -*-
|
2 |
# __author__ = jeff@openerp.cn
|
|
3 |
from osv import osv, fields |
|
4 |
from tools.translate import _ |
|
5 |
||
6 |
class account_move(osv.osv): |
|
7 |
_inherit = 'account.move' |
|
8 |
"""
|
|
9 |
添加制单、审核、附件数三个字段
|
|
10 |
"""
|
|
11 |
_columns = { |
|
12 |
'write_uid':fields.many2one('res.users', '审核', readonly=True), |
|
13 |
'create_uid':fields.many2one('res.users', '制单', readonly=True, select=True), |
|
14 |
'proof':fields.integer('附件数', required=True, help='该记账凭证对应的原始凭证数量'), |
|
15 |
}
|
|
16 |
"""
|
|
17 |
附件数默认为1张
|
|
18 |
凭证业务类型默认为总帐
|
|
19 |
"""
|
|
20 |
_defaults = { |
|
21 |
'proof': lambda *args: 1, |
|
22 |
'journal_id': lambda self, cr, uid, context:self.pool.get('account.journal').search(cr, uid, [('type', '=', 'general')], limit=1)[0] |
|
23 |
}
|
|
24 |
||
25 |
account_move() |
|
26 |
||
13
by Jeff Wang
add detail ledger wizard and move print action |
27 |
class account_account(osv.osv): |
28 |
_inherit = 'account.account' |
|
29 |
"""
|
|
30 |
Replace metheod accoun.account.name_get(), show full name of account on many2one field
|
|
31 |
Sample “100902 其他货币资金/银行本票”
|
|
32 |
"""
|
|
33 |
def name_get(self, cr, uid, ids, context={}): |
|
34 |
if not len(ids): |
|
35 |
return [] |
|
36 |
reads = self.read(cr, uid, ids, ['name', 'code','parent_id'], context) |
|
37 |
res = [] |
|
38 |
for record in reads: |
|
39 |
name = record['name'] |
|
40 |
if record['code']: |
|
41 |
||
42 |
if record['parent_id']: |
|
43 |
account_parent_id = record['parent_id'][0] |
|
44 |
while account_parent_id: |
|
45 |
parent_obj = self.read(cr, uid, account_parent_id, ['name', 'parent_id'], context) |
|
46 |
name = parent_obj['name'] + '/'+name |
|
47 |
if parent_obj['parent_id']: |
|
48 |
account_parent_id = parent_obj['parent_id'][0] |
|
49 |
else: |
|
50 |
account_parent_id = False |
|
51 |
||
52 |
name = record['code'] + ' '+name |
|
53 |
res.append((record['id'], name)) |
|
54 |
return res |
|
55 |
||
56 |
account_account() |
|
57 |