Use pre_init_hook to fill claim number

This commit is contained in:
Aristobulo Meneses
2015-07-31 13:14:58 +02:00
parent 890ec06c47
commit b11121025c
3 changed files with 8 additions and 7 deletions

View File

@@ -26,3 +26,10 @@ from . import wizard
from . import crm_claim_rma
from . import account_invoice
from . import stock
def fill_claim_number(self, cr):
cr.execute("""
UPDATE "crm_claim" SET "number"=id::varchar
WHERE ("number" is NULL)
OR ("number" = '/');
""")

View File

@@ -94,6 +94,7 @@ Contributors:
'images/return_line.png',
'images/exchange.png',
],
'pre_init_hook': 'fill_claim_number',
'installable': True,
'auto_install': False,
}

View File

@@ -401,13 +401,6 @@ class ClaimLine(Model):
class CrmClaim(Model):
_inherit = 'crm.claim'
def init(self, cr):
cr.execute("""
UPDATE "crm_claim" SET "number"=id::varchar
WHERE ("number" is NULL)
OR ("number" = '/');
""")
@api.model
def _get_sequence_number(self):
seq_obj = self.env['ir.sequence']