From 790f880a4ce3238ba656440896b422843025ff84 Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Mon, 11 Nov 2013 17:32:32 +0100 Subject: [PATCH] [FIX] View and sequence management (default value) --- crm_claim_rma/__init__.py | 1 - crm_claim_rma/crm_claim_rma.py | 7 +++++-- crm_claim_rma/crm_claim_rma_view.xml | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crm_claim_rma/__init__.py b/crm_claim_rma/__init__.py index 83bdcaa3..1f13157b 100644 --- a/crm_claim_rma/__init__.py +++ b/crm_claim_rma/__init__.py @@ -19,7 +19,6 @@ # along with this program. If not, see . # ############################################################################## - from . import wizard from . import crm_claim_rma from . import account_invoice diff --git a/crm_claim_rma/crm_claim_rma.py b/crm_claim_rma/crm_claim_rma.py index 66fa4745..512786e9 100644 --- a/crm_claim_rma/crm_claim_rma.py +++ b/crm_claim_rma/crm_claim_rma.py @@ -247,7 +247,9 @@ class crm_claim(orm.Model): _inherit = 'crm.claim' def _get_sequence_number(self, cr, uid, context=None): - return obj.pool.get('ir.sequence').get(cr, uid, 'crm.claim') + res = self.pool.get('ir.sequence').get(cr, uid, + 'crm.claim.rma', context=context) or '/' + return res def _get_default_warehouse(self, cr, uid, context=None): company_id = self.pool.get('res.users').browse(cr, uid, uid, @@ -260,7 +262,7 @@ class crm_claim(orm.Model): return wh_ids[0] _columns = { - 'number': fields.char('Number', size=128, readonly=True, + 'number': fields.char('Number', readonly=True, states={'draft': [('readonly', False)]}, required=True, help="Company internal claim unique number"), @@ -284,6 +286,7 @@ class crm_claim(orm.Model): 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True), } + _defaults = { 'number': _get_sequence_number, 'claim_type': 'customer', diff --git a/crm_claim_rma/crm_claim_rma_view.xml b/crm_claim_rma/crm_claim_rma_view.xml index 85d53912..d10e5438 100644 --- a/crm_claim_rma/crm_claim_rma_view.xml +++ b/crm_claim_rma/crm_claim_rma_view.xml @@ -90,7 +90,6 @@ -