mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
no msg
This commit is contained in:
committed by
Pedro M. Baeza
parent
602e8c5619
commit
45e89f3d0b
@@ -263,12 +263,9 @@ class QcTestTemplate(orm.Model):
|
||||
|
||||
def _default_name(self, cr, uid, context=None):
|
||||
if context and context.get('reference_model', False):
|
||||
id = context.get('reference_id')
|
||||
if not id:
|
||||
id = context.get('active_id')
|
||||
if id:
|
||||
if 'reference_id' in context:
|
||||
source = self.pool[context['reference_model']].browse(
|
||||
cr, uid, id, context=context)
|
||||
cr, uid, context.get('active_id'), context=context)
|
||||
if hasattr(source, 'name'):
|
||||
return source.name
|
||||
|
||||
@@ -356,6 +353,7 @@ class QcTest(orm.Model):
|
||||
This model contains an instance of a test template.
|
||||
"""
|
||||
_name = 'qc.test'
|
||||
_inherit = ['mail.thread', 'ir.needaction_mixin']
|
||||
|
||||
def _success(self, cr, uid, ids, field_name, arg, context=None):
|
||||
result = {}
|
||||
@@ -444,14 +442,14 @@ class QcTest(orm.Model):
|
||||
'enabled': True,
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
def copy(self, cr, uid, copy_id, default=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if default is None:
|
||||
default = {}
|
||||
default['name'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
return super(QcTest, self).copy(cr, uid, id, default, context=context)
|
||||
return super(QcTest, self).copy(cr, uid, copy_id, default,
|
||||
context=context)
|
||||
|
||||
def create(self, cr, uid, datas, context=None):
|
||||
if context and context.get('reference_model', False):
|
||||
@@ -485,19 +483,19 @@ class QcTest(orm.Model):
|
||||
context = {}
|
||||
test_obj = self.pool['qc.test']
|
||||
test_line_obj = self.pool['qc.test.line']
|
||||
for id in ids:
|
||||
test_obj.write(cr, uid, id, {
|
||||
'test_template_id': template_id
|
||||
}, context)
|
||||
test = test_obj.browse(cr, uid, id, context=context)
|
||||
|
||||
for test_id in ids:
|
||||
test_obj.write(cr, uid, test_id, {'test_template_id': template_id},
|
||||
context)
|
||||
test = test_obj.browse(cr, uid, test_id, context=context)
|
||||
if len(test.test_line_ids) > 0:
|
||||
test_line_obj.unlink(cr, uid,
|
||||
[x.id for x in test.test_line_ids],
|
||||
context=context)
|
||||
test_lines = self._prepare_test_lines(
|
||||
cr, uid, test, force_fill=force_fill, context=context)
|
||||
test_obj.write(cr, uid, id, {'test_line_ids': test_lines}, context)
|
||||
if test_lines:
|
||||
test_obj.write(cr, uid, id, {'test_line_ids': test_lines},
|
||||
context)
|
||||
|
||||
def _prepare_test_lines(self, cr, uid, test, force_fill=False,
|
||||
context=None):
|
||||
|
||||
Reference in New Issue
Block a user