summaryrefslogtreecommitdiff
path: root/addons/account
diff options
context:
space:
mode:
authorMahendra barad <mba@openerp.com>2015-05-14 15:31:34 +0530
committerJosse Colpaert <jco@odoo.com>2015-06-23 14:00:43 +0200
commit75d7bbb46e100b7ffda091a11183d4ed14d3bbed (patch)
tree107ccd62ba2aef250d3110dd9070996ec4ecf668 /addons/account
parentbfbc22cdc20c88889661bb68d6321ec61fda4d0b (diff)
[REF]Account: Refactoring the account, Change some fields name according to new api guidelines
code improvement code improvement payment_method to payment_method_id writeoff_account to writeoff_account_id property_account_receivable to property_account_receivable_id property_account_payable to property_account_payable_id property_account_expense_categ to property_account_expense_categ_id property_account_income_categ to property_account_income_categ_id property_account_expense to property_account_expense_id property_account_income to property_account_income_id property_account_expense_categ fix sale_tax to sale_tax_id and default_sale_tax to default_sale_tax_id purchase_tax to purchase_tax_id and default_purchase_tax to default_purchase_tax_id ref_companies to ref_companies_ids property_account_position to property_account_position_id property_payment_term to property_payment_term_id property_supplier_payment_term to property_supplier_payment_term_id bank_accounts_id to bank_accounts_ids payment_method fix after rebase user_type after rebase payment_method fix after rebase after rebase invoice to invoice_id fix payment_method_id after rebase code improvement [IMP]user_type to user_type_id [IMP]property_stock_account_input_categ, property_stock_account_output_categ to _id [IMP]improve after rebase [IMP]fix type [IMP]Account: code improvement
Diffstat (limited to 'addons/account')
-rw-r--r--addons/account/account.py16
-rw-r--r--addons/account/account_analytic_line.py14
-rw-r--r--addons/account/account_bank_statement.py6
-rw-r--r--addons/account/account_invoice.py46
-rw-r--r--addons/account/account_move.py26
-rw-r--r--addons/account/account_payment.py28
-rw-r--r--addons/account/chart_template.py86
-rw-r--r--addons/account/company.py6
-rw-r--r--addons/account/demo/account_demo.xml12
-rw-r--r--addons/account/demo/account_invoice_demo.yml10
-rw-r--r--addons/account/demo/account_statement_operations.yml6
-rw-r--r--addons/account/partner.py34
-rw-r--r--addons/account/product.py20
-rw-r--r--addons/account/report/account_financial_report.py2
-rw-r--r--addons/account/res_config.py34
-rw-r--r--addons/account/test/account_bank_statement.yml2
-rw-r--r--addons/account/test/account_invoice_state.yml4
-rw-r--r--addons/account/test/account_minimal_test.xml92
-rw-r--r--addons/account/tests/test_account_customer_invoice.py6
-rw-r--r--addons/account/tests/test_account_supplier_invoice.py4
-rw-r--r--addons/account/tests/test_account_validate_account_move.py2
-rw-r--r--addons/account/tests/test_bank_statement_reconciliation.py4
-rw-r--r--addons/account/tests/test_payment.py14
-rw-r--r--addons/account/tests/test_reconciliation.py6
-rw-r--r--addons/account/tests/test_search.py25
-rw-r--r--addons/account/tests/test_tax.py2
-rw-r--r--addons/account/views/account_invoice_view.xml2
-rw-r--r--addons/account/views/account_payment_view.xml14
-rw-r--r--addons/account/views/account_view.xml58
-rw-r--r--addons/account/views/partner_view.xml10
-rw-r--r--addons/account/views/product_view.xml8
-rw-r--r--addons/account/views/res_config_view.xml16
32 files changed, 307 insertions, 308 deletions
diff --git a/addons/account/account.py b/addons/account/account.py
index 174863831fb..333f4fe0f86 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -100,9 +100,9 @@ class AccountAccount(models.Model):
help="Forces all moves for this account to have this secondary currency.")
code = fields.Char(size=64, required=True, index=True)
deprecated = fields.Boolean(index=True, default=False)
- user_type = fields.Many2one('account.account.type', string='Type', required=True,
+ user_type_id = fields.Many2one('account.account.type', string='Type', required=True, oldname="user_type",
help="Account Type is used for information purpose, to generate country-specific legal reports, and set the rules to close a fiscal year and generate opening entries.")
- internal_type = fields.Selection(related='user_type.type', store=True)
+ internal_type = fields.Selection(related='user_type_id.type', store=True)
#has_unreconciled_entries = fields.Boolean(compute='_compute_has_unreconciled_entries',
# help="The account has at least one unreconciled debit and credit since last time the invoices & payments matching was performed.")
last_time_entries_checked = fields.Datetime(string='Latest Invoices & Payments Matching Date', readonly=True, copy=False,
@@ -228,11 +228,11 @@ class AccountJournal(models.Model):
analytic_journal_id = fields.Many2one('account.analytic.journal', string='Analytic Journal', help="Journal for analytic entries")
refund_sequence = fields.Boolean(string='Dedicated Refund Sequence', help="Check this box if you don't want to share the same sequence for invoices and refunds made from this journal")
- inbound_payment_methods = fields.Many2many('account.payment.method', 'account_journal_inbound_payment_method_rel', 'journal_id', 'inbound_payment_method',
+ inbound_payment_method_ids = fields.Many2many('account.payment.method', 'account_journal_inbound_payment_method_rel', 'journal_id', 'inbound_payment_method',
domain=[('payment_type', '=', 'inbound')], string='Inbound Payment Methods', default=lambda self: self._default_inbound_payment_methods(),
help="Means of payment for collecting money. Odoo modules offer various payments handling facilities, "
"but you can always use the 'Manual' payment method in order to manage payments outside of the software.")
- outbound_payment_methods = fields.Many2many('account.payment.method', 'account_journal_outbound_payment_method_rel', 'journal_id', 'outbound_payment_method',
+ outbound_payment_method_ids = fields.Many2many('account.payment.method', 'account_journal_outbound_payment_method_rel', 'journal_id', 'outbound_payment_method',
domain=[('payment_type', '=', 'outbound')], string='Outbound Payment Methods', default=lambda self: self._default_outbound_payment_methods(),
help="Means of payment for sending money. Odoo modules offer various payments handling facilities, "
"but you can always use the 'Manual' payment method in order to manage payments outside of the software.")
@@ -342,7 +342,7 @@ class AccountJournal(models.Model):
'name': name,
'currency_id': currency_id or False,
'code': new_code,
- 'user_type': liquidity_type and liquidity_type.id or False,
+ 'user_type_id': liquidity_type and liquidity_type.id or False,
'company_id': company.id,
}
@@ -409,11 +409,11 @@ class AccountJournal(models.Model):
return res
@api.multi
- @api.depends('inbound_payment_methods', 'outbound_payment_methods')
+ @api.depends('inbound_payment_method_ids', 'outbound_payment_method_ids')
def _methods_compute(self):
for journal in self:
- journal.at_least_one_inbound = bool(len(self.inbound_payment_methods))
- journal.at_least_one_outbound = bool(len(self.outbound_payment_methods))
+ journal.at_least_one_inbound = bool(len(self.inbound_payment_method_ids))
+ journal.at_least_one_outbound = bool(len(self.outbound_payment_method_ids))
#----------------------------------------------------------
diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py
index bbc04f454d1..5b8faf5a428 100644
--- a/addons/account/account_analytic_line.py
+++ b/addons/account/account_analytic_line.py
@@ -49,17 +49,17 @@ class AccountAnalyticLine(models.Model):
if not unit_obj or prod.uom_po_id.category_id.id != unit_obj.category_id.id:
unit = prod.uom_po_id.id
if j_id.type <> 'sale':
- a = prod.property_account_expense.id
+ a = prod.property_account_expense_id.id
if not a:
- a = prod.categ_id.property_account_expense_categ.id
+ a = prod.categ_id.property_account_expense_categ_id.id
if not a:
raise UserError(_('There is no expense account defined ' \
'for this product: "%s" (id:%d).') % \
(prod.name, prod.id,))
else:
- a = prod.property_account_income.id
+ a = prod.property_account_income_id.id
if not a:
- a = prod.categ_id.property_account_income_categ.id
+ a = prod.categ_id.property_account_income_categ_id.id
if not a:
raise UserError(_('There is no income account defined ' \
'for this product: "%s" (id:%d).') % \
@@ -117,13 +117,13 @@ class AccountAnalyticLine(models.Model):
if not self.product_uom_id or self.product_id.uom_po_id.category_id.id != self.product_uom_id.category_id.id:
unit = self.product_id.uom_po_id.id
if journal_id.type != 'sale':
- account = self.product_id.property_account_expense.id or self.product_id.categ_id.property_account_expense_categ.id
+ account = self.product_id.property_account_expense_id.id or self.product_id.categ_id.property_account_expense_categ_id.id
if not account:
raise UserError(_('There is no expense account defined ' \
'for this product: "%s" (id:%d).') % \
(self.product_id.name, self.product_id.id,))
else:
- account = self.product_id.property_account_income.id or self.product_id.categ_id.property_account_income_categ.id
+ account = self.product_id.property_account_income_id.id or self.product_id.categ_id.property_account_income_categ_id.id
if not account:
raise UserError(_('There is no income account defined ' \
'for this product: "%s" (id:%d).') % \
@@ -156,4 +156,4 @@ class AccountAnalyticLine(models.Model):
if context.get('account_id', False):
analytic_account = self.env['account.analytic.account'].search([('id', '=', context['account_id'])], limit=1)
header = _('Entries: ') + (analytic_account.name or '')
- return header \ No newline at end of file
+ return header
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index c7c6c120804..3ca812c7590 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -448,9 +448,9 @@ class AccountBankStatementLine(models.Model):
}
if self.partner_id:
if amount > 0:
- data['open_balance_account_id'] = self.partner_id.property_account_receivable.id
+ data['open_balance_account_id'] = self.partner_id.property_account_receivable_id.id
else:
- data['open_balance_account_id'] = self.partner_id.property_account_payable.id
+ data['open_balance_account_id'] = self.partner_id.property_account_payable_id.id
return data
@@ -557,7 +557,7 @@ class AccountBankStatementLine(models.Model):
# Select move lines until their total amount is greater than the statement line amount
domain = [('reconciled', '=', False)]
- domain += [('account_id.user_type.type', '=', amount > 0 and 'receivable' or 'payable')] # Make sure we can't mix receivable and payable
+ domain += [('account_id.user_type_id.type', '=', amount > 0 and 'receivable' or 'payable')] # Make sure we can't mix receivable and payable
domain += amount_domain_maker('<', amount) # Will also enforce > 0
mv_lines = self.get_move_lines_for_reconciliation(excluded_ids=excluded_ids, limit=5, additional_domain=domain)
st_line_currency = self.currency_id or self.journal_id.currency_id or self.journal_id.company_id.currency_id
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index f4b855b4aad..06471732d88 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -427,16 +427,16 @@ class AccountInvoice(models.Model):
type = self.type
if p:
partner_id = p.id
- rec_account = p.property_account_receivable
- pay_account = p.property_account_payable
+ rec_account = p.property_account_receivable_id
+ pay_account = p.property_account_payable_id
if company_id:
- if p.property_account_receivable.company_id and \
- p.property_account_receivable.company_id.id != company_id and \
- p.property_account_payable.company_id and \
- p.property_account_payable.company_id.id != company_id:
+ if p.property_account_receivable_id.company_id and \
+ p.property_account_receivable_id.company_id.id != company_id and \
+ p.property_account_payable_id.company_id and \
+ p.property_account_payable_id.company_id.id != company_id:
prop = self.env['ir.property']
- rec_dom = [('name', '=', 'property_account_receivable'), ('company_id', '=', company_id)]
- pay_dom = [('name', '=', 'property_account_payable'), ('company_id', '=', company_id)]
+ rec_dom = [('name', '=', 'property_account_receivable_id'), ('company_id', '=', company_id)]
+ pay_dom = [('name', '=', 'property_account_payable_id'), ('company_id', '=', company_id)]
res_dom = [('res_id', '=', 'res.partner,%s' % partner_id)]
rec_prop = prop.search(rec_dom + res_dom) or prop.search(rec_dom)
pay_prop = prop.search(pay_dom + res_dom) or prop.search(pay_dom)
@@ -449,11 +449,11 @@ class AccountInvoice(models.Model):
if type in ('out_invoice', 'out_refund'):
account_id = rec_account.id
- payment_term_id = p.property_payment_term.id
+ payment_term_id = p.property_payment_term_id.id
else:
account_id = pay_account.id
- payment_term_id = p.property_supplier_payment_term.id
- fiscal_position = p.property_account_position.id
+ payment_term_id = p.property_supplier_payment_term_id.id
+ fiscal_position = p.property_account_position_id.id
bank_id = p.bank_ids and p.bank_ids.ids[0] or False
self.account_id = account_id
self.payment_term_id = payment_term_id
@@ -596,10 +596,10 @@ class AccountInvoice(models.Model):
'uos_id': line.uos_id.id,
'account_analytic_id': line.account_analytic_id.id,
'tax_ids': tax_ids,
- 'invoice': self.id,
+ 'invoice_id': self.id,
}
if line['account_analytic_id']:
- move_line_dict['analytic_lines'] = [(0, 0, line._get_analytic_line())]
+ move_line_dict['analytic_line_ids'] = [(0, 0, line._get_analytic_line())]
res.append(move_line_dict)
return res
@@ -642,7 +642,7 @@ class AccountInvoice(models.Model):
am = line2[tmp]['debit'] - line2[tmp]['credit'] + (l['debit'] - l['credit'])
line2[tmp]['debit'] = (am > 0) and am or 0.0
line2[tmp]['credit'] = (am < 0) and -am or 0.0
- line2[tmp]['analytic_lines'] += l['analytic_lines']
+ line2[tmp]['analytic_line_ids'] += l['analytic_line_ids']
else:
line2[tmp] = l
line = []
@@ -707,7 +707,7 @@ class AccountInvoice(models.Model):
'date_maturity': t[0],
'amount_currency': diff_currency and amount_currency,
'currency_id': diff_currency and inv.currency_id.id,
- 'invoice': inv.id
+ 'invoice_id': inv.id
})
else:
iml.append({
@@ -718,7 +718,7 @@ class AccountInvoice(models.Model):
'date_maturity': inv.date_due,
'amount_currency': diff_currency and total_currency,
'currency_id': diff_currency and inv.currency_id.id,
- 'invoice': inv.id
+ 'invoice_id': inv.id
})
part = self.env['res.partner']._find_accounting_partner(inv.partner_id)
line = [(0, 0, self.line_get_convert(l, part.id)) for l in iml]
@@ -737,7 +737,7 @@ class AccountInvoice(models.Model):
}
ctx['company_id'] = inv.company_id.id
ctx['dont_create_taxes'] = True
- ctx['invoice'] = inv.move_name and inv or False
+ ctx['invoice_id'] = inv.move_name and inv or False
move = account_move.with_context(ctx).create(move_vals)
# make the invoice point to that move
vals = {
@@ -764,14 +764,14 @@ class AccountInvoice(models.Model):
'debit': line['price'] > 0 and line['price'],
'credit': line['price'] < 0 and -line['price'],
'account_id': line['account_id'],
- 'analytic_lines': line.get('analytic_lines', []),
+ 'analytic_line_ids': line.get('analytic_line_ids', []),
'amount_currency': line['price'] > 0 and abs(line.get('amount_currency', False)) or -abs(line.get('amount_currency', False)),
'currency_id': line.get('currency_id', False),
'quantity': line.get('quantity', 1.00),
'product_id': line.get('product_id', False),
'product_uom_id': line.get('uos_id', False),
'analytic_account_id': line.get('account_analytic_id', False),
- 'invoice': line.get('invoice', False),
+ 'invoice_id': line.get('invoice_id', False),
'tax_ids': line.get('tax_ids', False),
'tax_line_id': line.get('tax_line_id', False),
}
@@ -914,10 +914,10 @@ class AccountInvoice(models.Model):
payment_type = self.type in ('out_invoice', 'in_refund') and 'inbound' or 'outbound'
if payment_type == 'inbound':
payment_method = self.env.ref('account.account_payment_method_manual_in')
- journal_payment_methods = pay_journal.inbound_payment_methods
+ journal_payment_methods = pay_journal.inbound_payment_method_ids
else:
payment_method = self.env.ref('account.account_payment_method_manual_out')
- journal_payment_methods = pay_journal.outbound_payment_methods
+ journal_payment_methods = pay_journal.outbound_payment_method_ids
if payment_method not in journal_payment_methods:
raise UserError(_('No appropriate payment method enabled on journal %s') % pay_journal.name)
@@ -930,9 +930,9 @@ class AccountInvoice(models.Model):
'partner_type': self.type in ('out_invoice', 'out_refund') and 'customer' or 'supplier',
'journal_id': pay_journal.id,
'payment_type': payment_type,
- 'payment_method': payment_method.id,
+ 'payment_method_id': payment_method.id,
'payment_difference_handling': writeoff_acc and 'reconcile' or 'open',
- 'writeoff_account': writeoff_acc and writeoff_acc.id or False,
+ 'writeoff_account_id': writeoff_acc and writeoff_acc.id or False,
})
payment.post()
diff --git a/addons/account/account_move.py b/addons/account/account_move.py
index 8aeb37c75ba..4a7554c2f54 100644
--- a/addons/account/account_move.py
+++ b/addons/account/account_move.py
@@ -40,7 +40,7 @@ class AccountMove(models.Model):
total += line.debit
move.amount = total
- @api.depends('line_ids.debit', 'line_ids.credit', 'line_ids.matched_debit_ids.amount', 'line_ids.matched_credit_ids.amount', 'line_ids.account_id.user_type.type')
+ @api.depends('line_ids.debit', 'line_ids.credit', 'line_ids.matched_debit_ids.amount', 'line_ids.matched_credit_ids.amount', 'line_ids.account_id.user_type_id.type')
def _compute_matched_percentage(self):
"""Compute the percentage to apply for cash basis method. This value is relevant only for moves that
involve journal items on receivable or payable accounts.
@@ -49,7 +49,7 @@ class AccountMove(models.Model):
total_amount = 0.0
total_reconciled = 0.0
for line in move.line_ids:
- if line.account_id.user_type.type in ('receivable', 'payable'):
+ if line.account_id.user_type_id.type in ('receivable', 'payable'):
amount = abs(line.debit - line.credit)
total_amount += amount
for partial_line in (line.matched_debit_ids + line.matched_credit_ids):
@@ -334,7 +334,7 @@ class AccountMoveLine(models.Model):
date_maturity = fields.Date(string='Due date', index=True, required=True,
help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line.")
date = fields.Date(related='move_id.date', string='Date', required=True, index=True, default=fields.Date.context_today, store=True, copy=False)
- analytic_lines = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines')
+ analytic_line_ids = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines', oldname="analytic_lines")
tax_ids = fields.Many2many('account.tax', string='Taxes', copy=False, readonly=True)
tax_line_id = fields.Many2one('account.tax', string='Originator tax', copy=False, readonly=True)
analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account')
@@ -342,9 +342,9 @@ class AccountMoveLine(models.Model):
counterpart = fields.Char("Counterpart", compute='_get_counterpart', help="Compute the counter part accounts of this journal item for this journal entry. This can be needed in reports.")
# TODO: put the invoice link and partner_id on the account_move
- invoice = fields.Many2one('account.invoice')
+ invoice_id = fields.Many2one('account.invoice', oldname="invoice")
partner_id = fields.Many2one('res.partner', string='Partner', index=True, ondelete='restrict')
- user_type = fields.Many2one('account.account.type', related='account_id.user_type', index=True, store=True)
+ user_type_id = fields.Many2one('account.account.type', related='account_id.user_type_id', index=True, store=True, oldname="user_type")
_sql_constraints = [
('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry !'),
@@ -418,7 +418,7 @@ class AccountMoveLine(models.Model):
FROM
account_move_line l
RIGHT JOIN account_account a ON (a.id = l.account_id)
- RIGHT JOIN account_account_type at ON (at.id = a.user_type)
+ RIGHT JOIN account_account_type at ON (at.id = a.user_type_id)
%s
WHERE
a.reconcile IS TRUE
@@ -904,7 +904,7 @@ class AccountMoveLine(models.Model):
if ('account_id' in vals):
account = AccountObj.browse(vals['account_id'])
if journal.type_control_ids:
- type = account.user_type
+ type = account.user_type_id
for t in journal.type_control_ids:
if type.code == t.code:
ok = True
@@ -988,10 +988,10 @@ class AccountMoveLine(models.Model):
raise UserError(_('You cannot use deprecated account.'))
if any(key in vals for key in ('account_id', 'journal_id', 'date', 'move_id', 'debit', 'credit', 'amount_currency', 'currency_id')):
self._update_check()
- #when we set the expected payment date, log a note on the invoice related (if any)
- if vals.get('expected_pay_date') and self.invoice:
+ #when we set the expected payment date, log a note on the invoice_id related (if any)
+ if vals.get('expected_pay_date') and self.invoice_id:
msg = _('New expected payment date: ') + vals['expected_pay_date'] + '.\n' + vals.get('internal_note', '')
- self.invoice.message_post(body=msg) #TODO: check it is an internal note (not a regular email)!
+ self.invoice_id.message_post(body=msg) #TODO: check it is an internal note (not a regular email)!
#when making a reconciliation on an existing liquidity journal item, mark the payment as reconciled
if 'statement_id' in vals and self.payment_id:
# In case of an internal transfer, there are 2 liquidity move lines to match with a bank statement
@@ -1057,8 +1057,8 @@ class AccountMoveLine(models.Model):
if obj_line.analytic_account_id:
if not obj_line.journal_id.analytic_journal_id:
raise UserError(_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, ))
- if obj_line.analytic_lines:
- obj_line.analytic_lines.unlink()
+ if obj_line.analytic_line_ids:
+ obj_line.analytic_line_ids.unlink()
vals_line = obj_line._prepare_analytic_line()[0]
self.env['account.analytic.line'].create(vals_line)
@@ -1094,7 +1094,7 @@ class AccountMoveLine(models.Model):
domain += [(date_field, '<=', context['date_to'])]
if context.get('date_from'):
if not context.get('strict_range'):
- domain += ['|', (date_field, '>=', context['date_from']), ('account_id.user_type.include_initial_balance', '=', True)]
+ domain += ['|', (date_field, '>=', context['date_from']), ('account_id.user_type_id.include_initial_balance', '=', True)]
else:
domain += [(date_field, '>=', context['date_from'])]
diff --git a/addons/account/account_payment.py b/addons/account/account_payment.py
index 70d38d6978b..1f8e252155e 100644
--- a/addons/account/account_payment.py
+++ b/addons/account/account_payment.py
@@ -31,8 +31,8 @@ class account_abstract_payment(models.AbstractModel):
_description = "Contains the logic shared between models which allows to register payments"
payment_type = fields.Selection([('outbound', 'Send Money'), ('inbound', 'Receive Money')], string='Payment Type', required=True)
- payment_method = fields.Many2one('account.payment.method', string='Payment Method', required=True)
- payment_method_code = fields.Char(related='payment_method.code',
+ payment_method_id = fields.Many2one('account.payment.method', string='Payment Method', required=True, oldname="payment_method")
+ payment_method_code = fields.Char(related='payment_method_id.code',
help="Technical field used to adapt the interface to the payment method selected.")
partner_type = fields.Selection([('customer', 'Customer'), ('supplier', 'Supplier')])
@@ -60,7 +60,7 @@ class account_abstract_payment(models.AbstractModel):
if not self.journal_id:
self.hide_payment_method = True
return
- journal_payment_methods = self.payment_type == 'inbound' and self.journal_id.inbound_payment_methods or self.journal_id.outbound_payment_methods
+ journal_payment_methods = self.payment_type == 'inbound' and self.journal_id.inbound_payment_method_ids or self.journal_id.outbound_payment_method_ids
self.hide_payment_method = len(journal_payment_methods) == 1 and journal_payment_methods[0].code == 'manual'
@api.onchange('journal_id')
@@ -68,11 +68,11 @@ class account_abstract_payment(models.AbstractModel):
if self.journal_id:
self.currency_id = self.journal_id.currency_id or self.company_id.currency_id
# Set default payment method (we consider the first to be the default one)
- payment_methods = self.payment_type == 'inbound' and self.journal_id.inbound_payment_methods or self.journal_id.outbound_payment_methods
- self.payment_method = payment_methods and payment_methods[0] or False
+ payment_methods = self.payment_type == 'inbound' and self.journal_id.inbound_payment_method_ids or self.journal_id.outbound_payment_method_ids
+ self.payment_method_id = payment_methods and payment_methods[0] or False
# Set payment method domain (restrict to methods enabled for the journal and to selected payment type)
payment_type = self.payment_type in ('outbound', 'transfer') and 'outbound' or 'inbound'
- return {'domain': {'payment_method': [('payment_type', '=', payment_type), ('id', 'in', payment_methods.ids)]}}
+ return {'domain': {'payment_method_id': [('payment_type', '=', payment_type), ('id', 'in', payment_methods.ids)]}}
return {}
def _get_invoices(self):
@@ -98,7 +98,7 @@ class account_register_payments(models.TransientModel):
@api.onchange('payment_type')
def _onchange_payment_type(self):
if self.payment_type:
- return {'domain': {'payment_method': [('payment_type', '=', self.payment_type)]}}
+ return {'domain': {'payment_method_id': [('payment_type', '=', self.payment_type)]}}
def _get_invoices(self):
return self.env['account.invoice'].browse(self._context.get('active_ids'))
@@ -141,7 +141,7 @@ class account_register_payments(models.TransientModel):
""" Hook for extension """
return {
'journal_id': self.journal_id.id,
- 'payment_method': self.payment_method.id,
+ 'payment_method_id': self.payment_method_id.id,
'payment_date': self.payment_date,
'communication': self.communication,
'invoice_ids': [(4, inv.id, None) for inv in self._get_invoices()],
@@ -194,7 +194,7 @@ class account_payment(models.Model):
has_invoices = fields.Boolean(compute="_get_has_invoices", help="Technical field used for usablity purposes")
payment_difference = fields.Monetary(compute='_compute_payment_difference', readonly=True)
payment_difference_handling = fields.Selection([('open', 'Partial payment'), ('reconcile', 'Mark invoice as fully paid')], default='open', string="Payment Difference", copy=False)
- writeoff_account = fields.Many2one('account.account', string="Counterpart Account", domain=[('deprecated', '=', False)], copy=False)
+ writeoff_account_id = fields.Many2one('account.account', string="Counterpart Account", domain=[('deprecated', '=', False)], copy=False)
# FIXME: ondelete='restrict' not working (eg. cancel a bank statement reconciliation with a payment)
move_line_ids = fields.One2many('account.move.line', 'payment_id', readonly=True, copy=False, ondelete='restrict')
@@ -210,9 +210,9 @@ class account_payment(models.Model):
self.destination_account_id = self.company_id.transfer_account_id.id
elif self.partner_id:
if self.partner_type == 'customer':
- self.destination_account_id = self.partner_id.property_account_receivable.id
+ self.destination_account_id = self.partner_id.property_account_receivable_id.id
else:
- self.destination_account_id = self.partner_id.property_account_payable.id
+ self.destination_account_id = self.partner_id.property_account_payable_id.id
@api.onchange('partner_type')
def _onchange_partner_type(self):
@@ -256,12 +256,12 @@ class account_payment(models.Model):
@api.model
def create(self, vals):
- self._check_communication(vals['payment_method'], vals.get('communication', ''))
+ self._check_communication(vals['payment_method_id'], vals.get('communication', ''))
return super(account_payment, self).create(vals)
def _check_communication(self, payment_method_id, communication):
""" This method is to be overwritten by payment type modules. The method body would look like :
- if payment_method_id == self.env.ref('my_module.payment_method').id:
+ if payment_method_id == self.env.ref('my_module.payment_method_id').id:
try:
communication.decode('ascii')
except UnicodeError:
@@ -442,7 +442,7 @@ class account_payment(models.Model):
"""
return {
'partner_id': self.payment_type in ('inbound', 'outbound') and self.partner_id.commercial_partner_id.id or False,
- 'invoice': invoice_id and invoice_id.id or False,
+ 'invoice_id': invoice_id and invoice_id.id or False,
'move_id': move_id,
'debit': debit,
'credit': credit,
diff --git a/addons/account/chart_template.py b/addons/account/chart_template.py
index e7c2925971a..329e492c67c 100644
--- a/addons/account/chart_template.py
+++ b/addons/account/chart_template.py
@@ -24,7 +24,7 @@ class AccountAccountTemplate(models.Model):
name = fields.Char(required=True, index=True)
currency_id = fields.Many2one('res.currency', string='Secondary Currency', help="Forces all moves for this account to have this secondary currency.")
code = fields.Char(size=64, required=True, index=True)
- user_type = fields.Many2one('account.account.type', string='Type', required=True,
+ user_type_id = fields.Many2one('account.account.type', string='Type', required=True,
help="These types are defined according to your country. The type contains more information "\
"about the account and its specificities.")
reconcile = fields.Boolean(string='Allow Invoices & payments Matching', default=False,
@@ -71,20 +71,20 @@ class AccountChartTemplate(models.Model):
help='List of all the taxes that have to be installed by the wizard')
bank_account_code_char = fields.Char(string='Code of the main bank account')
transfer_account_id = fields.Many2one('account.account.template', string='Transfer Account', required=True,
- domain=lambda self: [('reconcile', '=', True), ('user_type.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
+ domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
help="Intermediary account used when moving money from a liquidity account to another")
income_currency_exchange_account_id = fields.Many2one('account.account.template',
string="Gain Exchange Rate Account", domain=[('internal_type', '=', 'other'), ('deprecated', '=', False)])
expense_currency_exchange_account_id = fields.Many2one('account.account.template',
string="Loss Exchange Rate Account", domain=[('internal_type', '=', 'other'), ('deprecated', '=', False)])
- property_account_receivable = fields.Many2one('account.account.template', string='Receivable Account')
- property_account_payable = fields.Many2one('account.account.template', string='Payable Account')
- property_account_expense_categ = fields.Many2one('account.account.template', string='Expense Category Account')
- property_account_income_categ = fields.Many2one('account.account.template', string='Income Category Account')
- property_account_expense = fields.Many2one('account.account.template', string='Expense Account on Product Template')
- property_account_income = fields.Many2one('account.account.template', string='Income Account on Product Template')
- property_stock_account_input_categ = fields.Many2one('account.account.template')
- property_stock_account_output_categ = fields.Many2one('account.account.template')
+ property_account_receivable_id = fields.Many2one('account.account.template', string='Receivable Account', oldname="property_account_receivable")
+ property_account_payable_id = fields.Many2one('account.account.template', string='Payable Account', oldname="property_account_payable")
+ property_account_expense_categ_id = fields.Many2one('account.account.template', string='Expense Category Account', oldname="property_account_expense_categ")
+ property_account_income_categ_id = fields.Many2one('account.account.template', string='Income Category Account', oldname="property_account_income_categ")
+ property_account_expense_id = fields.Many2one('account.account.template', string='Expense Account on Product Template', oldname="property_account_expense")
+ property_account_income_id = fields.Many2one('account.account.template', string='Income Account on Product Template', oldname="property_account_income")
+ property_stock_account_input_categ_id = fields.Many2one('account.account.template', oldname="property_stock_account_input_categ")
+ property_stock_account_output_categ_id = fields.Many2one('account.account.template', oldname="property_stock_account_output_categ")
property_stock_valuation_account_id = fields.Many2one('account.account.template')
@api.one
@@ -159,9 +159,9 @@ class AccountChartTemplate(models.Model):
# Get the default accounts
default_account = False
if journal['type'] == 'sale':
- default_account = acc_template_ref.get(self.property_account_income_categ.id)
+ default_account = acc_template_ref.get(self.property_account_income_categ_id.id)
elif journal['type'] == 'purchase':
- default_account = acc_template_ref.get(self.property_account_expense_categ.id)
+ default_account = acc_template_ref.get(self.property_account_expense_categ_id.id)
elif journal['type'] == 'general' and journal['name'] == _('Exchange Rate Journal'):
if type=='credit':
default_account = acc_template_ref.get(self.income_currency_exchange_account_id.id)
@@ -206,12 +206,12 @@ class AccountChartTemplate(models.Model):
self.ensure_one()
PropertyObj = self.env['ir.property']
todo_list = [
- ('property_account_receivable', 'res.partner', 'account.account'),
- ('property_account_payable', 'res.partner', 'account.account'),
- ('property_account_expense_categ', 'product.category', 'account.account'),
- ('property_account_income_categ', 'product.category', 'account.account'),
- ('property_account_expense', 'product.template', 'account.account'),
- ('property_account_income', 'product.template', 'account.account'),
+ ('property_account_receivable_id', 'res.partner', 'account.account'),
+ ('property_account_payable_id', 'res.partner', 'account.account'),
+ ('property_account_expense_categ_id', 'product.category', 'account.account'),
+ ('property_account_income_categ_id', 'product.category', 'account.account'),
+ ('property_account_expense_id', 'product.template', 'account.account'),
+ ('property_account_income_id', 'product.template', 'account.account'),
]
for record in todo_list:
account = getattr(self, record[0])
@@ -232,8 +232,8 @@ class AccountChartTemplate(models.Model):
#create the property
PropertyObj.create(vals)
stock_properties = [
- 'property_stock_account_input_categ',
- 'property_stock_account_output_categ',
+ 'property_stock_account_input_categ_id',
+ 'property_stock_account_output_categ_id',
'property_stock_valuation_account_id',
]
for stock_property in stock_properties:
@@ -354,7 +354,7 @@ class AccountChartTemplate(models.Model):
'name': account_template.name,
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
'code': code_acc,
- 'user_type': account_template.user_type and account_template.user_type.id or False,
+ 'user_type_id': account_template.user_type_id and account_template.user_type_id.id or False,
'reconcile': account_template.reconcile,
'note': account_template.note,
'tax_ids': [(6, 0, tax_ids)],
@@ -548,15 +548,15 @@ class WizardMultiChartsAccounts(models.TransientModel):
currency_id = fields.Many2one('res.currency', string='Currency', help="Currency as per company's country.", required=True)
only_one_chart_template = fields.Boolean(string='Only One Chart Template Available')
chart_template_id = fields.Many2one('account.chart.template', string='Chart Template', required=True)
- bank_accounts_id = fields.One2many('account.bank.accounts.wizard', 'bank_account_id', string='Cash and Banks', required=True)
+ bank_account_ids = fields.One2many('account.bank.accounts.wizard', 'bank_account_id', string='Cash and Banks', required=True, oldname="bank_accounts_id")
bank_account_code_char = fields.Char('Bank Accounts Code')
code_digits = fields.Integer(string='# of Digits', required=True, help="No. of Digits to use for account code")
- sale_tax = fields.Many2one('account.tax.template', string='Default Sales Tax')
- purchase_tax = fields.Many2one('account.tax.template', string='Default Purchase Tax')
+ sale_tax_id = fields.Many2one('account.tax.template', string='Default Sales Tax', oldname="sale_tax")
+ purchase_tax_id = fields.Many2one('account.tax.template', string='Default Purchase Tax', oldname="purchase_tax")
sale_tax_rate = fields.Float(string='Sales Tax(%)')
use_anglo_saxon = fields.Boolean(string='Use Anglo-Saxon Accounting', related='chart_template_id.use_anglo_saxon')
transfer_account_id = fields.Many2one('account.account.template', required=True, string='Transfer Account',
- domain=lambda self: [('reconcile', '=', True), ('user_type.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
+ domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
help="Intermediary account used when moving money from a liquidity account to another")
purchase_tax_rate = fields.Float(string='Purchase Tax(%)')
complete_tax_set = fields.Boolean('Complete Set of Taxes',
@@ -597,11 +597,11 @@ class WizardMultiChartsAccounts(models.TransientModel):
purchase_tax_domain = base_tax_domain + [('type_tax_use', '=', 'purchase')]
sale_tax = tax_templ_obj.search(sale_tax_domain, order="sequence, id desc", limit=1)
purchase_tax = tax_templ_obj.search(purchase_tax_domain, order="sequence, id desc", limit=1)
- self.sale_tax = sale_tax.id
- self.purchase_tax = purchase_tax.id
+ self.sale_tax_id = sale_tax.id
+ self.purchase_tax_id = purchase_tax.id
res.setdefault('domain', {})
- res['domain']['sale_tax'] = repr(sale_tax_domain)
- res['domain']['purchase_tax'] = repr(purchase_tax_domain)
+ res['domain']['sale_tax_id'] = repr(sale_tax_domain)
+ res['domain']['purchase_tax_id'] = repr(purchase_tax_domain)
if self.chart_template_id.transfer_account_id:
self.transfer_account_id = self.chart_template_id.transfer_account_id.id
if self.chart_template_id.code_digits:
@@ -617,8 +617,8 @@ class WizardMultiChartsAccounts(models.TransientModel):
tax_templ_obj = self.env['account.tax.template']
account_chart_template = self.env['account.chart.template']
- if 'bank_accounts_id' in fields:
- res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'}, {'acc_name': _('Bank'), 'account_type': 'bank'}]})
+ if 'bank_account_ids' in fields:
+ res.update({'bank_account_ids': [{'acc_name': _('Cash'), 'account_type': 'cash'}, {'acc_name': _('Bank'), 'account_type': 'bank'}]})
if 'company_id' in fields:
res.update({'company_id': self.env.user.company_id.id})
if 'currency_id' in fields:
@@ -641,14 +641,14 @@ class WizardMultiChartsAccounts(models.TransientModel):
if 'chart_template_id' in fields:
res.update({'only_one_chart_template': len(chart_templates) == 1,
'chart_template_id': chart_id})
- if 'sale_tax' in fields:
+ if 'sale_tax_id' in fields:
sale_tax = tax_templ_obj.search([('chart_template_id', 'in', chart_hierarchy_ids),
('type_tax_use', '=', 'sale')], limit=1, order='sequence')
- res.update({'sale_tax': sale_tax and sale_tax.id or False})
- if 'purchase_tax' in fields:
+ res.update({'sale_tax_id': sale_tax and sale_tax.id or False})
+ if 'purchase_tax_id' in fields:
purchase_tax = tax_templ_obj.search([('chart_template_id', 'in', chart_hierarchy_ids),
('type_tax_use', '=', 'purchase')], limit=1, order='sequence')
- res.update({'purchase_tax': purchase_tax and purchase_tax.id or False})
+ res.update({'purchase_tax_id': purchase_tax and purchase_tax.id or False})
res.update({
'purchase_tax_rate': 15.0,
'sale_tax_rate': 15.0,
@@ -730,10 +730,10 @@ class WizardMultiChartsAccounts(models.TransientModel):
acc_template_ref, taxes_ref = self.chart_template_id._install_template(company, code_digits=self.code_digits, transfer_account_id=self.transfer_account_id)
# write values of default taxes for product as super user
- if self.sale_tax and taxes_ref:
- ir_values_obj.sudo().set_default('product.template', "taxes_id", [taxes_ref[self.sale_tax.id]], for_all_users=True, company_id=company.id)
- if self.purchase_tax and taxes_ref:
- ir_values_obj.sudo().set_default('product.template', "supplier_taxes_id", [taxes_ref[self.purchase_tax.id]], for_all_users=True, company_id=company.id)
+ if self.sale_tax_id and taxes_ref:
+ ir_values_obj.sudo().set_default('product.template', "taxes_id", [taxes_ref[self.sale_tax_id.id]], for_all_users=True, company_id=company.id)
+ if self.purchase_tax_id and taxes_ref:
+ ir_values_obj.sudo().set_default('product.template', "supplier_taxes_id", [taxes_ref[self.purchase_tax_id.id]], for_all_users=True, company_id=company.id)
# Create Bank journals
self._create_bank_journals_from_o2m(company, acc_template_ref)
@@ -742,14 +742,14 @@ class WizardMultiChartsAccounts(models.TransientModel):
self.env['account.account'].create({
'code': '0',
'name': _('Undistributed Profits/Losses'),
- 'user_type': self.env.ref("account.data_unaffected_earnings").id,
+ 'user_type_id': self.env.ref("account.data_unaffected_earnings").id,
'company_id': company.id,})
return {}
@api.multi
def _create_bank_journals_from_o2m(self, company, acc_template_ref):
'''
- This function creates bank journals and its accounts for each line encoded in the field bank_accounts_id of the
+ This function creates bank journals and its accounts for each line encoded in the field bank_account_ids of the
wizard.
:param company_id: the id of the company for which the wizard is running.
@@ -760,8 +760,8 @@ class WizardMultiChartsAccounts(models.TransientModel):
self.ensure_one()
# Build a list with all the data to process
journal_data = []
- if self.bank_accounts_id:
- for acc in self.bank_accounts_id:
+ if self.bank_account_ids:
+ for acc in self.bank_account_ids:
vals = {
'acc_name': acc.acc_name,
'account_type': acc.account_type,
diff --git a/addons/account/company.py b/addons/account/company.py
index d7c0a2686f3..d56a10644a4 100644
--- a/addons/account/company.py
+++ b/addons/account/company.py
@@ -14,7 +14,7 @@ class ResCompany(models.Model):
period_lock_date = fields.Date(help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date")
fiscalyear_lock_date = fields.Date(string="Fiscal Year lock date", help="No users, including Advisers, can edit accounts prior to and inclusive of this date")
transfer_account_id = fields.Many2one('account.account',
- domain=lambda self: [('reconcile', '=', True), ('user_type.id', '=', self.env.ref('account.data_account_type_current_assets').id), ('deprecated', '=', False)], string="Transfer Account", help="Intermediary account used when moving money from a liquidity account to another")
+ domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id), ('deprecated', '=', False)], string="Transfer Account", help="Intermediary account used when moving money from a liquidity account to another")
expects_chart_of_accounts = fields.Boolean(string='Expects a Chart of Accounts', default=True)
chart_template_id = fields.Many2one('account.chart.template', help='The chart template for the company (if any)')
bank_account_code_char = fields.Char(string='Code of the main bank account')
@@ -31,8 +31,8 @@ class ResCompany(models.Model):
expense_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_debit_account_id',
string="Loss Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]")
anglo_saxon_accounting = fields.Boolean(string="Use anglo-saxon accounting")
- property_stock_account_input_categ = fields.Many2one('account.account')
- property_stock_account_output_categ = fields.Many2one('account.account')
+ property_stock_account_input_categ_id = fields.Many2one('account.account', oldname="property_stock_account_input_categ")
+ property_stock_account_output_categ_id = fields.Many2one('account.account', oldname="property_stock_account_output_categ")
property_stock_valuation_account_id = fields.Many2one('account.account')
@api.multi
diff --git a/addons/account/demo/account_demo.xml b/addons/account/demo/account_demo.xml
index ee8e66f848d..c3038bcca8b 100644
--- a/addons/account/demo/account_demo.xml
+++ b/addons/account/demo/account_demo.xml
@@ -56,22 +56,22 @@
<!-- Add payment term on some demo partners -->
<record id="base.res_partner_2" model="res.partner">
- <field name="property_payment_term" ref="account.account_payment_term_net"/>
+ <field name="property_payment_term_id" ref="account.account_payment_term_net"/>
</record>
<record id="base.res_partner_12" model="res.partner">
- <field name="property_payment_term" ref="account_payment_term"/>
- <field name="property_supplier_payment_term" ref="account_payment_term"/>
+ <field name="property_payment_term_id" ref="account_payment_term"/>
+ <field name="property_supplier_payment_term_id" ref="account_payment_term"/>
</record>
<record id="base.res_partner_4" model="res.partner">
- <field name="property_supplier_payment_term" ref="account.account_payment_term_net"/>
+ <field name="property_supplier_payment_term_id" ref="account.account_payment_term_net"/>
</record>
<record id="base.res_partner_1" model="res.partner">
- <field name="property_supplier_payment_term" ref="account_payment_term"/>
+ <field name="property_supplier_payment_term_id" ref="account_payment_term"/>
</record>
<!--
<record id="account.credit_account" model="account.account">
<field name="name">Bank Account</field>
- <field name="user_type" ref="account.data_account_type_liquidity"/>
+ <field name="user_type_id" ref="account.data_account_type_liquidity"/>
<field name="code">Testbank</field>
</record>
diff --git a/addons/account/demo/account_invoice_demo.yml b/addons/account/demo/account_invoice_demo.yml
index 24f5549b9a2..3c95f219cf1 100644
--- a/addons/account/demo/account_invoice_demo.yml
+++ b/addons/account/demo/account_invoice_demo.yml
@@ -122,7 +122,7 @@
}
account_id = self.pool.get('account.account').search(cr, uid, [('tag_ids', 'in', [ref('account.demo_ceo_wages_account')])])
if not account_id:
- account_id = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_expenses'))])
+ account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_expenses'))])
if account_id:
line_vals['account_id'] = account_id[0]
self._update(cr, uid, 'account.invoice.line', 'account', line_vals, 'ceo_wages_line')
@@ -143,7 +143,7 @@
}
account_id = self.pool.get('account.account').search(cr, uid, [('tag_ids', 'in', [ref('account.demo_coffee_machine_account')])])
if not account_id:
- account_id = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_expenses'))])
+ account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_expenses'))])
if account_id:
line_vals['account_id'] = account_id[0]
tax_id = self.pool.get('account.tax').search(cr, uid, [('type_tax_use', '=', 'purchase'), ('amount', '>', 0)])
@@ -154,7 +154,7 @@
self.pool.get('account.invoice').signal_workflow(cr, uid, [ref('demo_invoice_equipment_purchase')], 'invoice_open')
-
!python {model: account.bank.statement.line} : |
- account_ids = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_revenue')), ('tag_ids', 'in', [ref('account.account_tag_financing')])])
+ account_ids = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_revenue')), ('tag_ids', 'in', [ref('account.account_tag_financing')])])
line = self.browse(cr, uid, ref('account.demo_bank_statement_line_5'))
if not line.journal_entry_ids and account_ids:
line.write({'account_id': account_ids[0]})
@@ -175,8 +175,8 @@
bank_journal_id = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'bank')])[0]
if bank_journal_id:
bank_account_id = self.pool.get('account.journal').browse(cr, uid, bank_journal_id).default_debit_account_id.id
- fixed_asset_account_ids = self.pool.get('account.account').search(cr, uid, [('user_type', 'in', (ref('account.data_account_type_fixed_assets'),ref('account.data_account_type_current_assets')))])
- equity_account_ids = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_equity')), ('tag_ids', 'in', [ref('account.demo_capital_account')])])
+ fixed_asset_account_ids = self.pool.get('account.account').search(cr, uid, [('user_type_id', 'in', (ref('account.data_account_type_fixed_assets'),ref('account.data_account_type_current_assets')))])
+ equity_account_ids = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_equity')), ('tag_ids', 'in', [ref('account.demo_capital_account')])])
if bank_account_id and fixed_asset_account_ids and equity_account_ids:
self._update(cr, uid, 'account.move.line', 'account', {
'move_id': ref('account.demo_opening_move'),
diff --git a/addons/account/demo/account_statement_operations.yml b/addons/account/demo/account_statement_operations.yml
index 49524d1557b..5e7eab605ca 100644
--- a/addons/account/demo/account_statement_operations.yml
+++ b/addons/account/demo/account_statement_operations.yml
@@ -1,6 +1,6 @@
-
!python {model: ir.model.data} : |
- account_id = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_expenses')), ('tag_ids', '=', ref('account_tag_operating'))])
+ account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_expenses')), ('tag_ids', '=', ref('account_tag_operating'))])
vals = {
'name': "Discount For Early Payment",
'label': 'Discount',
@@ -12,7 +12,7 @@
self._update(cr, uid, 'account.operation.template', 'account', vals, 'statement_operation_template_1')
-
!python {model: ir.model.data} : |
- account_id = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_expenses')), ('tag_ids', '=', ref('account_tag_operating'))])
+ account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_expenses')), ('tag_ids', '=', ref('account_tag_operating'))])
vals = {
'name': "Bank Fees",
'label': 'Bank Fees',
@@ -24,7 +24,7 @@
self._update(cr, uid, 'account.operation.template', 'account', vals, 'statement_operation_template_2')
-
!python {model: ir.model.data} : |
- account_id = self.pool.get('account.account').search(cr, uid, [('user_type', '=', ref('account.data_account_type_revenue')), ('tag_ids', '=', ref('account_tag_operating'))])
+ account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_revenue')), ('tag_ids', '=', ref('account_tag_operating'))])
vals = {
'name': "Profit / Loss",
'label': 'Profit / Loss',
diff --git a/addons/account/partner.py b/addons/account/partner.py
index 8dc46b9df49..85a17f07559 100644
--- a/addons/account/partner.py
+++ b/addons/account/partner.py
@@ -106,8 +106,8 @@ class AccountFiscalPosition(models.Model):
partner = PartnerObj.browse(partner_id)
# partner manually set fiscal position always win
- if partner.property_account_position:
- return partner.property_account_position.id
+ if partner.property_account_position_id:
+ return partner.property_account_position_id.id
# if no delivery use invocing
if delivery_id:
@@ -184,7 +184,7 @@ class ResPartner(models.Model):
self._cr.execute("""SELECT l.partner_id, act.type, SUM(l.debit-l.credit)
FROM account_move_line l
LEFT JOIN account_account a ON (l.account_id=a.id)
- LEFT JOIN account_account_type act ON (a.user_type=act.id)
+ LEFT JOIN account_account_type act ON (a.user_type_id=act.id)
WHERE act.type IN ('receivable','payable')
AND l.partner_id IN %s
AND l.reconciled IS FALSE
@@ -335,27 +335,27 @@ class ResPartner(models.Model):
contracts_count = fields.Integer(compute='_journal_item_count', string="Contracts", type='integer')
journal_item_count = fields.Integer(compute='_journal_item_count', string="Journal Items", type="integer")
issued_total = fields.Char(compute='_compute_issued_total', string="Journal Items")
- property_account_payable = fields.Many2one('account.account', company_dependent=True,
- string="Account Payable",
+ property_account_payable_id = fields.Many2one('account.account', company_dependent=True,
+ string="Account Payable", oldname="property_account_payable",
domain="[('internal_type', '=', 'payable'), ('deprecated', '=', False)]",
help="This account will be used instead of the default one as the payable account for the current partner",
required=True)
- property_account_receivable = fields.Many2one('account.account', company_dependent=True,
- string="Account Receivable",
+ property_account_receivable_id = fields.Many2one('account.account', company_dependent=True,
+ string="Account Receivable", oldname="property_account_receivable",
domain="[('internal_type', '=', 'receivable'), ('deprecated', '=', False)]",
help="This account will be used instead of the default one as the receivable account for the current partner",
required=True)
- property_account_position = fields.Many2one('account.fiscal.position', company_dependent=True,
+ property_account_position_id = fields.Many2one('account.fiscal.position', company_dependent=True,
string="Fiscal Position",
- help="The fiscal position will determine taxes and accounts used for the partner.")
- property_payment_term = fields.Many2one('account.payment.term', company_dependent=True,
+ help="The fiscal position will determine taxes and accounts used for the partner.", oldname="property_account_position")
+ property_payment_term_id = fields.Many2one('account.payment.term', company_dependent=True,
string ='Customer Payment Term',
- help="This payment term will be used instead of the default one for sale orders and customer invoices")
- property_supplier_payment_term = fields.Many2one('account.payment.term', company_dependent=True,
+ help="This payment term will be used instead of the default one for sale orders and customer invoices", oldname="property_payment_term")
+ property_supplier_payment_term_id = fields.Many2one('account.payment.term', company_dependent=True,
string ='Supplier Payment Term',
- help="This payment term will be used instead of the default one for purchase orders and supplier bills")
- ref_companies = fields.One2many('res.company', 'partner_id',
- string='Companies that refers to partner')
+ help="This payment term will be used instead of the default one for purchase orders and supplier bills", oldname="property_supplier_payment_term")
+ ref_company_ids = fields.One2many('res.company', 'partner_id',
+ string='Companies that refers to partner', oldname="ref_companies")
has_unreconciled_entries = fields.Boolean(compute='_compute_has_unreconciled_entries',
help="The partner has at least one unreconciled debit and credit since last time the invoices & payments matching was performed.")
last_time_entries_checked = fields.Datetime(oldname='last_reconciliation_date',
@@ -373,5 +373,5 @@ class ResPartner(models.Model):
@api.model
def _commercial_fields(self):
return super(ResPartner, self)._commercial_fields() + \
- ['debit_limit', 'property_account_payable', 'property_account_receivable', 'property_account_position',
- 'property_payment_term', 'property_supplier_payment_term', 'last_time_entries_checked']
+ ['debit_limit', 'property_account_payable_id', 'property_account_receivable_id', 'property_account_position_id',
+ 'property_payment_term_id', 'property_supplier_payment_term_id', 'last_time_entries_checked']
diff --git a/addons/account/product.py b/addons/account/product.py
index 302bdae9d1e..00e378386ab 100644
--- a/addons/account/product.py
+++ b/addons/account/product.py
@@ -7,12 +7,12 @@ from openerp.exceptions import UserError
class ProductCategory(models.Model):
_inherit = "product.category"
- property_account_income_categ = fields.Many2one('account.account', company_dependent=True,
- string="Income Account",
+ property_account_income_categ_id = fields.Many2one('account.account', company_dependent=True,
+ string="Income Account", oldname="property_account_income_categ",
domain=[('deprecated', '=', False)],
help="This account will be used for invoices to value sales.")
- property_account_expense_categ = fields.Many2one('account.account', company_dependent=True,
- string="Expense Account",
+ property_account_expense_categ_id = fields.Many2one('account.account', company_dependent=True,
+ string="Expense Account", oldname="property_account_expense_categ",
domain=[('deprecated', '=', False)],
help="This account will be used for invoices to value expenses.")
@@ -26,12 +26,12 @@ class ProductTemplate(models.Model):
domain=[('type_tax_use', '=', 'sale')])
supplier_taxes_id = fields.Many2many('account.tax', 'product_supplier_taxes_rel', 'prod_id', 'tax_id', string='Supplier Taxes',
domain=[('type_tax_use', '=', 'purchase')])
- property_account_income = fields.Many2one('account.account', company_dependent=True,
- string="Income Account",
+ property_account_income_id = fields.Many2one('account.account', company_dependent=True,
+ string="Income Account", oldname="property_account_income",
domain=[('deprecated', '=', False)],
help="This account will be used for invoices instead of the default one to value sales for the current product.")
- property_account_expense = fields.Many2one('account.account', company_dependent=True,
- string="Expense Account",
+ property_account_expense_id = fields.Many2one('account.account', company_dependent=True,
+ string="Expense Account", oldname="property_account_expense",
domain=[('deprecated', '=', False)],
help="This account will be used for invoices instead of the default one to value expenses for the current product.")
@@ -54,8 +54,8 @@ class ProductTemplate(models.Model):
@api.multi
def _get_product_accounts(self):
return {
- 'income': self.property_account_income or self.categ_id.property_account_income_categ,
- 'expense': self.property_account_expense or self.categ_id.property_account_expense_categ
+ 'income': self.property_account_income_id or self.categ_id.property_account_income_categ_id,
+ 'expense': self.property_account_expense_id or self.categ_id.property_account_expense_categ_id
}
@api.multi
diff --git a/addons/account/report/account_financial_report.py b/addons/account/report/account_financial_report.py
index 20ce2cf59a0..202627b5883 100644
--- a/addons/account/report/account_financial_report.py
+++ b/addons/account/report/account_financial_report.py
@@ -60,7 +60,7 @@ class account_financial_report(osv.osv):
elif report.type == 'account_type':
# it's the sum the leaf accounts with such an account type
report_types = [x.id for x in report.account_type_ids]
- account_ids = account_obj.search(cr, uid, [('user_type','in', report_types), ('type','!=','view')], context=context)
+ account_ids = account_obj.search(cr, uid, [('user_type_id','in', report_types), ('type','!=','view')], context=context)
for a in account_obj.browse(cr, uid, account_ids, context=context):
for field in field_names:
res[report.id][field] += getattr(a, field)
diff --git a/addons/account/res_config.py b/addons/account/res_config.py
index b1b05ce6bd7..ee981ef634e 100644
--- a/addons/account/res_config.py
+++ b/addons/account/res_config.py
@@ -48,15 +48,15 @@ class AccountConfigSettings(models.TransientModel):
summed and eventually this total tax amount will be rounded. If you sell with tax included,
you should choose 'Round per line' because you certainly want the sum of your tax-included line
subtotals to be equal to the total amount with taxes.""")
- sale_tax = fields.Many2one('account.tax.template', string='Default sale tax')
- purchase_tax = fields.Many2one('account.tax.template', string='Default purchase tax')
+ sale_tax_id = fields.Many2one('account.tax.template', string='Default sale tax', oldname="sale_tax")
+ purchase_tax_id = fields.Many2one('account.tax.template', string='Default purchase tax', oldname="purchase_tax")
sale_tax_rate = fields.Float(string='Sales tax (%)')
purchase_tax_rate = fields.Float(string='Purchase tax (%)')
bank_account_code_char = fields.Char(string='Bank Accounts Code', related='company_id.bank_account_code_char', help='Define the code for the bank account')
template_transfer_account_id = fields.Many2one('account.account.template', help="Intermediary account used when moving money from a liquidity account to another")
transfer_account_id = fields.Many2one('account.account',
related='company_id.transfer_account_id',
- domain=lambda self: [('reconcile', '=', True), ('user_type.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
+ domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id)],
help="Intermediary account used when moving money from a liquidity account to another")
complete_tax_set = fields.Boolean(string='Complete set of taxes',
help='''This boolean helps you to choose if you want to propose to the user to encode
@@ -101,8 +101,8 @@ class AccountConfigSettings(models.TransientModel):
group_proforma_invoices = fields.Boolean(string='Allow pro-forma invoices',
implied_group='account.group_proforma_invoices',
help="Allows you to put invoices in pro-forma state.")
- default_sale_tax = fields.Many2one('account.tax', help="This sale tax will be assigned by default on new products.")
- default_purchase_tax = fields.Many2one('account.tax', help="This purchase tax will be assigned by default on new products.")
+ default_sale_tax_id = fields.Many2one('account.tax', help="This sale tax will be assigned by default on new products.", oldname="default_sale_tax")
+ default_purchase_tax_id = fields.Many2one('account.tax', help="This purchase tax will be assigned by default on new products.", oldname="default_purchase_tax")
group_multi_currency = fields.Boolean(string='Allow multi currencies',
implied_group='base.group_multi_currency',
help="Allows you multi currency environment")
@@ -142,17 +142,17 @@ class AccountConfigSettings(models.TransientModel):
ir_values = self.env['ir.values']
taxes_id = ir_values.get_default('product.template', 'taxes_id', company_id = self.company_id.id)
supplier_taxes_id = ir_values.get_default('product.template', 'supplier_taxes_id', company_id = self.company_id.id)
- self.default_sale_tax = isinstance(taxes_id, list) and taxes_id[0] or taxes_id
- self.default_purchase_tax = isinstance(supplier_taxes_id, list) and supplier_taxes_id[0] or supplier_taxes_id
+ self.default_sale_tax_id = isinstance(taxes_id, list) and taxes_id[0] or taxes_id
+ self.default_purchase_tax_id = isinstance(supplier_taxes_id, list) and supplier_taxes_id[0] or supplier_taxes_id
return {}
@api.onchange('chart_template_id')
def onchange_chart_template_id(self):
tax_templ_obj = self.env['account.tax.template']
- self.complete_tax_set = self.sale_tax = self.purchase_tax = False
+ self.complete_tax_set = self.sale_tax_id = self.purchase_tax_id = False
self.sale_tax_rate = self.purchase_tax_rate = 15
if self.chart_template_id and not self.has_chart_of_accounts:
- # update complete_tax_set, sale_tax and purchase_tax
+ # update complete_tax_set, sale_tax_id and purchase_tax_id
self.complete_tax_set = self.chart_template_id.complete_tax_set
if self.chart_template_id.complete_tax_set:
ir_values_obj = self.env['ir.values']
@@ -163,8 +163,8 @@ class AccountConfigSettings(models.TransientModel):
purchase_tax = tax_templ_obj.search(
[('chart_template_id', '=', self.chart_template_id.id), ('type_tax_use', '=', 'purchase')], limit=1,
order="sequence, id desc")
- self.sale_tax = sale_tax
- self.purchase_tax = purchase_tax
+ self.sale_tax_id = sale_tax
+ self.purchase_tax_id = purchase_tax
if self.chart_template_id.code_digits:
self.code_digits = self.chart_template_id.code_digits
if self.chart_template_id.transfer_account_id:
@@ -205,10 +205,10 @@ class AccountConfigSettings(models.TransientModel):
def set_product_taxes(self):
""" Set the product taxes if they have changed """
ir_values_obj = self.env['ir.values']
- if self.default_sale_tax:
- ir_values_obj.sudo().set_default('product.template', "taxes_id", [self.default_sale_tax.id], for_all_users=True, company_id=self.company_id.id)
- if self.default_purchase_tax:
- ir_values_obj.sudo().set_default('product.template', "supplier_taxes_id", [self.default_purchase_tax.id], for_all_users=True, company_id=self.company_id.id)
+ if self.default_sale_tax_id:
+ ir_values_obj.sudo().set_default('product.template', "taxes_id", [self.default_sale_tax_id.id], for_all_users=True, company_id=self.company_id.id)
+ if self.default_purchase_tax_id:
+ ir_values_obj.sudo().set_default('product.template', "supplier_taxes_id", [self.default_purchase_tax_id.id], for_all_users=True, company_id=self.company_id.id)
@api.multi
def set_chart_of_accounts(self):
@@ -221,8 +221,8 @@ class AccountConfigSettings(models.TransientModel):
'chart_template_id': self.chart_template_id.id,
'transfer_account_id': self.template_transfer_account_id.id,
'code_digits': self.code_digits or 6,
- 'sale_tax': self.sale_tax.id,
- 'purchase_tax': self.purchase_tax.id,
+ 'sale_tax_id': self.sale_tax_id.id,
+ 'purchase_tax_id': self.purchase_tax_id.id,
'sale_tax_rate': self.sale_tax_rate,
'purchase_tax_rate': self.purchase_tax_rate,
'complete_tax_set': self.complete_tax_set,
diff --git a/addons/account/test/account_bank_statement.yml b/addons/account/test/account_bank_statement.yml
index d759bf9b8e4..1b86e274148 100644
--- a/addons/account/test/account_bank_statement.yml
+++ b/addons/account/test/account_bank_statement.yml
@@ -29,7 +29,7 @@
-
!python {model: account.bank.statement.line}: |
import time
- account_id = self.pool.get('account.account').search(cr, uid, [('user_type.type', '=', 'liquidity'), ('currency_id', '=', False)])[0]
+ account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id.type', '=', 'liquidity'), ('currency_id', '=', False)])[0]
vals = {
'amount': 1000,
'date': time.strftime('%Y-%m-%d'),
diff --git a/addons/account/test/account_invoice_state.yml b/addons/account/test/account_invoice_state.yml
index fe74b0d2377..84f1533b237 100644
--- a/addons/account/test/account_invoice_state.yml
+++ b/addons/account/test/account_invoice_state.yml
@@ -38,7 +38,7 @@
I check the journal associated and put this journal as not
-
!python {model: account.invoice, id: account_invoice_state}: |
- moves = self.env['account.move.line'].search([('invoice', '=', self.id)])
+ moves = self.env['account.move.line'].search([('invoice_id', '=', self.id)])
assert (len(moves) > 0), 'You should have multiple moves'
moves[0].journal_id.write({'update_posted': True})
-
@@ -57,4 +57,4 @@
I check that customer invoice is in the cancel state
-
!assert {model: account.invoice, id: account_invoice_state}:
- - state == 'cancel' \ No newline at end of file
+ - state == 'cancel'
diff --git a/addons/account/test/account_minimal_test.xml b/addons/account/test/account_minimal_test.xml
index 667f535fce6..d154227d63c 100644
--- a/addons/account/test/account_minimal_test.xml
+++ b/addons/account/test/account_minimal_test.xml
@@ -19,100 +19,100 @@
<record id="xfa" model="account.account">
<field name="code">X1000</field>
<field name="name">Fixed Assets - (test)</field>
- <field name="user_type" ref="account.data_account_type_fixed_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_fixed_assets"/>
</record>
<record id="cas" model="account.account">
<field name="code">X1010</field>
<field name="name">Current Assets - (test)</field>
- <field name="user_type" ref="account.data_account_type_current_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_current_assets"/>
</record>
<record id="stk" model="account.account">
<field name="code">X1011</field>
<field name="name">Purchased Stocks - (test)</field>
- <field name="user_type" ref="account.data_account_type_current_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_current_assets"/>
<field name="tag_ids" eval="[(6,0,[ref('account.demo_stock_account')])]"/>
</record>
<record id="a_recv" model="account.account">
<field name="code">X1012</field>
<field name="name">Debtors - (test)</field>
<field eval="True" name="reconcile"/>
- <field name="user_type" ref="account.data_account_type_receivable"/>
+ <field name="user_type_id" ref="account.data_account_type_receivable"/>
</record>
<record id="ova" model="account.account">
<field name="code">X1013</field>
<field name="name">VAT Paid- (test)</field>
- <field name="user_type" ref="account.data_account_type_current_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_current_assets"/>
</record>
<record id="bnk" model="account.account">
<field name="code">X1014</field>
<field name="name">Bank Current Account - (test)</field>
- <field name="user_type" ref="account.data_account_type_liquidity"/>
+ <field name="user_type_id" ref="account.data_account_type_liquidity"/>
</record>
<record id="cash" model="account.account">
<field name="code">X1015</field>
<field name="name">Cash - (test)</field>
- <field name="user_type" ref="account.data_account_type_liquidity"/>
+ <field name="user_type_id" ref="account.data_account_type_liquidity"/>
</record>
<record id="o_income" model="account.account">
<field name="code">X1016</field>
<field name="name">Opening Income - (test)</field>
- <field name="user_type" ref="account.data_account_type_other_income"/>
+ <field name="user_type_id" ref="account.data_account_type_other_income"/>
</record>
<record id="usd_bnk" model="account.account">
<field name="code">X1017</field>
<field name="name">USD Bank Account - (test)</field>
- <field name="user_type" ref="account.data_account_type_liquidity"/>
+ <field name="user_type_id" ref="account.data_account_type_liquidity"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record id="transfer_account" model="account.account">
<field name="code">X1019</field>
<field name="name">Internal Transfert Account - (test)</field>
- <field name="user_type" ref="account.data_account_type_current_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_current_assets"/>
<field name="reconcile">1</field>
</record>
<record id="ncas" model="account.account">
<field name="code">X1020</field>
<field name="name">Non-current Assets - (test)</field>
- <field name="user_type" ref="account.data_account_type_non_current_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_non_current_assets"/>
</record>
<record id="prepayements" model="account.account">
<field name="code">X1030</field>
<field name="name">Prepayments - (test)</field>
- <field name="user_type" ref="account.data_account_type_prepayments"/>
+ <field name="user_type_id" ref="account.data_account_type_prepayments"/>
</record>
<record id="current_liabilities" model="account.account">
<field name="code">X1110</field>
<field name="name">Current Liabilities - (test)</field>
- <field name="user_type" ref="account.data_account_type_current_liabilities"/>
+ <field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
</record>
<record id="a_pay" model="account.account">
<field name="code">X1111</field>
<field name="name">Creditors - (test)</field>
<field eval="True" name="reconcile"/>
- <field name="user_type" ref="account.data_account_type_payable"/>
+ <field name="user_type_id" ref="account.data_account_type_payable"/>
</record>
<record id="iva" model="account.account">
<field name="code">X1112</field>
<field name="name">VAT Received - (test)</field>
- <field name="user_type" ref="account.data_account_type_current_liabilities"/>
+ <field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
</record>
<record id="rsa" model="account.account">
<field name="code">X1113</field>
<field name="name">Reserve and Profit/Loss - (test)</field>
- <field name="user_type" ref="account.data_account_type_current_liabilities"/>
+ <field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
</record>
<record id="cas" model="account.account">
<field name="code">X1120</field>
<field name="name">Non-current Liabilities - (test)</field>
- <field name="user_type" ref="account.data_account_type_non_current_liabilities"/>
+ <field name="user_type_id" ref="account.data_account_type_non_current_liabilities"/>
</record>
<record id="o_expense" model="account.account">
<field name="code">X1114</field>
<field name="name">Opening Expense - (test)</field>
- <field name="user_type" ref="account.data_account_type_expenses"/>
+ <field name="user_type_id" ref="account.data_account_type_expenses"/>
</record>
<!-- Profit and Loss -->
@@ -120,95 +120,95 @@
<record model="account.account" id="income_fx_income">
<field name="name">Foreign Exchange Gain - (test)</field>
<field name="code">X2010</field>
- <field name="user_type" ref="account.data_account_type_revenue"/>
+ <field name="user_type_id" ref="account.data_account_type_revenue"/>
<field name="reconcile" eval="False"/>
</record>
<record id="a_sale" model="account.account">
<field name="code">X2020</field>
<field name="name">Product Sales - (test)</field>
- <field name="user_type" ref="account.data_account_type_revenue"/>
+ <field name="user_type_id" ref="account.data_account_type_revenue"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_operating')])]"/>
</record>
<record id="a_sale_invest" model="account.account">
<field name="code">X2021</field>
<field name="name">Sale of Lands - (test)</field>
- <field name="user_type" ref="account.data_account_type_revenue"/>
+ <field name="user_type_id" ref="account.data_account_type_revenue"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_investing')])]"/>
</record>
<record id="a_sale_finance" model="account.account">
<field name="code">X2022</field>
<field name="name">Bank Accounts Interests - (test)</field>
- <field name="user_type" ref="account.data_account_type_revenue"/>
+ <field name="user_type_id" ref="account.data_account_type_revenue"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_financing')])]"/>
</record>
<record id="cog" model="account.account">
<field name="code">X2030</field>
<field name="name">Cost of Goods Sold - (test)</field>
- <field name="user_type" ref="account.data_account_type_direct_costs"/>
+ <field name="user_type_id" ref="account.data_account_type_direct_costs"/>
</record>
<record model="account.account" id="income_fx_expense">
<field name="name">Foreign Exchange Loss - (test)</field>
<field name="code">X2110</field>
- <field name="user_type" ref="account.data_account_type_expenses"/>
+ <field name="user_type_id" ref="account.data_account_type_expenses"/>
<field name="reconcile" eval="False"/>
</record>
<record id="a_expense" model="account.account">
<field name="code">X2120</field>
<field name="name">Expenses - (test)</field>
- <field name="user_type" ref="account.data_account_type_expenses"/>
+ <field name="user_type_id" ref="account.data_account_type_expenses"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_operating')])]"/>
</record>
<record id="a_salary_expense" model="account.account">
<field name="code">X2121</field>
<field name="name">Salary Expenses - (test)</field>
- <field name="user_type" ref="account.data_account_type_expenses"/>
+ <field name="user_type_id" ref="account.data_account_type_expenses"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_operating')])]"/>
</record>
<record id="a_expense_invest" model="account.account">
<field name="code">X2122</field>
<field name="name">Purchase of Equipments - (test)</field>
- <field name="user_type" ref="account.data_account_type_fixed_assets"/>
+ <field name="user_type_id" ref="account.data_account_type_fixed_assets"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_investing')])]"/>
</record>
<record id="a_expense_finance" model="account.account">
<field name="code">X2123</field>
<field name="name">Bank Fees - (test)</field>
- <field name="user_type" ref="account.data_account_type_expenses"/>
+ <field name="user_type_id" ref="account.data_account_type_expenses"/>
<field name="tag_ids" eval="[(6,0,[ref('account.account_tag_financing')])]"/>
</record>
<record id="a_capital" model="account.account">
<field name="code">X3001</field>
<field name="name">Capital</field>
- <field name="user_type" ref="account.data_account_type_equity"/>
+ <field name="user_type_id" ref="account.data_account_type_equity"/>
</record>
<record id="a_dividends" model="account.account">
<field name="code">X3002</field>
<field name="name">Dividends</field>
- <field name="user_type" ref="account.data_account_type_equity"/>
+ <field name="user_type_id" ref="account.data_account_type_equity"/>
</record>
<record id="a_current_year_earnings" model="account.account">
<field name="code">X0000</field>
<field name="name">Unaffected Earnings</field>
- <field name="user_type" ref="account.data_unaffected_earnings"/>
+ <field name="user_type_id" ref="account.data_unaffected_earnings"/>
</record>
<!-- Properties -->
- <record forcecreate="True" id="property_account_receivable" model="ir.property">
- <field name="name">property_account_receivable</field>
- <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_receivable')]"/>
+ <record forcecreate="True" id="property_account_receivable_id" model="ir.property">
+ <field name="name">property_account_receivable_id</field>
+ <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_receivable_id')]"/>
<field eval="'account.account,'+str(a_recv)" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
- <record forcecreate="True" id="property_account_payable" model="ir.property">
- <field name="name">property_account_payable</field>
- <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_payable')]"/>
+ <record forcecreate="True" id="property_account_payable_id" model="ir.property">
+ <field name="name">property_account_payable_id</field>
+ <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_payable_id')]"/>
<field eval="'account.account,'+str(a_pay)" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
- <record forcecreate="True" id="property_account_position" model="ir.property">
- <field name="name">property_account_position</field>
- <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_position')]"/>
+ <record forcecreate="True" id="property_account_position_id" model="ir.property">
+ <field name="name">property_account_position_id</field>
+ <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_position_id')]"/>
<field eval="False" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
@@ -286,15 +286,15 @@
Product income and expense accounts, default parameters
-->
- <record id="property_account_expense_categ" model="ir.property">
- <field name="name">property_account_expense_categ</field>
- <field name="fields_id" search="[('model','=','product.category'),('name','=','property_account_expense_categ')]"/>
+ <record id="property_account_expense_categ_id" model="ir.property">
+ <field name="name">property_account_expense_categ_id</field>
+ <field name="fields_id" search="[('model','=','product.category'),('name','=','property_account_expense_categ_id')]"/>
<field eval="'account.account,'+str(ref('a_expense'))" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
- <record id="property_account_income_categ" model="ir.property">
- <field name="name">property_account_income_categ</field>
- <field name="fields_id" search="[('model','=','product.category'),('name','=','property_account_income_categ')]"/>
+ <record id="property_account_income_categ_id" model="ir.property">
+ <field name="name">property_account_income_categ_id</field>
+ <field name="fields_id" search="[('model','=','product.category'),('name','=','property_account_income_categ_id')]"/>
<field eval="'account.account,'+str(ref('a_sale'))" model="account.account" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
diff --git a/addons/account/tests/test_account_customer_invoice.py b/addons/account/tests/test_account_customer_invoice.py
index 1ce28c8bdc7..0b79b47a0d9 100644
--- a/addons/account/tests/test_account_customer_invoice.py
+++ b/addons/account/tests/test_account_customer_invoice.py
@@ -24,13 +24,13 @@ class TestAccountCustomerInvoice(AccountTestUsers):
self.journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0]
self.partner3 = self.env.ref('base.res_partner_3')
account_user_type = self.env.ref('account.data_account_type_receivable')
- self.ova = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_current_assets').id)])[0]
+ self.ova = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_current_assets').id)], limit=1)
#only adviser can create an account
self.account_rec1_id = self.account_model.sudo(self.account_manager.id).create(dict(
code="cust_acc",
name="customer account",
- user_type=account_user_type.id,
+ user_type_id=account_user_type.id,
reconcile=True,
))
@@ -39,7 +39,7 @@ class TestAccountCustomerInvoice(AccountTestUsers):
{
'product_id': self.env.ref('product.product_product_5').id,
'quantity': 10.0,
- 'account_id': self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_revenue').id)])[0].id,
+ 'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
'name': 'product test 5',
'price_unit': 100.00,
}
diff --git a/addons/account/tests/test_account_supplier_invoice.py b/addons/account/tests/test_account_supplier_invoice.py
index 2c76dc7a13c..e8531700be4 100644
--- a/addons/account/tests/test_account_supplier_invoice.py
+++ b/addons/account/tests/test_account_supplier_invoice.py
@@ -16,8 +16,8 @@ class TestAccountSupplierInvoice(AccountingTestCase):
})
# Should be changed by automatic on_change later
- invoice_account = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_receivable').id)])[0].id
- invoice_line_account = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_expenses').id)])[0].id
+ invoice_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1).id
+ invoice_line_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_expenses').id)], limit=1).id
invoice = self.env['account.invoice'].create({'partner_id': self.env.ref('base.res_partner_2').id,
'account_id': invoice_account,
diff --git a/addons/account/tests/test_account_validate_account_move.py b/addons/account/tests/test_account_validate_account_move.py
index 0745ee422b7..e5265ead8e2 100644
--- a/addons/account/tests/test_account_validate_account_move.py
+++ b/addons/account/tests/test_account_validate_account_move.py
@@ -4,7 +4,7 @@ class TestAccountValidateAccount(AccountingTestCase):
def test_account_validate_account(self):
account_move_line = self.env['account.move.line']
- account_cash = self.env['account.account'].search([('user_type.type', '=', 'liquidity')], limit=1)
+ account_cash = self.env['account.account'].search([('user_type_id.type', '=', 'liquidity')], limit=1)
journal = self.env['account.journal'].search([('type', '=', 'bank')], limit=1)
company_id = self.env['res.users'].browse(self.env.uid).company_id.id
diff --git a/addons/account/tests/test_bank_statement_reconciliation.py b/addons/account/tests/test_bank_statement_reconciliation.py
index cb7b55a371f..b31150db953 100644
--- a/addons/account/tests/test_bank_statement_reconciliation.py
+++ b/addons/account/tests/test_bank_statement_reconciliation.py
@@ -35,7 +35,7 @@ class TestBankStatementReconciliation(AccountingTestCase):
self.assertTrue(rec_move)
counterpart_mv_line = None
for l in rec_move.line_ids:
- if l.account_id.user_type.type == 'receivable':
+ if l.account_id.user_type_id.type == 'receivable':
counterpart_mv_line = l
break
self.assertIsNotNone(counterpart_mv_line)
@@ -64,7 +64,7 @@ class TestBankStatementReconciliation(AccountingTestCase):
'price_unit': amount,
'invoice_id': invoice.id,
'name': '.',
- 'account_id': self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_revenue').id)])[0].id,
+ 'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
})
invoice.signal_workflow('invoice_open')
diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py
index 95853964b0c..fba65d6f54c 100644
--- a/addons/account/tests/test_payment.py
+++ b/addons/account/tests/test_payment.py
@@ -22,9 +22,9 @@ class TestPayment(AccountingTestCase):
self.payment_method_manual_in = self.env.ref("account.account_payment_method_manual_in")
self.payment_method_manual_out = self.env.ref("account.account_payment_method_manual_out")
- self.account_receivable = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_receivable').id)])[0]
- self.account_payable = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_payable').id)])[0]
- self.account_revenue = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_revenue').id)])[0]
+ self.account_receivable = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1)
+ self.account_payable = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_payable').id)], limit=1)
+ self.account_revenue = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1)
self.bank_euro = self.env['res.partner.bank'].create({'acc_number': '0123456789', 'bank_name': 'Test Bank', 'company_id': self.env.user.company_id.id})
self.bank_journal_euro = self.bank_euro.journal_id
@@ -126,7 +126,7 @@ class TestPayment(AccountingTestCase):
register_payments = self.register_payments_model.with_context(ctx).create({
'payment_date': time.strftime('%Y') + '-07-15',
'journal_id': self.bank_journal_euro.id,
- 'payment_method': self.payment_method_manual_in.id,
+ 'payment_method_id': self.payment_method_manual_in.id,
})
register_payments.create_payment()
payment = self.payment_model.search([], order="id desc", limit=1)
@@ -158,7 +158,7 @@ class TestPayment(AccountingTestCase):
'currency_id': self.currency_usd_id,
'journal_id': self.bank_journal_usd.id,
'destination_journal_id': self.bank_journal_euro.id,
- 'payment_method': self.payment_method_manual_out.id,
+ 'payment_method_id': self.payment_method_manual_out.id,
})
payment.post()
self.check_journal_items(payment.move_line_ids, [
@@ -177,11 +177,11 @@ class TestPayment(AccountingTestCase):
'journal_id': self.bank_journal_usd.id,
'partner_type': 'supplier',
'partner_id': self.partner_axelor.id,
- 'payment_method': self.payment_method_manual_out.id,
+ 'payment_method_id': self.payment_method_manual_out.id,
})
payment.post()
self.check_journal_items(payment.move_line_ids, [
{'account_id': self.account_usd.id, 'debit': 0.0, 'credit': 38.21, 'amount_currency': -58.42, 'currency_id': self.currency_usd_id},
- {'account_id': self.partner_axelor.property_account_payable.id, 'debit': 38.21, 'credit': 0.0, 'amount_currency': 50, 'currency_id': self.currency_chf_id},
+ {'account_id': self.partner_axelor.property_account_payable_id.id, 'debit': 38.21, 'credit': 0.0, 'amount_currency': 50, 'currency_id': self.currency_chf_id},
])
diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py
index 056232e701d..cb69a12e12e 100644
--- a/addons/account/tests/test_reconciliation.py
+++ b/addons/account/tests/test_reconciliation.py
@@ -21,8 +21,8 @@ class TestReconciliation(AccountingTestCase):
self.currency_usd_id = self.env.ref("base.USD").id
self.currency_euro_id = self.env.ref("base.EUR").id
self.env.ref('base.main_company').write({'currency_id': self.currency_euro_id})
- self.account_rcv = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_receivable').id)])[0]
- self.account_rsa = self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_payable').id)])[0]
+ self.account_rcv = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1)
+ self.account_rsa = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_payable').id)], limit=1)
self.product = self.env.ref("product.product_product_4")
self.bank_euro = self.env['res.partner.bank'].create({'acc_number': 'Reconciliation test', 'bank_name': 'Test Bank', 'company_id': self.env.user.company_id.id})
@@ -53,7 +53,7 @@ class TestReconciliation(AccountingTestCase):
'price_unit': 100,
'invoice_id': invoice.id,
'name': 'product that cost 100',
- 'account_id': self.env['account.account'].search([('user_type', '=', self.env.ref('account.data_account_type_revenue').id)])[0].id,
+ 'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
})
#validate invoice
diff --git a/addons/account/tests/test_search.py b/addons/account/tests/test_search.py
index f79e368d9c2..eb94a9bd910 100644
--- a/addons/account/tests/test_search.py
+++ b/addons/account/tests/test_search.py
@@ -14,21 +14,21 @@ class TestSearch(AccountTestUsers):
self.atax = self.account_model.create(dict(
name="Tax Received",
code="X121",
- user_type=ac_ids.id,
+ user_type_id=ac_ids.id,
reconcile=True,
)).id, "X121 Tax Received"
self.apurchase = self.account_model.create(dict(
name="Purchased Stocks",
code="X1101",
- user_type=ac_ids.id,
+ user_type_id=ac_ids.id,
reconcile=True,
)).id, "X1101 Purchased Stocks"
self.asale = self.account_model.create(dict(
name="Product Sales",
code="XX200",
- user_type=ac_ids.id,
+ user_type_id=ac_ids.id,
reconcile=True,
)).id, "XX200 Product Sales"
@@ -56,16 +56,15 @@ class TestSearch(AccountTestUsers):
self.assertEqual(set([self.asale[0]]), set([a[0] for a in asale_ids]), "name_search 'ilike XX200' should have returned Product Sales account only")
def test_property_unset_search(self):
- cr, uid = self.cr, self.uid
- res_partner_model = self.registry('res.partner')
- account_payment_term_model = self.registry('account.payment.term')
+ res_partner_model = self.env['res.partner']
+ account_payment_term_model = self.env['account.payment.term']
- a_partner = res_partner_model.create(cr, uid, {'name': 'test partner'})
- a_payment_term = account_payment_term_model.create(cr, uid, {'name': 'test payment term'})
+ a_partner = res_partner_model.create({'name': 'test partner'})
+ a_payment_term = account_payment_term_model.create({'name': 'test payment term'})
- partner_ids = res_partner_model.search(cr, uid, [('property_payment_term', '=', False), ('id', '=', a_partner)])
- self.assertTrue(partner_ids, "unset property field 'propety_payment_term' should have been found")
+ partners = res_partner_model.search([('property_payment_term_id', '=', False), ('id', '=', a_partner.id)])
+ self.assertTrue(partners, "unset property field 'propety_payment_term' should have been found")
- res_partner_model.write(cr, uid, [a_partner], {'property_payment_term': a_payment_term})
- partner_ids = res_partner_model.search(cr, uid, [('property_payment_term', '=', False), ('id', '=', a_partner)])
- self.assertFalse(partner_ids, "set property field 'propety_payment_term' should not have been found")
+ a_partner.write({'property_payment_term_id': a_payment_term})
+ partners = res_partner_model.search([('property_payment_term_id', '=', False), ('id', '=', a_partner.id)])
+ self.assertFalse(partners, "set property field 'propety_payment_term' should not have been found")
diff --git a/addons/account/tests/test_tax.py b/addons/account/tests/test_tax.py
index bb036b22ab8..2b9e11045e9 100644
--- a/addons/account/tests/test_tax.py
+++ b/addons/account/tests/test_tax.py
@@ -45,7 +45,7 @@ class TestTax(AccountTestUsers):
})
self.bank_journal = self.env['account.journal'].search([('type', '=', 'bank'), ('company_id', '=', self.account_manager.company_id.id)])[0]
self.bank_account = self.bank_journal.default_debit_account_id
- self.expense_account = self.env['account.account'].search([('user_type.type', '=', 'payable')])[0] #Should be done by onchange later
+ self.expense_account = self.env['account.account'].search([('user_type_id.type', '=', 'payable')], limit=1) #Should be done by onchange later
def test_tax_group(self):
res = self.group_tax.compute_all(200.0)
diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml
index 92ccc306cdb..2fc95ac6ae4 100644
--- a/addons/account/views/account_invoice_view.xml
+++ b/addons/account/views/account_invoice_view.xml
@@ -455,7 +455,7 @@
<field name="journal_id" groups="account.group_account_user"
options="{'no_create': True}" attrs="{'readonly':[('move_name','!=',False)]}"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
- <field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id" invisible="1"/>
+ <field domain="[('partner_id.ref_company_ids', 'in', [company_id])]" name="partner_bank_id" invisible="1"/>
<field name="date_due"/>
</group>
<group>
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml
index 0ff503e29fe..415d55d7d1f 100644
--- a/addons/account/views/account_payment_view.xml
+++ b/addons/account/views/account_payment_view.xml
@@ -10,7 +10,7 @@
<field name="payment_date"/>
<field name="name"/>
<field name="journal_id"/>
- <field name="payment_method"/>
+ <field name="payment_method_id"/>
<field name="partner_id" string="Customer"/>
<field name="amount"/>
<field name="state"/>
@@ -29,7 +29,7 @@
<field name="payment_date"/>
<field name="name"/>
<field name="journal_id"/>
- <field name="payment_method"/>
+ <field name="payment_method_id"/>
<field name="partner_id" string="Supplier"/>
<field name="amount"/>
<field name="company_id" groups="base.group_multi_company"/>
@@ -61,7 +61,7 @@
<separator/>
<filter string="Partner" domain="[]" context="{'group_by': 'partner_id'}"/>
<filter string="Journal" domain="[]" context="{'group_by': 'journal_id'}"/>
- <filter string="Payment Method" domain="[]" context="{'group_by': 'payment_method'}"/>
+ <filter string="Payment Method" domain="[]" context="{'group_by': 'payment_method_id'}"/>
<filter string="State" domain="[]" context="{'group_by': 'state'}"/>
<filter string="Currency" domain="[]" context="{'group_by': 'currency_id'}" groups="base.group_multi_currency"/>
<filter string="Company" domain="[]" context="{'group_by': 'company_id'}" groups="base.group_multi_company"/>
@@ -102,7 +102,7 @@
<field name="journal_id" widget="selection" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="destination_journal_id" widget="selection" attrs="{'required': [('payment_type', '=', 'transfer')], 'invisible': [('payment_type', '!=', 'transfer')], 'readonly': [('state', '!=', 'draft')]}"/>
<field name="hide_payment_method" invisible="1"/>
- <field name="payment_method" string=" " widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/>
+ <field name="payment_method_id" string=" " widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/>
<field name="payment_method_code" invisible="1"/>
<label for="amount"/>
<div name="amount_div" class="o_row">
@@ -186,7 +186,7 @@
<group>
<field name="journal_id" widget="selection"/>
<field name="hide_payment_method" invisible="1"/>
- <field name="payment_method" widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
+ <field name="payment_method_id" widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
<field name="payment_method_code" invisible="1"/>
<label for="amount"/>
<div name="amount_div">
@@ -204,7 +204,7 @@
<field name="payment_difference"/>
<field name="payment_difference_handling" widget="radio" nolabel="1"/>
</div>
- <field name="writeoff_account" attrs="{'required': [('payment_difference_handling', '=', 'reconcile')], 'invisible': [('payment_difference_handling', '!=', 'reconcile')]}"/>
+ <field name="writeoff_account_id" attrs="{'required': [('payment_difference_handling', '=', 'reconcile')], 'invisible': [('payment_difference_handling', '!=', 'reconcile')]}"/>
</group>
</group>
</sheet>
@@ -242,7 +242,7 @@
<group>
<field name="journal_id" widget="selection"/>
<field name="hide_payment_method" invisible="1"/>
- <field name="payment_method" widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
+ <field name="payment_method_id" widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
<field name="payment_method_code" invisible="1"/>
<field name="amount"/>
<field name="currency_id" invisible="1"/>
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index 0eeadb1940e..77036a4d669 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -17,7 +17,7 @@
<group>
<field name="code" string="Account code"/> -
<field name="name" string="Account name"/>
- <field name="user_type" widget="selection"/>
+ <field name="user_type_id" widget="selection"/>
<field name="tax_ids" widget="many2many_tags"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
@@ -104,7 +104,7 @@
<tree string="Chart of accounts" toolbar="1" >
<field name="code"/>
<field name="name"/>
- <field name="user_type"/>
+ <field name="user_type_id"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</tree>
@@ -118,9 +118,9 @@
<field name="name" filter_domain="['|', ('name','ilike',self), ('code','=like',str(self)+'%')]" string="Account"/>
<filter icon="terp-sale" string="Receivable Accounts" domain="[('internal_type','=','receivable')]"/>
<filter icon="terp-purchase" string="Payable Accounts" domain="[('internal_type','=','payable')]"/>
- <field name="user_type"/>
+ <field name="user_type_id"/>
<group expand="0" string="Group By">
- <filter string="Account Type" icon="terp-stock_symbol-selection" domain="" context="{'group_by':'user_type'}"/>
+ <filter string="Account Type" icon="terp-stock_symbol-selection" domain="" context="{'group_by':'user_type_id'}"/>
</group>
</search>
</field>
@@ -171,7 +171,7 @@
<act_window
id="action_move_line_select_by_type"
name="Journal Items"
- context="{'search_default_user_type': [active_id]}"
+ context="{'search_default_user_type_id': [active_id]}"
res_model="account.move.line"
src_model="account.account.type"/>
@@ -268,8 +268,8 @@
<field name="account_control_ids" widget="many2many_tags"/>
</group>
<group>
- <field name="inbound_payment_methods" widget="many2many_checkboxes" attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"/>
- <field name="outbound_payment_methods" widget="many2many_checkboxes" attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"/>
+ <field name="inbound_payment_method_ids" widget="many2many_checkboxes" attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"/>
+ <field name="outbound_payment_method_ids" widget="many2many_checkboxes" attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"/>
<field name="refund_sequence" attrs="{'invisible': [('type', 'not in', ['sale', 'purchase'])]}"/>
<field name="group_invoice_lines" attrs="{'invisible': [('type', 'not in', ['sale', 'purchase'])]}"/>
<field name="profit_account_id" attrs="{'invisible': [('type', '!=', 'cash')]}"/>
@@ -1002,7 +1002,7 @@
<field name="narration" colspan="4" nolabel="1" placeholder="Add an internal note..."/>
</page>
<page string="Analytic Lines" groups="analytic.group_analytic_accounting">
- <field name="analytic_lines" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
+ <field name="analytic_line_ids" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
</page>
</notebook>
</sheet>
@@ -1048,7 +1048,7 @@
</group>
</page>
<page string="Analytic Lines" groups="analytic.group_analytic_accounting">
- <field name="analytic_lines"/>
+ <field name="analytic_line_ids"/>
</page>
</notebook>
</form>
@@ -1411,7 +1411,7 @@
<field name="name"/>
<field name="code"/>
<newline/>
- <field name="user_type" widget="selection"/>
+ <field name="user_type_id" widget="selection"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
<field name="tag_ids" domain="[('applicability', '!=', 'taxes')]" widget="many2many_tags" context="{'default_applicability': 'accounts'}"/>
<field name="reconcile"/>
@@ -1431,7 +1431,7 @@
<tree string="Account Template">
<field name="code"/>
<field name="name"/>
- <field name="user_type" invisible="1"/>
+ <field name="user_type_id" invisible="1"/>
</tree>
</field>
</record>
@@ -1441,9 +1441,9 @@
<field name="arch" type="xml">
<search string="Search Account Templates">
<field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Account Template"/>
- <field name="user_type"/>
+ <field name="user_type_id"/>
<group expand="0" string="Group By">
- <filter string="Account Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'user_type'}"/>
+ <filter string="Account Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'user_type_id'}"/>
</group>
</search>
</field>
@@ -1476,12 +1476,12 @@
<field name="tax_template_ids" colspan="4" nolabel="1"/>
<separator string="Properties" colspan="4"/>
<group col="4">
- <field name="property_account_receivable"/>
- <field name="property_account_payable"/>
- <field name="property_account_expense_categ"/>
- <field name="property_account_income_categ"/>
- <field name="property_account_expense"/>
- <field name="property_account_income"/>
+ <field name="property_account_receivable_id"/>
+ <field name="property_account_payable_id"/>
+ <field name="property_account_expense_categ_id"/>
+ <field name="property_account_income_categ_id"/>
+ <field name="property_account_expense_id"/>
+ <field name="property_account_income_id"/>
</group>
</form>
</field>
@@ -1495,10 +1495,10 @@
<field name="bank_account_code_char"/>
<group expand="0" string="Group By">
<filter string="Bank Account" icon="terp-folder-orange" domain="[]" context="{'group_by':'bank_account_code_char'}"/>
- <filter string="Receivable Account" icon="terp-sale" domain="[]" context="{'group_by':'property_account_receivable'}"/>
- <filter string="Payable Account" icon="terp-purchase" domain="[]" context="{'group_by':'property_account_payable'}"/>
- <filter string="Income Account" icon="terp-sale" domain="[]" context="{'group_by':'property_account_income_categ'}"/>
- <filter string="Expense Account" icon="terp-purchase" domain="[]" context="{'group_by':'property_account_expense_categ'}"/>
+ <filter string="Receivable Account" icon="terp-sale" domain="[]" context="{'group_by':'property_account_receivable_id'}"/>
+ <filter string="Payable Account" icon="terp-purchase" domain="[]" context="{'group_by':'property_account_payable_id'}"/>
+ <filter string="Income Account" icon="terp-sale" domain="[]" context="{'group_by':'property_account_income_categ_id'}"/>
+ <filter string="Expense Account" icon="terp-purchase" domain="[]" context="{'group_by':'property_account_expense_categ_id'}"/>
</group>
</search>
</field>
@@ -1511,10 +1511,10 @@
<field name="name"/>
<field name="company_id"/>
<field name="bank_account_code_char"/>
- <field name="property_account_receivable" invisible="1"/>
- <field name="property_account_payable" invisible="1"/>
- <field name="property_account_expense_categ" invisible="1"/>
- <field name="property_account_income_categ" invisible="1"/>
+ <field name="property_account_receivable_id" invisible="1"/>
+ <field name="property_account_payable_id" invisible="1"/>
+ <field name="property_account_expense_categ_id" invisible="1"/>
+ <field name="property_account_income_categ_id" invisible="1"/>
</tree>
</field>
</record>
@@ -1636,12 +1636,12 @@
<field name="company_id" options="{'no_create': True}"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
<field name="currency_id" class="oe_inline"/>
<field name="use_anglo_saxon"/>
- <field name="sale_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','=','sale')]"/>
+ <field name="sale_tax_id" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','=','sale')]"/>
<label for="sale_tax_rate" string="Sale Tax" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
<div attrs="{'invisible': [('complete_tax_set', '=', True)]}">
<field name="sale_tax_rate" class="oe_inline"/> %%
</div>
- <field name="purchase_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','=','purchase')]"/>
+ <field name="purchase_tax_id" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','=','purchase')]"/>
<label for="purchase_tax_rate" string="Purchase Tax" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
<div attrs="{'invisible': [('complete_tax_set', '=', True)]}">
<field name="purchase_tax_rate" class="oe_inline"/> %%
diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml
index febcb551a59..9c00d0481cd 100644
--- a/addons/account/views/partner_view.xml
+++ b/addons/account/views/partner_view.xml
@@ -139,21 +139,21 @@
<group>
<group string="Sale" name="acc_sale">
<button name="%(action_account_partner_followup_note)d" class="oe_link" type="action" string="Log a followup note" colspan="2"/>
- <field name="property_payment_term" widget="selection"/>
+ <field name="property_payment_term_id" widget="selection"/>
<field name="credit"/>
<field name="credit_limit"/>
</group>
<group string="Purchase" name="acc_purchase">
- <field name="property_supplier_payment_term" widget="selection"/>
+ <field name="property_supplier_payment_term_id" widget="selection"/>
<field name="debit"/>
<field name="currency_id" invisible="1"/>
</group>
<group string="Fiscal Information" name="fiscal_information">
- <field name="property_account_position" widget="selection"/>
+ <field name="property_account_position_id" widget="selection"/>
</group>
<group string="Accounting Entries" name="accounting_entries">
- <field name="property_account_receivable" groups="account.group_account_invoice" />
- <field name="property_account_payable" groups="account.group_account_invoice"/>
+ <field name="property_account_receivable_id" groups="account.group_account_invoice" />
+ <field name="property_account_payable_id" groups="account.group_account_invoice"/>
</group>
</group>
<group string="Bank Accounts" name="bank_accounts">
diff --git a/addons/account/views/product_view.xml b/addons/account/views/product_view.xml
index 87f964cd2a7..91bab738f0a 100644
--- a/addons/account/views/product_view.xml
+++ b/addons/account/views/product_view.xml
@@ -15,11 +15,11 @@
</group>
<group name="properties">
<group>
- <field name="property_account_income" domain="[('internal_type','=','other'),('deprecated','=',False)]" groups="account.group_account_user"/>
+ <field name="property_account_income_id" domain="[('internal_type','=','other'),('deprecated','=',False)]" groups="account.group_account_user"/>
<field name="taxes_id" colspan="2" widget="many2many_tags"/>
</group>
<group>
- <field name="property_account_expense" domain="[('internal_type','=','other'),('deprecated','=',False)]" groups="account.group_account_user"/>
+ <field name="property_account_expense_id" domain="[('internal_type','=','other'),('deprecated','=',False)]" groups="account.group_account_user"/>
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/>
</group>
</group>
@@ -36,8 +36,8 @@
<data>
<xpath expr="//group[@name='parent']" position="inside">
<group name="account_property" string="Account Properties" colspan="2">
- <field name="property_account_income_categ" domain="[('internal_type','=','other'),('deprecated', '=', False)]"/>
- <field name="property_account_expense_categ" domain="[('internal_type','=','other'),('deprecated', '=', False)]"/>
+ <field name="property_account_income_categ_id" domain="[('internal_type','=','other'),('deprecated', '=', False)]"/>
+ <field name="property_account_expense_categ_id" domain="[('internal_type','=','other'),('deprecated', '=', False)]"/>
</group>
</xpath>
</data>
diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml
index 3b6a4684390..fec1e264299 100644
--- a/addons/account/views/res_config_view.xml
+++ b/addons/account/views/res_config_view.xml
@@ -56,14 +56,14 @@
class="oe_link" attrs="{'invisible': [('has_chart_of_accounts','!=',False)]}"/>
</div>
<div attrs="{'invisible': ['|', '|', ('chart_template_id','=',False), ('complete_tax_set','=',False), ('has_chart_of_accounts','!=',False)]}">
- <label for="sale_tax"/>
- <field name="sale_tax"
+ <label for="sale_tax_id"/>
+ <field name="sale_tax_id"
domain="[('chart_template_id', '=', chart_template_id),('type_tax_use','in',('sale','all'))]"
class="oe_inline"/>
</div>
<div attrs="{'invisible': ['|', '|', ('chart_template_id','=',False), ('complete_tax_set','=',False), ('has_chart_of_accounts','!=',False)]}">
- <label for="purchase_tax"/>
- <field name="purchase_tax"
+ <label for="purchase_tax_id"/>
+ <field name="purchase_tax_id"
domain="[('chart_template_id', '=', chart_template_id),('type_tax_use','in',('purchase', 'all'))]"
class="oe_inline"/>
</div>
@@ -147,8 +147,8 @@
<label for="id" string="Customer"/>
<div>
<div attrs="{'invisible': [('has_chart_of_accounts','=',False)]}">
- <label for="default_sale_tax"/>
- <field name="default_sale_tax"
+ <label for="default_sale_tax_id"/>
+ <field name="default_sale_tax_id"
domain="[('type_tax_use','=','sale'), ('company_id','=',company_id)]"
class="oe_inline"/>
</div>
@@ -166,8 +166,8 @@
<label for="id" string="Supplier"/>
<div name="other_cofing">
<div attrs="{'invisible': [('has_chart_of_accounts','=',False)]}">
- <label for="default_purchase_tax"/>
- <field name="default_purchase_tax"
+ <label for="default_purchase_tax_id"/>
+ <field name="default_purchase_tax_id"
domain="[('type_tax_use','=','purchase'), ('company_id','=',company_id)]"
class="oe_inline"/>
</div>