[REM] most uses of _model (useless in most cases)
This commit is contained in:
@@ -343,7 +343,7 @@ class AccountChartTemplate(models.Model):
|
||||
# also create an entry in ir_model_data to have an xmlid for the newly created record
|
||||
# xmlid is the concatenation of company_id and template_xml_id
|
||||
ir_model_data = self.env['ir.model.data']
|
||||
template_xmlid = ir_model_data.search([('model', '=', str(template._model)), ('res_id', '=', template.id)])
|
||||
template_xmlid = ir_model_data.search([('model', '=', template._name), ('res_id', '=', template.id)])
|
||||
new_xml_id = str(company.id)+'_'+template_xmlid.name
|
||||
return ir_model_data._update(model, template_xmlid.module, vals, xml_id=new_xml_id, store=True, noupdate=True, mode='init', res_id=False)
|
||||
|
||||
|
||||
@@ -763,7 +763,7 @@ class MailThread(models.AbstractModel):
|
||||
self.ensure_one()
|
||||
database_uuid = self.env['ir.config_parameter'].get_param('database.uuid')
|
||||
return {'headers': repr({
|
||||
'X-Odoo-Objects': "%s-%s" % (self._model, self.id),
|
||||
'X-Odoo-Objects': "%s-%s" % (self._name, self.id),
|
||||
'X-Odoo-db-uuid': database_uuid
|
||||
})}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<template id="message_origin_link">
|
||||
<p>This <t t-esc="self._description.lower()"/> has been <span t-if="edit">modified</span><span t-if="not edit">created</span> from:
|
||||
<t t-foreach="origin" t-as="o">
|
||||
<a href="#" t-att-data-oe-model="o._model" t-att-data-oe-id="o.id"> <t t-esc="o.name"/></a><span t-if="origin.ids[-1:] != o.ids">, </span>
|
||||
<a href="#" t-att-data-oe-model="o._name" t-att-data-oe-id="o.id"> <t t-esc="o.name"/></a><span t-if="origin.ids[-1:] != o.ids">, </span>
|
||||
</t>
|
||||
</p>
|
||||
</template>
|
||||
|
||||
@@ -338,7 +338,7 @@ class MarketingCampaignActivity(models.Model):
|
||||
method = '_process_wi_%s' % (self.action_type,)
|
||||
action = getattr(self, method, None)
|
||||
if not action:
|
||||
raise NotImplementedError('Method %r is not implemented on %r object.' % (method, self._model))
|
||||
raise NotImplementedError('Method %r is not implemented on %r object.' % (method, self._name))
|
||||
return action(workitem)
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class TestResource(TestResourceCommon):
|
||||
|
||||
# Test: schedule hours on intervals, backwards
|
||||
cleaned_intervals.reverse()
|
||||
result = self.ResourceCalendar._model.interval_schedule_hours(cleaned_intervals, 5.5, remove_at_end=False)
|
||||
result = self.ResourceCalendar.interval_schedule_hours(cleaned_intervals, 5.5, remove_at_end=False)
|
||||
self.assertEqual(len(result), 2, 'resource_calendar: wrong hours scheduling in interval')
|
||||
# First interval: 03, 8-10 untouches
|
||||
self.assertEqual(result[0][0], Datetime.from_string('2013-02-04 17:00:00'), 'resource_calendar: wrong leave removal from interval')
|
||||
|
||||
@@ -82,7 +82,7 @@ class Field(models.AbstractModel):
|
||||
attrs['placeholder'] = placeholder
|
||||
|
||||
if options['translate'] and field.type in ('char', 'text'):
|
||||
name = "%s,%s" % (record._model._name, field_name)
|
||||
name = "%s,%s" % (record._name, field_name)
|
||||
domain = [('name', '=', name), ('res_id', '=', record.id), ('type', '=', 'model'), ('lang', '=', options.get('lang'))]
|
||||
translation = record.env['ir.translation'].search(domain, limit=1)
|
||||
attrs['data-oe-translation-state'] = translation and translation.state or 'to_translate'
|
||||
|
||||
@@ -16,7 +16,7 @@ def object_shasign(record=False, res_model='', res_id=None, **kw):
|
||||
shasign = False
|
||||
timestamp = int(time())
|
||||
if record:
|
||||
shasign = sha1('%s%s%s%s' % (record._model, record.id, secret, timestamp)).hexdigest()
|
||||
shasign = sha1('%s%s%s%s' % (record._name, record.id, secret, timestamp)).hexdigest()
|
||||
elif res_model and res_id:
|
||||
shasign = sha1('%s%s%s%s' % (res_model, res_id, secret, timestamp)).hexdigest()
|
||||
return (shasign, timestamp)
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<img class="img pull-left img-circle" t-attf-src="/web/image/res.partner/#{user_id.partner_id.id}/image_small/50x50" style="width: 50px; margin-right: 10px;"/>
|
||||
<div class="pull-left mb32" style="width: 75%%">
|
||||
<textarea rows="4" name="message" class="form-control" placeholder="Write a message..."></textarea>
|
||||
<input type='hidden' name="res_model" t-att-value="object._model"/>
|
||||
<input type='hidden' name="res_model" t-att-value="object._name"/>
|
||||
<input type='hidden' name="res_id" t-att-value="object.id"/>
|
||||
<input type='hidden' name="token" t-att-value="token" t-if="token"/>
|
||||
<input type='hidden' name="sha_in" t-att-value="sha_in" t-if="sha_in"/>
|
||||
|
||||
@@ -297,7 +297,7 @@ class IrHttp(models.AbstractModel):
|
||||
elif module_resource_path:
|
||||
filename = os.path.basename(module_resource_path)
|
||||
else:
|
||||
filename = "%s-%s-%s" % (obj._model._name, obj.id, field)
|
||||
filename = "%s-%s-%s" % (obj._name, obj.id, field)
|
||||
|
||||
# mimetype
|
||||
mimetype = 'mimetype' in obj and obj.mimetype or False
|
||||
|
||||
@@ -13,7 +13,6 @@ class TestIrAttachment(TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestIrAttachment, self).setUp()
|
||||
self.Attachment = self.env['ir.attachment']
|
||||
self.ira = self.Attachment._model
|
||||
self.filestore = self.Attachment._filestore()
|
||||
|
||||
# Blob1
|
||||
|
||||
Reference in New Issue
Block a user