결제 방법을 사용하여 인보이스의 상태를 변경해야합니다."if"를 사용하여 openerp에서 "상태"변경
def _payment_type_get(self, cr, uid, ids, field_name, arg, context={}):
result = {}
invoice_obj = self.pool.get('account.move.line')
for rec in self.browse(cr, uid, ids, context):
result[rec.id] = (0, 0)
invoice_id = invoice_obj.search(cr, uid, [(
'move_id', '=', rec.move_id.id)], context=context)
if invoice_id:
inv = invoice_obj.browse(cr, uid, invoice_id[0], context)
if inv.payment_type:
result[rec.id] = (inv.payment_type.id, self.pool.get(
'payment.type').browse(cr, uid, inv.payment_type.id, context).name)
else:
result[rec.id] = (0, 0)
return result
if result != '1':
return self.write(cr, uid, ids, {'state_cheque': 'usado'})
else:
return self.write(cr, uid, ids, {'state_cheque': 'caixa'})
나는의 생성에 지불 유형을 얻기 위해 필요한 송장 닫는 동안, "확인", 그래서 수표 나 그렇지 않은 경우 Usado하는 경우 나, Caixa로 설정할 수 있습니다. 모든 이름이 올바른지 나는 모른다. 내가 말한 사람에게서 그 이름을 복사했기 때문이다.
수표가 저널에 저장되어있는 것처럼 수표는 저널 이름 (ChequeJournal)이있는 특정 저널에 저장됩니다. 기본 상태를 만드는 데 사용할 수 있으면 더 좋을 것입니다.
모든 일일이 시도했으나 실패했습니다. 최근에 지불 유형이 char 또는 string이 아닌 int로 저장된다는 것을 발견했습니다.하지만 여전히 지불 유형은 변경되지 않습니다.
account_move_line.py를 편집하고 있기 때문에 self.write를 사용할 수 없습니다. OpenERP에서 상태를 추가하려는 대상을 찾을 수 없습니다. 따라서 해당 주를 변경하려면 인보이스 ID를 받아야합니다. 새로운 문제가 발생합니까?