[IMP] ir.model.data new api

bzr revid: al@openerp.com-20140129030853-aqm4nu8buhj9gu7n
This commit is contained in:
Antony Lesuisse 2014-01-29 04:08:53 +01:00
parent 033c38c304
commit 6b7d9f2bac
4 changed files with 5 additions and 5 deletions

View File

@ -499,7 +499,7 @@ class mail_thread(osv.AbstractModel):
posted = False
for subtype in subtypes:
subtype_rec = self.pool.get('ir.model.data').get_object(cr, uid, subtype.split('.')[0], subtype.split('.')[1], context=context, raise_exception=False)
subtype_rec = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, subtype, context=context)
if not (subtype_rec and subtype_rec.exists()):
_logger.debug('subtype %s not found' % subtype)
continue

View File

@ -94,7 +94,7 @@ class publisher_warranty_contract(osv.osv):
# old behavior based on res.log; now on mail.message, that is not necessarily installed
IMD = self.pool['ir.model.data']
user = self.pool['res.users'].browse(cr, SUPERUSER_ID, SUPERUSER_ID)
poster = IMD.get_object(cr, SUPERUSER_ID, 'mail', 'group_all_employees', context=context, raise_exception=False)
poster = IMD.xmlid_to_object(cr, SUPERUSER_ID, 'mail.group_all_employees', context=context)
if not (poster and poster.exists()):
if not user.exists():
return True

View File

@ -120,7 +120,7 @@ Example: 10% for retailers, promotion of 5 EUR on this product, etc."""),
user = self.pool.get('res.users').browse(cr, uid, uid, context)
res['time_unit'] = user.company_id.project_time_mode_id.id
else:
product = ir_model_data.get_object(cr, uid, 'product', 'product_product_consultant', raise_exception=False)
product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
if product and product.exists():
res['time_unit'] = product.uom_id.id
return res
@ -138,7 +138,7 @@ Example: 10% for retailers, promotion of 5 EUR on this product, etc."""),
wizard = self.browse(cr, uid, ids)[0]
if wizard.time_unit:
product = ir_model_data.get_object(cr, uid, 'product', 'product_product_consultant', raise_exception=False)
product = ir_model_data.xmlid_object(cr, uid, 'product.product_product_consultant')
if product and product.exists():
product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
else:

View File

@ -28,7 +28,7 @@ class stock_fill_inventory(osv.osv_memory):
_description = "Import Inventory"
def _default_location(self, cr, uid, ids, context=None):
location = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock', raise_exception=False)
location = self.pool.get('ir.model.data').xmlid_to_object(cr, uid, 'stock.stock_location_stock')
if not location.exists():
return False
try: