diff --git a/addons/account/account.py b/addons/account/account.py
index 354b315dbf5..5ae52dc23fd 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -276,7 +276,7 @@ class account_account(osv.osv):
if name and str(name).startswith('partner:'):
part_id = int(name.split(':')[1])
part = self.pool.get('res.partner').browse(cr, user, part_id, context)
- args += [('id','in', (part.property_account_payable[0],part.property_account_receivable[0]))]
+ args += [('id','in', (part.property_account_payable.id, part.property_account_receivable.id))]
name = False
if name and str(name).startswith('type:'):
type = name.split(':')[1]
diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py
index 1295357558a..3a5188e70e5 100644
--- a/addons/account/account_analytic_line.py
+++ b/addons/account/account_analytic_line.py
@@ -74,12 +74,12 @@ class account_analytic_line(osv.osv):
rate = hunit.factor
product_obj = self.pool.get('product.product')
prod = product_obj.browse(cr, uid, prod_id)
- a = prod.product_tmpl_id.property_account_expense
+ a = prod.product_tmpl_id.property_account_expense.id
if not a:
- a = prod.categ_id.property_account_expense_categ
+ a = prod.categ_id.property_account_expense_categ.id
if not a:
raise osv.except_osv('Error !', 'There is no expense account define for this product: "%s" (id:%d)' % (prod.name, prod.id,))
- return {'value' : {'amount' : -round(unit_amount * prod.standard_price * rate,2), 'general_account_id':a[0]}}
+ return {'value' : {'amount' : -round(unit_amount * prod.standard_price * rate,2), 'general_account_id':a}}
return {}
account_analytic_line()
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 930396f5925..a685908c80c 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -269,9 +269,9 @@ class account_bank_statement_line(osv.osv):
return {}
part = self.pool.get('res.partner').browse(cr, uid, partner_id, context)
if type=='supplier':
- account_id = part.property_account_payable[0]
+ account_id = part.property_account_payable.id
else:
- account_id = part.property_account_receivable[0]
+ account_id = part.property_account_receivable.id
cr.execute('select sum(debit-credit) from account_move_line where (reconcile_id is null) and partner_id=%d and account_id=%d', (partner_id, account_id))
balance = cr.fetchone()[0] or 0.0
val = {'amount': balance, 'account_id':account_id}
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index bb3b3457637..7a4d4cc529c 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -241,8 +241,8 @@ class account_move_line(osv.osv):
if (not partner_id) or account_id:
return {}
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
- id1 = part.property_account_payable[0]
- id2 = part.property_account_receivable[0]
+ id1 = part.property_account_payable.id
+ id2 = part.property_account_receivable.id
cr.execute('select sum(debit-credit) from account_move_line where (reconcile_id is null) and partner_id=%d and account_id=%d', (partner_id, id2))
balance = cr.fetchone()[0] or 0.0
val = {}
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index b972284ce7c..f1b5cddeefd 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -186,10 +186,10 @@ class account_invoice(osv.osv):
invoice_addr_id = res['invoice']
p = self.pool.get('res.partner').browse(cr, uid, partner_id)
if type in ('out_invoice', 'out_refund'):
- acc_id = p.property_account_receivable
+ acc_id = p.property_account_receivable.id
else:
- acc_id = p.property_account_payable
-
+ acc_id = p.property_account_payable.id
+
partner_bank_id = p.bank_ids and p.bank_ids[0] and p.bank_ids[0].id or False
payment_term = p.property_payment_term and p.property_payment_term or False
@@ -197,8 +197,8 @@ class account_invoice(osv.osv):
'account_id': acc_id,'partner_bank_id':partner_bank_id,
'payment_term':payment_term}}
- if partner_id and p.property_payment_term:
- result['value']['payment_term'] = p.property_payment_term
+ if partner_id and p.property_payment_term.id:
+ result['value']['payment_term'] = p.property_payment_term.id
return result
def onchange_currency_id(self, cr, uid, ids, curr_id):
@@ -692,22 +692,20 @@ class account_invoice_line(osv.osv):
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
tax_obj = self.pool.get('account.tax')
if type in ('out_invoice', 'out_refund'):
- if not taxep or not taxep[0]:
+ if not taxep or not taxep.id:
tax_id = map(lambda x: x.id, res.taxes_id)
else:
- tax_id = [taxep[0]]
- tp = tax_obj.browse(cr, uid, taxep[0])
+ tax_id = [taxep.id]
for t in res.taxes_id:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
tax_id.append(t.id)
else:
- if not taxep or not taxep[0]:
+ if not taxep or not taxep.id:
tax_id = map(lambda x: x.id, res.supplier_taxes_id)
else:
- tax_id = [taxep[0]]
- tp = tax_obj.browse(cr, uid, taxep[0])
+ tax_id = [taxep.id]
for t in res.supplier_taxes_id:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
tax_id.append(t.id)
if type in ('in_invoice', 'in_refund'):
result = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context)
@@ -718,15 +716,15 @@ class account_invoice_line(osv.osv):
result['name'] = res.name
if type in ('out_invoice','out_refund'):
- a = res.product_tmpl_id.property_account_income
+ a = res.product_tmpl_id.property_account_income.id
if not a:
- a = res.categ_id.property_account_income_categ
+ a = res.categ_id.property_account_income_categ.id
else:
- a = res.product_tmpl_id.property_account_expense
+ a = res.product_tmpl_id.property_account_expense.id
if not a:
- a = res.categ_id.property_account_expense_categ
+ a = res.categ_id.property_account_expense_categ.id
if a:
- result['account_id'] = a[0]
+ result['account_id'] = a
domain = {}
result['uos_id'] = uom or res.uom_id.id or False
@@ -776,12 +774,11 @@ class account_invoice_line(osv.osv):
return {}
taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
- if not taxep:
+ if not taxep.id:
return {'value': {'invoice_line_tax_id': map(lambda x: x.id, taxes or []) }}
- res = [taxep[0]]
- tp = self.pool.get('account.tax').browse(cr, uid, taxep[0])
+ res = [taxep.id]
for t in taxes:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
res.append(t.id)
r = {'value':{'invoice_line_tax_id': res}}
return r
diff --git a/addons/delivery/sale.py b/addons/delivery/sale.py
index 5ff364477f6..bb80f8c74cd 100644
--- a/addons/delivery/sale.py
+++ b/addons/delivery/sale.py
@@ -15,8 +15,8 @@ class sale_order(osv.osv):
def onchange_partner_id(self, cr, uid, ids, part):
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)
if part:
- dtype = self.pool.get('res.partner').browse(cr, uid, part).property_delivery_carrier
- result['value']['carrier_id'] = dtype and dtype[0]
+ dtype = self.pool.get('res.partner').browse(cr, uid, part).property_delivery_carrier.id
+ result['value']['carrier_id'] = dtype
return result
def action_ship_create(self, cr, uid, ids, *args):
diff --git a/addons/delivery/wizard/delivery_invoice_onshipping.py b/addons/delivery/wizard/delivery_invoice_onshipping.py
index 4519f58a78c..5ad964e84d8 100644
--- a/addons/delivery/wizard/delivery_invoice_onshipping.py
+++ b/addons/delivery/wizard/delivery_invoice_onshipping.py
@@ -100,10 +100,9 @@ def _create_invoice(self, cr, uid, data, context):
price = pool.get('delivery.grid').get_price_from_picking(cr, uid, grid_id,
invoice.amount_untaxed, picking.weight,
picking.volume, context) or 0.0
- a = picking.carrier_id.product_id.product_tmpl_id.property_account_income
- if not a:
- a = picking.carrier_id.product_id.categ_id.property_account_income_categ
- account_id = a[0]
+ account_id = picking.carrier_id.product_id.product_tmpl_id.property_account_income.id
+ if not account_id:
+ account_id = picking.carrier_id.product_id.categ_id.property_account_income_categ.id
pool.get('account.invoice.line').create(cr, uid, {
'name':picking.carrier_id.name,
'invoice_id': inv_id,
diff --git a/addons/delivery/wizard/delivery_sale_order.py b/addons/delivery/wizard/delivery_sale_order.py
index dd2ef2cd0ed..7bca6ad475e 100644
--- a/addons/delivery/wizard/delivery_sale_order.py
+++ b/addons/delivery/wizard/delivery_sale_order.py
@@ -48,7 +48,7 @@ def _delivery_default(self, cr, uid, data, context):
if not order.state in ('draft'):
raise wizard.except_wizard('Order not in draft state !', 'The order state have to be draft to add delivery lines.')
- carrier_id = order.partner_id.property_delivery_carrier
+ carrier_id = order.partner_id.property_delivery_carrier.id
return {'carrier_id': carrier_id}
def _delivery_set(self, cr, uid, data, context):
diff --git a/addons/esale_ez/esale.py b/addons/esale_ez/esale.py
index fffadb63186..dfa931aa61f 100644
--- a/addons/esale_ez/esale.py
+++ b/addons/esale_ez/esale.py
@@ -60,7 +60,7 @@ class esale_web(osv.osv):
# Compute the price for one product
#
def price_get(self, cr, uid, product_id, product_qty, partner_id):
- pricelist = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist[0]
+ pricelist = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.id
price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], product_id, product_qty)[pricelist]
return price
@@ -92,7 +92,7 @@ class esale_web(osv.osv):
# ]})
#
def compute(self, cr, uid, ids, order, context={}):
- pricelist = self.pool.get('res.partner').browse(cr, uid, order['partner_id']).property_product_pricelist[0]
+ pricelist = self.pool.get('res.partner').browse(cr, uid, order['partner_id']).property_product_pricelist.id
subtotal = 0
taxes = 0
for product in order['products']:
@@ -168,7 +168,7 @@ class esale_order(osv.osv):
def order_create(self, cr, uid, ids, context={}):
for order in self.browse(cr, uid, ids, context):
addr = self.pool.get('res.partner').address_get(cr, uid, [order.partner_id.id], ['delivery','invoice','contact'])
- pricelist_id=order.partner_id.property_product_pricelist[0]
+ pricelist_id=order.partner_id.property_product_pricelist.id
order_lines = []
for line in order.order_lines:
order_lines.append( (0,0,{
diff --git a/addons/esale_joomla/esale_joomla.py b/addons/esale_joomla/esale_joomla.py
index cded44967b0..75d4d6f4a52 100644
--- a/addons/esale_joomla/esale_joomla.py
+++ b/addons/esale_joomla/esale_joomla.py
@@ -222,7 +222,7 @@ class esale_joomla_order(osv.osv):
for order in self.browse(cr, uid, ids, context):
if not (order.partner_id and order.partner_invoice_id and order.partner_shipping_id):
raise osv.except_osv('No addresses !', 'You must assign addresses before creating the order.')
- pricelist_id=order.partner_id.property_product_pricelist[0]
+ pricelist_id=order.partner_id.property_product_pricelist.id
order_lines = []
for line in order.order_lines:
val = {
diff --git a/addons/esale_osc/esale_osc.py b/addons/esale_osc/esale_osc.py
index 07db79a4a4d..4dfe0fc00f8 100644
--- a/addons/esale_osc/esale_osc.py
+++ b/addons/esale_osc/esale_osc.py
@@ -184,7 +184,7 @@ class esale_osc_saleorder(osv.osv):
def order_create(self, cr, uid, ids, context={}):
for order in self.browse(cr, uid, ids, context):
addr = self.pool.get('res.partner').address_get(cr, uid, [order.partner_id.id], ['delivery','invoice','contact'])
- pricelist_id=order.partner_id.property_product_pricelist[0]
+ pricelist_id=order.partner_id.property_product_pricelist.id
order_lines = []
for line in order.order_lines:
order_lines.append( (0,0,{
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index 832092385ec..b2e9bb0416a 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -124,11 +124,9 @@ class hr_expense_expense(osv.osv):
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.product_tmpl_id.property_account_expense.id
if not acc:
- acc = l.product_id.categ_id.property_account_expense_categ[0]
- else:
- acc = acc[0]
+ acc = l.product_id.categ_id.property_account_expense_categ.id
tax_id = [x.id for x in l.product_id.supplier_taxes_id]
else:
acc = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
@@ -144,7 +142,7 @@ class hr_expense_expense(osv.osv):
}))
if not exp.employee_id.address_id:
raise osv.except_osv('Error !', 'The employee must have a contact address')
- acc = exp.employee_id.address_id.partner_id.property_account_payable[0]
+ acc = exp.employee_id.address_id.partner_id.property_account_payable.id
inv = {
'name': exp.name,
'reference': self.pool.get('ir.sequence').get(cr, uid, 'hr.expense.invoice'),
diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py
index a780f47e621..76a97784b4e 100644
--- a/addons/hr_timesheet/hr_timesheet.py
+++ b/addons/hr_timesheet/hr_timesheet.py
@@ -90,11 +90,11 @@ class hr_analytic_timesheet(osv.osv):
if emp_id:
emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0], context=context)
if bool(emp.product_id):
- a = emp.product_id.product_tmpl_id.property_account_income
+ a = emp.product_id.product_tmpl_id.property_account_income.id
if not a:
- a = emp.product_id.categ_id.property_account_income_categ
+ a = emp.product_id.categ_id.property_account_income_categ.id
if a:
- return a[0]
+ return a
return False
def _getAnalyticJournal(self, cr, uid, context):
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py
index 1d8f6a8cd0d..b36a9b23058 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py
@@ -60,8 +60,8 @@ class final_invoice_create(wizard.interface):
'partner_id': account.partner_id.id,
'address_contact_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['contact'])['contact'],
'address_invoice_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['invoice'])['invoice'],
- 'payment_term': (partner.property_payment_term and partner.property_payment_term[0]) or False,
- 'account_id': partner.property_account_receivable[0],
+ 'payment_term': partner.property_payment_term.id or False,
+ 'account_id': partner.property_account_receivable.id,
'currency_id': account.pricelist_id.currency_id.id,
'project_id': account.id
}
@@ -87,16 +87,15 @@ class final_invoice_create(wizard.interface):
taxes = product.taxes_id
taxep = account.partner_id.property_account_tax
- if not taxep:
+ if not taxep.id:
tax = [x.id for x in taxes or []]
else:
- tax = [taxep[0]]
- tp = pool.get('account.tax').browse(cr, uid, taxep[0])
+ tax = [taxep.id]
for t in taxes:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
tax.append(t.id)
- account_id = product.product_tmpl_id.property_account_income or product.categ_id.property_account_income_categ
+ account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
curr_line = {
'price_unit': price,
@@ -107,7 +106,7 @@ class final_invoice_create(wizard.interface):
'name': factor_name,
'product_id': product_id,
'uos_id': product.uom_id.id,
- 'account_id': account_id[0],
+ 'account_id': account_id,
'account_analytic_id': account.id,
}
@@ -145,13 +144,12 @@ class final_invoice_create(wizard.interface):
else:
taxes = []
taxep = account.partner_id.property_account_tax
- if not taxep:
+ if not taxep.id:
tax = [x.id for x in taxes or []]
else:
- tax = [taxep[0]]
- tp = pool.get('account.tax').browse(cr, uid, taxep[0])
+ tax = [taxep.id]
for t in taxes:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
tax.append(t.id)
curr_line = {
@@ -175,16 +173,15 @@ class final_invoice_create(wizard.interface):
taxes = product.taxes_id
taxep = account.partner_id.property_account_tax
- if not taxep:
+ if not taxep.id:
tax = [x.id for x in taxes or []]
else:
- tax = [taxep[0]]
- tp = pool.get('account.tax').browse(cr, uid, taxep[0])
+ tax = [taxep.id]
for t in taxes:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
tax.append(t.id)
- account_id = product.product_tmpl_id.property_account_income or product.categ_id.property_account_income_categ
+ account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
curr_line = {
'price_unit': account.amount_max - amount_total,
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index 053b26cef1d..861985db3fa 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -60,8 +60,8 @@ class invoice_create(wizard.interface):
'partner_id': account.partner_id.id,
'address_contact_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['contact'])['contact'],
'address_invoice_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['invoice'])['invoice'],
- 'payment_term': (partner.property_payment_term and partner.property_payment_term[0]) or False,
- 'account_id': partner.property_account_receivable[0],
+ 'payment_term': partner.property_payment_term.id or False,
+ 'account_id': partner.property_account_receivable.id,
'currency_id': account.pricelist_id.currency_id.id,
}
last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice)
@@ -88,16 +88,15 @@ class invoice_create(wizard.interface):
taxes = product.taxes_id
taxep = account.partner_id.property_account_tax
- if not taxep:
+ if not taxep.id:
tax = [x.id for x in taxes or []]
else:
- tax = [taxep[0]]
- tp = pool.get('account.tax').browse(cr, uid, taxep[0])
+ tax = [taxep.id]
for t in taxes:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
tax.append(t.id)
- account_id = product.product_tmpl_id.property_account_income or product.categ_id.property_account_income_categ
+ account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
curr_line = {
'price_unit': price,
@@ -109,7 +108,7 @@ class invoice_create(wizard.interface):
'product_id': data['form']['product'] or product_id,
'invoice_line_tax_id': [(6,0,tax)],
'uos_id': product.uom_id.id,
- 'account_id': account_id[0],
+ 'account_id': account_id,
'account_analytic_id': account.id,
}
diff --git a/addons/l10n_ch/v11/v11_import.py b/addons/l10n_ch/v11/v11_import.py
index e8c5c1987af..7264ab96b3a 100644
--- a/addons/l10n_ch/v11/v11_import.py
+++ b/addons/l10n_ch/v11/v11_import.py
@@ -176,7 +176,7 @@ def _v11_parsing(self, cr, uid, data, context):
i = invoice_obj.browse(cr, uid, invoice_id)
try:
- acc1 = i.partner_id.property_account_receivable[0]
+ acc1 = i.partner_id.property_account_receivable.id
except:
err_log = err_log + '\n * invoice with number '+ rec['invoice_ref'].lstrip('0') +\
' has no partner !'+ '\n line : '+rec['line_number']
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 5edbae94425..d28f577444d 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -417,7 +417,7 @@ class mrp_production(osv.osv):
self.pool.get('stock.move').write(cr, uid, new_moves, vals)
else:
# Why is it there ? Aren't we suppose to already have a created_move ?
- source = production.product_id.product_tmpl_id.property_stock_production[0]
+ source = production.product_id.product_tmpl_id.property_stock_production.id
vals = {
'name':'PROD:'+production.name,
'date_planned': production.date_planned,
@@ -505,7 +505,7 @@ class mrp_production(osv.osv):
if production.move_prod_id:
self.pool.get('stock.move').write(cr, uid, [production.move_prod_id.id], {'location_id':production.location_dest_id.id})
- source = production.product_id.product_tmpl_id.property_stock_production[0]
+ source = production.product_id.product_tmpl_id.property_stock_production.id
data = {
'name':'PROD:'+production.name,
'date_planned': production.date_planned,
@@ -753,7 +753,7 @@ class mrp_procurement(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[0]
+ source = procurement.product_id.product_tmpl_id.property_stock_procurement.id
id = self.pool.get('stock.move').create(cr, uid, {
'name': 'PROC:'+procurement.name,
'location_id': source,
@@ -825,7 +825,7 @@ class mrp_procurement(osv.osv):
partner = procurement.product_id.seller_ids[0].name
partner_id = partner.id
address_id = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['delivery'])['delivery']
- pricelist_id = partner.property_product_pricelist_purchase[0]
+ pricelist_id = partner.property_product_pricelist_purchase.id
uom_id = procurement.product_id.uom_po_id.id
diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py
index 0d34543aed9..6c7f39edbc2 100644
--- a/addons/mrp/report/price.py
+++ b/addons/mrp/report/price.py
@@ -53,7 +53,7 @@ class report_custom(report_rml):
main_strd_price = ''
if prod.seller_ids and prod.seller_ids[0] :
main_sp_name = '' + prod.seller_ids[0].name.name + '\r\n'
- pricelist = prod.seller_ids[0].name.property_product_pricelist_purchase
+ pricelist = prod.seller_ids[0].name.property_product_pricelist_purchase.id
if pricelist:
pricelist_id = pricelist[0]
pricelist_obj = pooler.get_pool(cr.dbname).get('product.pricelist')
@@ -71,7 +71,7 @@ class report_custom(report_rml):
sellers_price = ''
for seller_id in prod.seller_ids:
sellers += '- '+ seller_id.name.name +'\r\n'
- pricelist = seller_id.name.property_product_pricelist_purchase
+ pricelist = seller_id.name.property_product_pricelist_purchase.id
if pricelist:
pricelist_id = pricelist[0]
pricelist_obj = pooler.get_pool(cr.dbname).get('product.pricelist')
diff --git a/addons/project/project.py b/addons/project/project.py
index cd1d43b1d79..2d0ccfc76c5 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -85,9 +85,8 @@ class project(osv.osv):
if not part:
return {'value':{'contact_id': False, 'pricelist_id': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact'])
- print part, self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist
- pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist[0]
+ pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist}}
_columns = {
diff --git a/addons/project/wizard/billing.py b/addons/project/wizard/billing.py
index d8feff2923f..916753f0a71 100644
--- a/addons/project/wizard/billing.py
+++ b/addons/project/wizard/billing.py
@@ -92,9 +92,9 @@ def _do_orders(self, cr, uid, data, context):
raise wizard.except_wizard('Error !', 'No pricelist defined in the project definition.')
adr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [partner.id], ['default','invoice','shipping'])
- a = partner.property_account_receivable[0]
+ a = partner.property_account_receivable.id
if partner.property_payment_term:
- pay_term = partner.property_payment_term[0]
+ pay_term = partner.property_payment_term.id
else:
pay_term = False
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 53437fc9157..93b4fa08862 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -120,7 +120,7 @@ class purchase_order(osv.osv):
'invoice_method': lambda *a: 'order',
'invoiced': lambda *a: 0,
'partner_address_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['default'])['default'],
- 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase[0],
+ 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id,
}
_name = "purchase.order"
_description = "Purchase order"
@@ -133,7 +133,7 @@ class purchase_order(osv.osv):
if not adr_id:
return {}
part_id = self.pool.get('res.partner.address').read(cr, uid, [adr_id], ['partner_id'])[0]['partner_id'][0]
- loc_id = self.pool.get('res.partner').browse(cr, uid, part_id).property_stock_customer[0]
+ loc_id = self.pool.get('res.partner').browse(cr, uid, part_id).property_stock_customer.id
return {'value':{'location_id': loc_id, 'warehouse_id': False}}
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id):
@@ -146,7 +146,7 @@ class purchase_order(osv.osv):
if not part:
return {'value':{'partner_address_id': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
- pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist_purchase[0]
+ pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist_purchase.id
return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist}}
def wkf_approve_order(self, cr, uid, ids):
@@ -188,12 +188,11 @@ class purchase_order(osv.osv):
for ol in o.order_line:
if ol.product_id:
- a = ol.product_id.product_tmpl_id.property_account_expense
+ a = ol.product_id.product_tmpl_id.property_account_expense.id
if not a:
- a = ol.product_id.categ_id.property_account_expense_categ
+ a = ol.product_id.categ_id.property_account_expense_categ.id
if not a:
raise osv.except_osv('Error !', 'There is no income account defined for this product: "%s" (id:%d)' % (line.product_id.name, line.product_id.id,))
- a = a[0]
else:
a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
il.append((0, False, {
@@ -207,7 +206,7 @@ class purchase_order(osv.osv):
'account_analytic_id': ol.account_analytic_id.id,
}))
- a = o.partner_id.property_account_payable[0]
+ a = o.partner_id.property_account_payable.id
inv = {
'name': o.name,
'reference': "P%dPO%d" % (o.partner_id.id, o.id),
@@ -237,7 +236,7 @@ class purchase_order(osv.osv):
def action_picking_create(self,cr, uid, ids, *args):
picking_id = False
for order in self.browse(cr, uid, ids):
- loc_id = order.partner_id.property_stock_supplier[0]
+ loc_id = order.partner_id.property_stock_supplier.id
istate = 'none'
if order.invoice_method=='picking':
istate = '2binvoiced'
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index ddbea9765dd..c016bdf0654 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -166,7 +166,7 @@ class sale_order(osv.osv):
'partner_invoice_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['invoice'])['invoice'],
'partner_order_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['contact'])['contact'],
'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'],
- 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist[0],
+ 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist.id,
}
_order = 'name desc'
@@ -198,7 +198,7 @@ class sale_order(osv.osv):
if not part:
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact'])
- pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist[0]
+ pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist}}
def button_dummy(self, cr, uid, ids, context={}):
@@ -217,9 +217,9 @@ class sale_order(osv.osv):
invoice_ids = []
def make_invoice(order, lines):
- a = order.partner_id.property_account_receivable[0]
- if order.partner_id and order.partner_id.property_payment_term:
- pay_term = order.partner_id.property_payment_term[0]
+ a = order.partner_id.property_account_receivable.id
+ if order.partner_id and order.partner_id.property_payment_term.id:
+ pay_term = order.partner_id.property_payment_term.id
else:
pay_term = False
for preinv in order.invoice_ids:
@@ -385,7 +385,7 @@ class sale_order(osv.osv):
if line.product_id and line.product_id.product_tmpl_id.type in ('product', 'consu'):
location_id = order.shop_id.warehouse_id.lot_stock_id.id
if not picking_id:
- loc_dest_id = order.partner_id.property_stock_customer[0]
+ loc_dest_id = order.partner_id.property_stock_customer.id
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'origin': order.name,
'type': 'out',
@@ -579,12 +579,11 @@ class sale_order_line(osv.osv):
for line in self.browse(cr, uid, ids, context):
if not line.invoiced:
if line.product_id:
- a = line.product_id.product_tmpl_id.property_account_income
+ a = line.product_id.product_tmpl_id.property_account_income.id
if not a:
- a = line.product_id.categ_id.property_account_income_categ
+ a = line.product_id.categ_id.property_account_income_categ.id
if not a:
raise osv.except_osv('Error !', 'There is no income account defined for this product: "%s" (id:%d)' % (line.product_id.name, line.product_id.id,))
- a = a[0]
else:
a = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
uosqty = _get_line_qty(line)
@@ -663,13 +662,12 @@ class sale_order_line(osv.osv):
taxep = None
if partner_id:
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
- if not taxep:
+ if not taxep.id:
result['tax_id'] = res['taxes_id']
else:
- res5 = [taxep[0]]
- tp = self.pool.get('account.tax').browse(cr, uid, taxep[0])
+ res5 = [taxep.id]
for t in taxes:
- if not t.tax_group==tp.tax_group:
+ if not t.tax_group==taxep.tax_group:
res5.append(t.id)
result['tax_id'] = res5
diff --git a/addons/sale/wizard/wizard_sale_line_invoice.py b/addons/sale/wizard/wizard_sale_line_invoice.py
index eb01efd89b5..a6ac4c34b05 100644
--- a/addons/sale/wizard/wizard_sale_line_invoice.py
+++ b/addons/sale/wizard/wizard_sale_line_invoice.py
@@ -50,7 +50,7 @@ def _makeInvoices(self, cr, uid, data, context):
#TODO: merge with sale.py/make_invoice
def make_invoice(order, lines):
- a = order.partner_id.property_account_receivable[0]
+ a = order.partner_id.property_account_receivable.id
inv = {
'name': order.name,
'origin': 'SO:'+str(order.id)+':'+order.name,
diff --git a/addons/sale_crm/wizard/makesale.py b/addons/sale_crm/wizard/makesale.py
index 3696c076fc2..fbc54a9b205 100644
--- a/addons/sale_crm/wizard/makesale.py
+++ b/addons/sale_crm/wizard/makesale.py
@@ -68,7 +68,7 @@ class make_sale(wizard.interface):
sale = pooler.get_pool(cr.dbname).get('sale.order')
partner_obj = pooler.get_pool(cr.dbname).get('res.partner')
partner_addr = partner_obj.address_get(cr, uid, [data['form']['partner_id']], ['invoice', 'delivery', 'contact'])
- pricelist = partner_obj.browse(cr, uid, data['form']['partner_id'], context).property_product_pricelist[0]
+ pricelist = partner_obj.browse(cr, uid, data['form']['partner_id'], context).property_product_pricelist.id
vals = {
'origin': 'BO:%s' % str(data['ids'][0]),
'picking_policy': data['form']['picking_policy'],
diff --git a/addons/sale_journal/sale_journal_inherit.py b/addons/sale_journal/sale_journal_inherit.py
index 38f79a44f7b..53478907d7b 100644
--- a/addons/sale_journal/sale_journal_inherit.py
+++ b/addons/sale_journal/sale_journal_inherit.py
@@ -72,7 +72,7 @@ class sale(osv.osv):
def onchange_partner_id(self, cr, uid, ids, part):
result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
if part:
- itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type
- result['value']['invoice_type_id'] = itype and itype[0]
+ itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type.id
+ result['value']['invoice_type_id'] = itype
return result
sale()
diff --git a/addons/sale_rebate/sale.py b/addons/sale_rebate/sale.py
index 290481be30d..13e92c763d6 100644
--- a/addons/sale_rebate/sale.py
+++ b/addons/sale_rebate/sale.py
@@ -94,7 +94,7 @@ class sale_order_rebate(osv.osv):
return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'partner_order_id': False}}
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
addr = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['delivery', 'invoice', 'contact'])
- pricelist = partner.property_product_pricelist[0]
+ pricelist = partner.property_product_pricelist.id
return {
'value': {
'rebate_percent': partner.rebate or 0.0,
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 0d7981793dd..809ce643d80 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -486,9 +486,9 @@ class stock_picking(osv.osv):
for p in self.browse(cr,uid,ids, context):
if p.invoice_state<>'2binvoiced':
continue
- a = p.address_id.partner_id.property_account_receivable[0]
- if p.address_id.partner_id and p.address_id.partner_id.property_payment_term:
- pay_term = p.address_id.partner_id.property_payment_term[0]
+ a = p.address_id.partner_id.property_account_receivable.id
+ if p.address_id.partner_id and p.address_id.partner_id.property_payment_term.id:
+ pay_term = p.address_id.partner_id.property_payment_term.id
else:
pay_term = False
@@ -534,10 +534,9 @@ class stock_picking(osv.osv):
tax_ids = map(lambda x: x.id, line.sale_line_id.tax_id)
else:
tax_ids = map(lambda x: x.id, line.product_id.taxes_id)
- a = line.product_id.product_tmpl_id.property_account_income
- if not a:
- a = line.product_id.categ_id.property_account_income_categ
- account_id = a[0]
+ account_id = line.product_id.product_tmpl_id.property_account_income.id
+ if not account_id:
+ account_id = line.product_id.categ_id.property_account_income_categ.id
punit = line.sale_line_id and line.sale_line_id.price_unit or line.product_id.list_price
if type in ('in_invoice','in_refund'):
punit = line.product_id.standard_price
@@ -806,22 +805,20 @@ class stock_move(osv.osv):
if move.product_id.categ_id:
test.append( ('product.category', move.product_id.categ_id.id) )
if not acc_src:
- a = move.product_id.product_tmpl_id.property_account_expense
- if not a:
- a = move.product_id.categ_id.property_account_expense_categ
- if not a:
+ acc_src = move.product_id.product_tmpl_id.property_account_expense.id
+ if not acc_src:
+ a = move.product_id.categ_id.property_account_expense_categ.id
+ if not acc_src:
raise osv.except_osv('Error !', 'There is no expense account defined for this product: "%s" (id:%d)' % (move.product_id.name, move.product_id.id,))
- acc_src = a[0]
if not acc_dest:
- b = move.product_id.product_tmpl_id.property_account_income
- if not b:
- b = move.product_id.categ_id.property_account_income_categ
- if not b:
+ acc_dest = move.product_id.product_tmpl_id.property_account_income.id
+ if not acc_dest:
+ acc_dest = move.product_id.categ_id.property_account_income_categ.id
+ if not acc_dest:
raise osv.except_osv('Error !', 'There is no income account defined for this product: "%s" (id:%d)' % (move.product_id.name, move.product_id.id,))
- acc_dest = b[0]
- if not move.product_id.categ_id.property_stock_journal:
+ if not move.product_id.categ_id.property_stock_journal.id:
raise osv.except_osv('Error !', 'There is no journal define on the product category: "%s" (id:%d)' % (move.product_id.categ_id.name, move.product_id.categ_id.id,))
- journal_id = move.product_id.categ_id.property_stock_journal[0]
+ journal_id = move.product_id.categ_id.property_stock_journal.id
if acc_src != acc_dest:
ref = move.picking_id and move.picking_id.name or False
@@ -891,7 +888,7 @@ class stock_inventory(osv.osv):
amount=self.pool.get('stock.location')._product_get(cr, uid, line.location_id.id, [pid], {'uom': line.product_uom.id})[pid]
change=line.product_qty-amount
if change:
- location_id = line.product_id.product_tmpl_id.property_stock_inventory[0]
+ location_id = line.product_id.product_tmpl_id.property_stock_inventory.id
value = {
'name': 'INV:'+str(line.inventory_id.id)+':'+line.inventory_id.name,
'product_id': line.product_id.id,