Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用编码保存在temp中_Python_Openerp - Fatal编程技术网

Python 如何使用编码保存在temp中

Python 如何使用编码保存在temp中,python,openerp,Python,Openerp,前几天,我问过如何存储我们在字段A中填写的数据,字段B也会出现。我发现了,但出现了一些问题。 这是我的密码 def _compute_dept(self, cr, uid, ids, deposit, available, arg, context=None): result = {} for r in self.browse(cr, uid, ids, context=context): avail=0 if r.deposit:

前几天,我问过如何存储我们在字段A中填写的数据,字段B也会出现。我发现了,但出现了一些问题。 这是我的密码

def _compute_dept(self, cr, uid, ids, deposit, available, arg, context=None):
    result = {}
    for r in self.browse(cr, uid, ids, context=context):
       avail=0
       if r.deposit:
            avail = r.deposit
            print avail
       result[r.id] = avail
    return result
_columns = {
    'name': fields.many2one('res.partner','Partner'),
    'date':fields.date('Date of Deposit'),
    'deposit': fields.float('Deposit'),
    'available': fields.function(_compute_dept, type='float', method=True, store=True, string='Available', readonly=True),
    'note': fields.text('Description'),
}
但是出现的问题。如果我在字段A“10”中键入,则字段B也会显示“10”,但当我在字段A“20”中再次键入时,字段B会显示“20”。。应该是30,因为10+20。因此,如何保持编码温度中的数字10。字段B显示数字30


备注:A区为押金区,B区可用

您应该更改您的设计


您需要一个有多(多)笔存款的
银行账户
。然后在
银行账户
模型中创建一个
可用
功能字段。

哪些字段?我在你的代码中没有看到任何字段。你是什么意思?所以在这里。字段B(可用)有数字20时的点。字段A(存款)上加上的数字10字段B的结果是30