Add init method to initialize a value in claim 'number' (avoiding tests to crash)

This commit is contained in:
Joël Grand-Guillaume
2014-07-16 15:10:46 +02:00
parent fdfbd40096
commit 4d4a964a71

View File

@@ -338,6 +338,12 @@ class claim_line(orm.Model):
class crm_claim(orm.Model):
_inherit = 'crm.claim'
def init(self, cr):
cr.execute("""
UPDATE "crm_claim" SET "number"=id::varchar WHERE ("number" is NULL)
OR ("number" = '/');
""")
def _get_sequence_number(self, cr, uid, context=None):
seq_obj = self.pool.get('ir.sequence')
res = seq_obj.get(cr, uid, 'crm.claim.rma', context=context) or '/'