0
양식에서 필드를 편집 한 횟수를 계산하려면 동일한 양식의 'Number of Edits'라는 다른 필드로 계수를 전달해야합니다. 이 코드는 잘 작동Odoo 8에서 '필드를 편집하거나 업데이트 한 횟수'를 계산하는 방법은 무엇입니까?
양식에서 필드를 편집 한 횟수를 계산하려면 동일한 양식의 'Number of Edits'라는 다른 필드로 계수를 전달해야합니다. 이 코드는 잘 작동Odoo 8에서 '필드를 편집하거나 업데이트 한 횟수'를 계산하는 방법은 무엇입니까?
..
def write(self, cr, uid, ids, vals, context=None):
quotation_obj=self.browse(cr, uid, ids,context=context)
if partner_id:
count = quotation_obj.number_of_edits + 1
vals.update({'number_of_edits': count})
return super(sale_order, self).write(cr, uid, ids, vals, context=context)
이 여러 IDS/기록에 기록이있는 경우는 충분하지 않습니다 전체 코드
def write(self, cr, uid, ids, vals, context=None):
partner_id=vals.get('partner_id')
quotation_obj=self.browse(cr, uid, ids,context=context)
if not partner_id:
#if partner id not found, find the employee ids
emp_ids=vals.get('employee_ids')
if emp_ids:
# for line in emp_ids:
# employee_ids=line[2]
# else:#update the employee ids
# employee_ids=quotation_obj.employee_ids
for line in emp_ids:
self.pool.get('res.partner').write(cr, uid, quotation_obj.partner_id.id, {'employee_ids': [(4, line[2])]}, context=context)
if partner_id:
emp_ids=vals.get('employee_ids')
if emp_ids:
for line in emp_ids:
self.pool.get('res.partner').write(cr, uid, partner_id, {'employee_ids': [(4, line[2])]}, context=context)
if partner_id:
count = quotation_obj.number_of_edits + 1
vals.update({'number_of_edits': count})
return super(sale_order, self).write(cr, uid, ids, vals, context=context)
입니다. 그리고 'partner_id'는 어디에서 왔습니까? – CZoellner
을 제외하고는 왜 충분하지 않겠는가. 업데이트 될 특정 레코드를 가져오고 카운트를 업데이트하지 않습니까? – danidee