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:
'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:
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)
# invoice_line_obj = self.pool.get('account.invoice.line')
# for line in invoice_line_obj.browse(cr, uid, line_ids):
# if line.product_id:
-# a = line.product_id.product_tmpl_id.property_stock_account_output and line.product_id.product_tmpl_id.property_stock_account_output.id
+# a = line.product_id.property_stock_account_output and line.product_id.property_stock_account_output.id
# if not a:
# a = line.product_id.categ_id.property_stock_account_output_categ and line.product_id.categ_id.property_stock_account_output_categ.id
# if a:
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:
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:
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:
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:
for l in exp.line_ids:
tax_id = []
if l.product_id:
- acc = l.product_id.product_tmpl_id.property_account_expense
+ acc = l.product_id.property_account_expense
if not acc:
acc = l.product_id.categ_id.property_account_expense_categ
tax_id = [x.id for x in l.product_id.supplier_taxes_id]
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:
taxes = product.taxes_id
tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes)
- account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
+ account_id = product.property_account_income.id or product.categ_id.property_account_income_categ.id
if not account_id:
raise osv.except_osv(_("Configuration Error"), _("No income account defined for product '%s'") % product.name)
curr_line = {
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
move_name = _('PROD: %s') + production.name
data = {
if production_line.product_id.type not in ('product', 'consu'):
return False
move_name = _('PROD: %s') % production.name
- 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, {
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,
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."
"""
picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)
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:
user = self.pool.get('res.users').browse(cr, uid, uid)
partner_obj = self.pool.get('res.partner')
for procurement in self.browse(cr, uid, ids):
- if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
+ if procurement.product_id.supply_method <> 'buy':
return False
if not procurement.product_id.seller_ids:
message = _('No supplier defined for this product !')
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,
raise osv.except_osv(_('Bad Configuration !'),
_('No journal defined on the related employee.\nFill in the timesheet tab of the employee form.'))
- 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 not a:
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:
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
context.update({'lang': partner.lang, 'partner_id': partner_id})
product = prod_obj.browse(cr, uid, procurement.product_id.id, context=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
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:
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))
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
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:
else:
name = sale_line.name
if type in ('out_invoice', 'out_refund'):
- account_id = sale_line.product_id.product_tmpl_id.\
+ account_id = sale_line.product_id.\
property_account_income.id
if not account_id:
account_id = sale_line.product_id.categ_id.\
property_account_income_categ.id
else:
- account_id = sale_line.product_id.product_tmpl_id.\
+ account_id = sale_line.product_id.\
property_account_expense.id
if not account_id:
account_id = sale_line.product_id.categ_id.\
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."
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.\
})
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.\
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
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:' + str(line.inventory_id.id) + ':' + line.inventory_id.name,
'product_id': line.product_id.id,
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."
coeff_def2uom = 1
if (product_uom != product.uom_id.id):
coeff_def2uom, round_value = self._from_default_uom_factor(cr, uid, product_id, product_uom, {})
- qty = rounding(coeff_def2uom * product_amt/(product.product_tmpl_id.list_price), round_value)
+ qty = rounding(coeff_def2uom * product_amt/(product.list_price), round_value)
res = {'value': {'product_qty': qty}}
return res