mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
Use pre_init_hook to fill claim number
This commit is contained in:
@@ -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" = '/');
|
||||
""")
|
||||
@@ -94,6 +94,7 @@ Contributors:
|
||||
'images/return_line.png',
|
||||
'images/exchange.png',
|
||||
],
|
||||
'pre_init_hook': 'fill_claim_number',
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user