diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 7120625d8ab..f3617106f28 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -82,7 +82,7 @@ class account_analytic_line(osv.osv): if j_id.type == 'purchase': unit = prod.uom_po_id.id if j_id.type <> 'sale': - a = prod.product_tmpl_id.property_account_expense.id + a = prod.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: @@ -91,7 +91,7 @@ class account_analytic_line(osv.osv): 'for this product: "%s" (id:%d).') % \ (prod.name, prod.id,)) else: - a = prod.product_tmpl_id.property_account_income.id + a = prod.property_account_income.id if not a: a = prod.categ_id.property_account_income_categ.id if not a: diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index ed6a21eb950..3defd82d0ac 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1476,11 +1476,11 @@ class account_invoice_line(osv.osv): res = self.pool.get('product.product').browse(cr, uid, product, context=context) if type in ('out_invoice','out_refund'): - a = res.product_tmpl_id.property_account_income.id + a = res.property_account_income.id if not a: a = res.categ_id.property_account_income_categ.id else: - a = res.product_tmpl_id.property_account_expense.id + a = res.property_account_expense.id if not a: a = res.categ_id.property_account_expense_categ.id a = fpos_obj.map_account(cr, uid, fpos, a) diff --git a/addons/account_anglo_saxon/stock.py b/addons/account_anglo_saxon/stock.py index 6243fd285d0..191249a6640 100644 --- a/addons/account_anglo_saxon/stock.py +++ b/addons/account_anglo_saxon/stock.py @@ -36,7 +36,7 @@ class stock_picking(osv.osv): for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context): for ol in inv.invoice_line: if ol.product_id: - oa = ol.product_id.product_tmpl_id.property_stock_account_output and ol.product_id.product_tmpl_id.property_stock_account_output.id + oa = ol.product_id.property_stock_account_output and ol.product_id.property_stock_account_output.id if not oa: oa = ol.product_id.categ_id.property_stock_account_output_categ and ol.product_id.categ_id.property_stock_account_output_categ.id if oa: @@ -48,7 +48,7 @@ class stock_picking(osv.osv): for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context): for ol in inv.invoice_line: if ol.product_id: - oa = ol.product_id.product_tmpl_id.property_stock_account_input and ol.product_id.product_tmpl_id.property_stock_account_input.id + oa = ol.product_id.property_stock_account_input and ol.product_id.property_stock_account_input.id if not oa: oa = ol.product_id.categ_id.property_stock_account_input_categ and ol.product_id.categ_id.property_stock_account_input_categ.id if oa: diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index bc387b25859..ec2aa1688d6 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -96,10 +96,10 @@ class hr_analytic_timesheet(osv.osv): res.setdefault('value',{}) res['value']= super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids, account_id)['value'] res['value']['product_id'] = r.product_id.id - res['value']['product_uom_id'] = r.product_id.product_tmpl_id.uom_id.id + res['value']['product_uom_id'] = r.product_id.uom_id.id #the change of product has to impact the amount, uom and general_account_id - a = r.product_id.product_tmpl_id.property_account_expense.id + a = r.product_id.property_account_expense.id if not a: a = r.product_id.categ_id.property_account_expense_categ.id if not a: @@ -128,7 +128,7 @@ class hr_analytic_timesheet(osv.osv): res['value']['product_id'] = r.product_id.id #the change of product has to impact the amount, uom and general_account_id - a = r.product_id.product_tmpl_id.property_account_expense.id + a = r.product_id.property_account_expense.id if not a: a = r.product_id.categ_id.property_account_expense_categ.id if not a: diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 6e5d3b658dd..d061278431f 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -171,7 +171,7 @@ class hr_expense_expense(osv.osv): journal = account_journal.browse(cr, uid, journal_id, context=context) for line in exp.line_ids: if line.product_id: - acc = line.product_id.product_tmpl_id.property_account_expense + acc = line.product_id.property_account_expense if not acc: acc = line.product_id.categ_id.property_account_expense_categ else: diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 212d47bb115..6a538e5d09c 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -125,7 +125,7 @@ class hr_analytic_timesheet(osv.osv): if emp_id: emp = emp_obj.browse(cr, uid, emp_id[0], context=context) if bool(emp.product_id): - a = emp.product_id.product_tmpl_id.property_account_expense.id + a = emp.product_id.property_account_expense.id if not a: a = emp.product_id.categ_id.property_account_expense_categ.id if a: diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 3d6733d0d73..b40934d16ee 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -255,7 +255,7 @@ class account_analytic_line(osv.osv): price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, ctx) - general_account = product.product_tmpl_id.property_account_income or product.categ_id.property_account_income_categ + general_account = product.property_account_income or product.categ_id.property_account_income_categ if not general_account: raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name) taxes = product.taxes_id or general_account.tax_ids diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 7c8216e233d..39047d4f8e2 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -948,7 +948,7 @@ class mrp_production(osv.osv): def _make_production_produce_line(self, cr, uid, production, context=None): stock_move = self.pool.get('stock.move') - source_location_id = production.product_id.product_tmpl_id.property_stock_production.id + source_location_id = production.product_id.property_stock_production.id destination_location_id = production.location_dest_id.id data = { 'name': production.name, @@ -974,7 +974,7 @@ class mrp_production(osv.osv): # Internal shipment is created for Stockable and Consumer Products if production_line.product_id.type not in ('product', 'consu'): return False - destination_location_id = production.product_id.product_tmpl_id.property_stock_production.id + destination_location_id = production.product_id.property_stock_production.id if not source_location_id: source_location_id = production.location_src_id.id move_id = stock_move.create(cr, uid, { diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 78fb8382cda..8162c3178dc 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -91,7 +91,7 @@ class procurement_order(osv.osv): procurement_obj = self.pool.get('procurement.order') for procurement in procurement_obj.browse(cr, uid, ids, context=context): res_id = procurement.move_id.id - newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0) + newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.produce_delay or 0.0) newdate = newdate - relativedelta(days=company.manufacturing_lead) produce_id = production_obj.create(cr, uid, { 'origin': procurement.origin, diff --git a/addons/mrp/test/order_process.yml b/addons/mrp/test/order_process.yml index a714035a9cd..e672517c5a0 100644 --- a/addons/mrp/test/order_process.yml +++ b/addons/mrp/test/order_process.yml @@ -31,7 +31,7 @@ assert order.state == 'confirmed', "Production order should be confirmed." assert order.move_created_ids, "Trace Record is not created for Final Product." move = order.move_created_ids[0] - source_location_id = order.product_id.product_tmpl_id.property_stock_production.id + source_location_id = order.product_id.property_stock_production.id assert move.date == order.date_planned, "Planned date is not correspond." assert move.product_id.id == order.product_id.id, "Product is not correspond." assert move.product_uom.id == order.product_uom.id, "UOM is not correspond." diff --git a/addons/mrp_byproduct/mrp_byproduct.py b/addons/mrp_byproduct/mrp_byproduct.py index 625f039eabe..22bbface59d 100644 --- a/addons/mrp_byproduct/mrp_byproduct.py +++ b/addons/mrp_byproduct/mrp_byproduct.py @@ -89,7 +89,7 @@ class mrp_production(osv.osv): picking_id = super(mrp_production,self).action_confirm(cr, uid, ids) product_uom_obj = self.pool.get('product.uom') for production in self.browse(cr, uid, ids): - source = production.product_id.product_tmpl_id.property_stock_production.id + source = production.product_id.property_stock_production.id if not production.bom_id: continue for sub_product in production.bom_id.sub_products: diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 9a988e54dd7..cc8884bd671 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -313,7 +313,7 @@ class procurement_order(osv.osv): if not procurement.move_id: source = procurement.location_id.id if procurement.procure_method == 'make_to_order': - source = procurement.product_id.product_tmpl_id.property_stock_procurement.id + source = procurement.product_id.property_stock_procurement.id id = move_obj.create(cr, uid, { 'name': procurement.name, 'location_id': source, diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 3ce94700614..c1f8f6409a9 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -92,7 +92,7 @@ class project_work(osv.osv): raise osv.except_osv(_('Bad Configuration !'), _('Please define journal on the related employee.\nFill in the timesheet tab of the employee form.')) - acc_id = emp.product_id.product_tmpl_id.property_account_expense.id + acc_id = emp.product_id.property_account_expense.id if not acc_id: acc_id = emp.product_id.categ_id.property_account_expense_categ.id if not acc_id: diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 2347de95879..95a952e243e 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -516,7 +516,7 @@ class purchase_order(osv.osv): inv_lines = [] for po_line in order.order_line: if po_line.product_id: - acc_id = po_line.product_id.product_tmpl_id.property_account_expense.id + acc_id = po_line.product_id.property_account_expense.id if not acc_id: acc_id = po_line.product_id.categ_id.property_account_expense_categ.id if not acc_id: @@ -567,7 +567,7 @@ class purchase_order(osv.osv): def has_stockable_product(self, cr, uid, ids, *args): for order in self.browse(cr, uid, ids): for order_line in order.order_line: - if order_line.product_id and order_line.product_id.product_tmpl_id.type in ('product', 'consu'): + if order_line.product_id and order_line.product_id.type in ('product', 'consu'): return True return False @@ -1046,7 +1046,7 @@ class procurement_order(osv.osv): ''' user = self.pool.get('res.users').browse(cr, uid, uid, context=context) for procurement in self.browse(cr, uid, ids, context=context): - if procurement.product_id.product_tmpl_id.supply_method <> 'buy': + if procurement.product_id.supply_method <> 'buy': return False return True @@ -1169,7 +1169,7 @@ class procurement_order(osv.osv): new_context.update({'lang': partner.lang, 'partner_id': partner_id}) product = prod_obj.browse(cr, uid, procurement.product_id.id, context=new_context) - taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id + taxes_ids = procurement.product_id.supplier_taxes_id taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids) name = product.partner_ref diff --git a/addons/purchase/wizard/purchase_line_invoice.py b/addons/purchase/wizard/purchase_line_invoice.py index 23529d5a950..12dbf4a09f6 100644 --- a/addons/purchase/wizard/purchase_line_invoice.py +++ b/addons/purchase/wizard/purchase_line_invoice.py @@ -98,7 +98,7 @@ class purchase_line_invoice(osv.osv_memory): if not line.partner_id.id in invoices: invoices[line.partner_id.id] = [] if line.product_id: - a = line.product_id.product_tmpl_id.property_account_expense.id + a = line.product_id.property_account_expense.id if not a: a = line.product_id.categ_id.property_account_expense_categ.id if not a: diff --git a/addons/sale/sale.py b/addons/sale/sale.py index dee770a6433..cf68ee01672 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -781,7 +781,7 @@ class sale_order_line(osv.osv): if not line.invoiced: if not account_id: if line.product_id: - account_id = line.product_id.product_tmpl_id.property_account_income.id + account_id = line.product_id.property_account_income.id if not account_id: account_id = line.product_id.categ_id.property_account_income_categ.id if not account_id: diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 99967a432e4..21bf13a1cdc 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -383,7 +383,7 @@ class sale_order(osv.osv): date_planned = self._get_date_planned(cr, uid, order, line, order.date_order, context=context) if line.product_id: - if line.product_id.product_tmpl_id.type in ('product', 'consu'): + if line.product_id.type in ('product', 'consu'): if not picking_id: picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context)) move_id = move_obj.create(cr, uid, self._prepare_order_line_move(cr, uid, order, line, picking_id, date_planned, context=context)) @@ -447,7 +447,7 @@ class sale_order(osv.osv): def has_stockable_products(self, cr, uid, ids, *args): for order in self.browse(cr, uid, ids): for order_line in order.order_line: - if order_line.product_id and order_line.product_id.product_tmpl_id.type in ('product', 'consu'): + if order_line.product_id and order_line.product_id.type in ('product', 'consu'): return True return False diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index af24bd20483..800c131e288 100644 --- a/addons/sale_stock/test/picking_order_policy.yml +++ b/addons/sale_stock/test/picking_order_policy.yml @@ -121,7 +121,7 @@ assert invoice.payment_term.id == order.payment_term.id, "Payment term is not correspond." for so_line in order.order_line: inv_line = so_line.invoice_lines[0] - ac = so_line.product_id.product_tmpl_id.property_account_income.id or so_line.product_id.categ_id.property_account_income_categ.id + ac = so_line.product_id.property_account_income.id or so_line.product_id.categ_id.property_account_income_categ.id assert inv_line.product_id.id == so_line.product_id.id or False,"Product is not correspond" assert inv_line.account_id.id == ac,"Account of Invoice line is not corresponding." assert inv_line.uos_id.id == (so_line.product_uos and so_line.product_uos.id) or so_line.product_uom.id, "Product UOS is not correspond." diff --git a/addons/stock/product.py b/addons/stock/product.py index 527f8b6363d..ba556884bba 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -132,7 +132,7 @@ class product_product(osv.osv): if diff > 0: if not stock_input_acc: - stock_input_acc = product.product_tmpl_id.\ + stock_input_acc = product.\ property_stock_account_input.id if not stock_input_acc: stock_input_acc = product.categ_id.\ @@ -158,7 +158,7 @@ class product_product(osv.osv): }) elif diff < 0: if not stock_output_acc: - stock_output_acc = product.product_tmpl_id.\ + stock_output_acc = product.\ property_stock_account_output.id if not stock_output_acc: stock_output_acc = product.categ_id.\ diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 71c83344913..54e74da4575 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1067,14 +1067,12 @@ class stock_picking(osv.osv): origin += ':' + move_line.picking_id.origin if invoice_vals['type'] in ('out_invoice', 'out_refund'): - account_id = move_line.product_id.product_tmpl_id.\ - property_account_income.id + account_id = move_line.product_id.property_account_income.id if not account_id: account_id = move_line.product_id.categ_id.\ property_account_income_categ.id else: - account_id = move_line.product_id.product_tmpl_id.\ - property_account_expense.id + account_id = move_line.product_id.property_account_expense.id if not account_id: account_id = move_line.product_id.categ_id.\ property_account_expense_categ.id @@ -2896,7 +2894,7 @@ class stock_inventory(osv.osv): change = line.product_qty - amount lot_id = line.prod_lot_id.id if change: - location_id = line.product_id.product_tmpl_id.property_stock_inventory.id + location_id = line.product_id.property_stock_inventory.id value = { 'name': _('INV:') + (line.inventory_id.name or ''), 'product_id': line.product_id.id, diff --git a/addons/stock/test/opening_stock.yml b/addons/stock/test/opening_stock.yml index 0cb6c0b78ad..2e3eaeadc74 100644 --- a/addons/stock/test/opening_stock.yml +++ b/addons/stock/test/opening_stock.yml @@ -66,7 +66,7 @@ for move_line in inventory.move_ids: for line in inventory.inventory_line_id: if move_line.product_id.id == line.product_id.id and move_line.prodlot_id.id == line.prod_lot_id.id: - location_id = line.product_id.product_tmpl_id.property_stock_inventory.id + location_id = line.product_id.property_stock_inventory.id assert move_line.product_qty == line.product_qty, "Qty is not correspond." assert move_line.product_uom.id == line.product_uom.id, "UOM is not correspond." assert move_line.date == inventory.date, "Date is not correspond."