currency_obj = self.pool.get('res.currency')
product_obj = self.pool.get('product.product')
- product_template_obj = self.pool.get('product.template')
product_category_obj = self.pool.get('product.category')
product_uom_obj = self.pool.get('product.uom')
supplierinfo_obj = self.pool.get('product.supplierinfo')
price = 0.0
if sinfo:
qty_in_product_uom = qty
- product_default_uom = product_template_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0]
+ product_default_uom = product_obj.read(cr, uid, [product_id], ['uom_id'])[0]['uom_id'][0]
supplier = supplierinfo_obj.browse(cr, uid, sinfo, context=context)[0]
seller_uom = supplier.product_uom and supplier.product_uom.id or False
if seller_uom and product_default_uom and product_default_uom != seller_uom:
item_obj = self.pool.get('product.pricelist.item')
price_type_obj = self.pool.get('product.price.type')
product_obj = self.pool.get('product.product')
- template_obj = self.pool.get('product.template')
field_name = 'list_price'
if res_dict.get('item_id',False) and res_dict['item_id'].get(pricelist,False):
field_name = price_type_obj.browse(cr, uid, item_base).field
product = product_obj.browse(cr, uid, product_id, context)
- product_tmpl_id = product.product_tmpl_id.id
-
- product_read = template_obj.read(cr, uid, product_tmpl_id, [field_name], context)
+ product_read = product_obj.read(cr, uid, product_id, [field_name], context)
factor = 1.0
if uom and uom != product.uom_id.id:
item_obj = self.pool.get('product.pricelist.item')
price_type_obj = self.pool.get('product.price.type')
product_obj = self.pool.get('product.product')
- template_obj = self.pool.get('product.template')
field_name = 'list_price'
if res_dict.get('item_id',False) and res_dict['item_id'].get(pricelist,False):
field_name = price_type_obj.browse(cr, uid, item_base).field
product = product_obj.browse(cr, uid, product_id, context)
- product_tmpl_id = product.product_tmpl_id.id
-
- product_read = template_obj.read(cr, uid, product_tmpl_id, [field_name], context)
+ product_read = product_obj.read(cr, uid, product_id, [field_name], context)
factor = 1.0
if uom and uom != product.uom_id.id:
self.change_product_qty_send_note(cr, uid, [data.id], context)
return {}
- def change_product_qty_send_note (self, cr, uid, ids, context=None):
+ def change_product_qty_send_note(self, cr, uid, ids, context=None):
prod_obj = self.pool.get('product.product')
location_obj = self.pool.get('stock.location')
- prod_temp_obj = self.pool.get('product.template')
- uom_obj = self.pool.get('product.uom')
for data in self.browse(cr, uid, ids, context=context):
- for location in location_obj.browse(cr, uid, [data.location_id.id], context=context):
- location_name = location.name
- for prod in prod_obj.browse(cr, uid, [data.product_id.id], context=context):
- for prod_temp in prod_temp_obj.browse(cr, uid, [prod.product_tmpl_id.id], context=context):
- for uom in uom_obj.browse(cr, uid, [prod_temp.uom_id.id], context=context):
- message = _("<b>Quantity has been changed</b> to <em>%s %s </em> for <em>%s</em> location.") % (data.new_quantity,uom.name,location_name)
- prod_obj.message_append_note(cr, uid, [prod.id], body=message, context=context)
+ location_name = location_obj.browse(cr, uid, data.location_id.id, context=context).name
+ message = _("<b>Quantity has been changed</b> to <em>%s %s </em> for <em>%s</em> location.") % (data.new_quantity, data.product_id.uom_id.name, location_name)
+ prod_obj.message_append_note(cr, uid, [data.product_id.id], body=message, context=context)
stock_change_product_qty()
planning_obj = self.pool.get('stock.planning')
mod_obj = self.pool.get('ir.model.data')
prod_categ_obj = self.pool.get('product.category')
- template_obj = self.pool.get('product.template')
planning_lines = []
for f in self.browse(cr, uid, ids, context=context):
if f.forecasted_products:
else:
categ_ids = f.product_categ_id.id and [f.product_categ_id.id] or []
prod_categ_ids = prod_categ_obj.search(cr,uid,[('parent_id','child_of',categ_ids)])
- templates_ids = template_obj.search(cr,uid,[('categ_id','in',prod_categ_ids)])
- products_id1 = product_obj.search(cr,uid,[('product_tmpl_id','in',templates_ids)])
+ products_id1 = product_obj.search(cr,uid,[('categ_id','in',prod_categ_ids)])
if len(products_id1)==0:
raise osv.except_osv(_('Error !'), _('No forecasts for selected period or no products in selected category !'))
forecast_obj = self.pool.get('stock.sale.forecast')
mod_obj = self.pool.get('ir.model.data')
prod_categ_obj = self.pool.get('product.category')
- template_obj = self.pool.get('product.template')
forecast_lines = []
for f in self.browse(cr, uid, ids, context=context):
categ_ids = f.product_categ_id.id and [f.product_categ_id.id] or []
prod_categ_ids = prod_categ_obj.search(cr, uid, [('parent_id','child_of', categ_ids)])
- templates_ids = template_obj.search(cr, uid, [('categ_id','in',prod_categ_ids)])
- products_ids = product_obj.search(cr, uid, [('product_tmpl_id','in',templates_ids)])
+ products_ids = product_obj.search(cr, uid, [('categ_id','in',prod_categ_ids)])
if len(products_ids) == 0:
raise osv.except_osv(_('Error !'), _('No products in selected category !'))
copy = f.copy_forecast