[英]OpenERP Function python
I want to do on the writing process. 我想在写作过程中做。 I have created e new field in the tree view ' ' Total Caisse' '.
我在树状视图“ Total Caisse”中创建了一个新字段。 I want to show the same total existing ' Montant' , but if journal id ''Journal des achats " Total negative shows
我想显示相同的总数'Montant' ,但是如果日志ID ” Journal des achats”总共显示否定
For example 例如
this true function 这个真正的功能
def _amount_compute(self, cr, uid, ids, name, args, context, where =''):
if not ids: return {}
cr.execute( 'SELECT move_id, SUM(debit) '\
'FROM account_move_line '\
'WHERE move_id IN %s '\
'GROUP BY move_id', (tuple(ids),))
result = dict(cr.fetchall())
for id in ids:
result.setdefault(id, 0.0)
return result
this my function 这是我的职责
def _caisse _compute(self, cr, uid, ids, name, args, context, where =''):
if not ids: return {}
cr.execute( 'SELECT journal_id,SUM(debit) *-1 '\
'FROM account_move_line '\
'WHERE journal_id =2 '\
'GROUP BY journal_id', (tuple(ids),))
result = dict(cr.fetchall())
for id in ids:
result.setdefault(id, 0.0)
return result
Your query is still unclear for us. 您的查询对我们仍然不清楚。
Regrading: if journal id ''Journal des achats " Total negative shows 正在升级: 如果日记帐编号为“日记帐”,则总否定显示
Correct your query by replacing SELECT journal_id,SUM(debit) *-1 '
with SELECT journal_id,SUM(debit)'
Like: 通过更换更正您的查询
SELECT journal_id,SUM(debit) *-1 '
与SELECT journal_id,SUM(debit)'
我爱:
cr.execute( 'SELECT journal_id,SUM(debit)'\
'FROM account_move_line '\
'WHERE journal_id =2 '\
'GROUP BY journal_id', (tuple(ids),))
I hope it may help in your case. 希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.