diff options
| author | Yannick Tivisse <yti@odoo.com> | 2016-08-05 15:29:54 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2016-08-08 12:24:40 +0200 |
| commit | d6e1d41128c126071d697220f1c83495d6cabc71 (patch) | |
| tree | 919f0028eb0162b5efd3baf211d8679456f9ccc5 /addons | |
| parent | 5177186f437cfc14753a3d7c444fc2b68cf42d83 (diff) | |
[MIG] account: Migrate remaining old API chuncks of code
Diffstat (limited to 'addons')
91 files changed, 244 insertions, 309 deletions
diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 4c7c83661e2..2719ac9a89b 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -5,11 +5,14 @@ import models import wizard import report -from openerp import SUPERUSER_ID + +from odoo import api, SUPERUSER_ID + def _auto_install_l10n(cr, registry): #check the country of the main company (only) and eventually load some module needed in that country - country_code = registry['res.users'].browse(cr, SUPERUSER_ID, SUPERUSER_ID, {}).company_id.country_id.code + env = api.Environment(cr, SUPERUSER_ID, {}) + country_code = env.user.company_id.country_id.code if country_code: #auto install localization module(s) if available module_list = [] @@ -19,7 +22,7 @@ def _auto_install_l10n(cr, registry): elif country_code == 'GB': module_list.append('l10n_uk') else: - if registry['ir.module.module'].search(cr, SUPERUSER_ID, [('name', '=', 'l10n_' + country_code.lower())]): + if env['ir.module.module'].search([('name', '=', 'l10n_' + country_code.lower())]): module_list.append('l10n_' + country_code.lower()) else: module_list.append('l10n_generic_coa') @@ -30,10 +33,10 @@ def _auto_install_l10n(cr, registry): module_list.append('account_yodlee') #european countries will be using SEPA - europe = registry['ir.model.data'].xmlid_to_object(cr, SUPERUSER_ID, 'base.europe', raise_if_not_found=False, context={}) + europe = env.ref('base.europe', raise_if_not_found=False) if europe: europe_country_codes = [x.code for x in europe.country_ids] if country_code in europe_country_codes: module_list.append('account_sepa') - module_ids = registry['ir.module.module'].search(cr, SUPERUSER_ID, [('name', 'in', module_list), ('state', '=', 'uninstalled')]) - registry['ir.module.module'].button_install(cr, SUPERUSER_ID, module_ids, {}) + module_ids = env['ir.module.module'].search([('name', 'in', module_list), ('state', '=', 'uninstalled')]) + module_ids.sudo().button_install() diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml index 933172d872e..5736f59ddcd 100644 --- a/addons/account/data/account_data.xml +++ b/addons/account/data/account_data.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data noupdate="1"> <!-- TAGS FOR CASH FLOW STATEMENT --> @@ -160,4 +160,4 @@ </record> </data> -</openerp> +</odoo> diff --git a/addons/account/data/data_account_type.xml b/addons/account/data/data_account_type.xml index a8e4a460261..34c00e40839 100644 --- a/addons/account/data/data_account_type.xml +++ b/addons/account/data/data_account_type.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data noupdate="1"> <!-- account.account.type --> <record model="account.account.type" id="data_account_type_receivable"> @@ -81,5 +81,5 @@ <field name="type">other</field> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/data/invoice_action_data.xml b/addons/account/data/invoice_action_data.xml index 18a2ba9f7ec..54036f299e3 100644 --- a/addons/account/data/invoice_action_data.xml +++ b/addons/account/data/invoice_action_data.xml @@ -1,5 +1,5 @@ <?xml version="1.0" ?> -<openerp> +<odoo> <!-- Mail template are declared in a NOUPDATE block so users can freely customize/delete them --> @@ -130,4 +130,4 @@ from ${object.company_id.name}. </record> </data> -</openerp> +</odoo> diff --git a/addons/account/demo/account_demo.xml b/addons/account/demo/account_demo.xml index 047b301f2e4..6b2388ddcea 100644 --- a/addons/account/demo/account_demo.xml +++ b/addons/account/demo/account_demo.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <!-- TAGS FOR RETRIEVING THE DEMO ACCOUNTS --> @@ -53,4 +53,4 @@ <field name="property_supplier_payment_term_id" ref="account_payment_term"/> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 637c26083ee..c77a9fb00b8 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -3,11 +3,11 @@ import time import math -from openerp.osv import expression -from openerp.tools.float_utils import float_round as round -from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT -from openerp.exceptions import UserError, ValidationError -from openerp import api, fields, models, _ +from odoo.osv import expression +from odoo.tools.float_utils import float_round as round +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT +from odoo.exceptions import UserError, ValidationError +from odoo import api, fields, models, _ class AccountAccountType(models.Model): @@ -642,7 +642,7 @@ class AccountTax(models.Model): if self.amount_type == 'division' and not self.price_include: return base_amount / (1 - self.amount / 100) - base_amount - @api.v8 + @api.multi def compute_all(self, price_unit, currency=None, quantity=1.0, product=None, partner=None): """ Returns all information required to apply taxes (in self + their children in case of a tax goup). We consider the sequence of the parent for group of taxes. @@ -729,15 +729,6 @@ class AccountTax(models.Model): 'base': base, } - @api.v7 - def compute_all(self, cr, uid, ids, price_unit, currency_id=None, quantity=1.0, product_id=None, partner_id=None, context=None): - currency = currency_id and self.pool.get('res.currency').browse(cr, uid, currency_id, context=context) or None - product = product_id and self.pool.get('product.product').browse(cr, uid, product_id, context=context) or None - partner = partner_id and self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) or None - ids = isinstance(ids, (int, long)) and [ids] or ids - recs = self.browse(cr, uid, ids, context=context) - return AccountTax.compute_all(recs, price_unit, currency, quantity, product, partner) - @api.model def _fix_tax_included_price(self, price, prod_taxes, line_taxes): """Subtract tax amount from price when corresponding "price included" taxes do not apply""" diff --git a/addons/account/models/account_analytic_line.py b/addons/account/models/account_analytic_line.py index b7120d0c907..1578d237500 100644 --- a/addons/account/models/account_analytic_line.py +++ b/addons/account/models/account_analytic_line.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models, _ +from odoo import api, fields, models, _ class AccountAnalyticLine(models.Model): diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index fcd3bcaa9e5..6df4e8f5c9d 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models, _ -from openerp.osv import expression -from openerp.tools import float_is_zero -from openerp.tools import float_compare, float_round -from openerp.tools.misc import formatLang -from openerp.exceptions import UserError, ValidationError +from odoo import api, fields, models, _ +from odoo.osv import expression +from odoo.tools import float_is_zero +from odoo.tools import float_compare, float_round +from odoo.tools.misc import formatLang +from odoo.exceptions import UserError, ValidationError import time import math @@ -769,19 +769,18 @@ class AccountBankStatementLine(models.Model): 'amount_currency': amount_currency, } - @api.v7 - def process_reconciliations(self, cr, uid, ids, data, context=None): + @api.multi + def process_reconciliations(self, data): """ Handles data sent from the bank statement reconciliation widget (and can otherwise serve as an old-API bridge) :param list of dicts data: must contains the keys 'counterpart_aml_dicts', 'payment_aml_ids' and 'new_aml_dicts', whose value is the same as described in process_reconciliation except that ids are used instead of recordsets. """ - aml_obj = self.pool['account.move.line'] - for id, datum in zip(ids, data): - st_line = self.browse(cr, uid, id, context) - payment_aml_rec = aml_obj.browse(cr, uid, datum.get('payment_aml_ids', []), context) + AccountMoveLine = self.env['account.move.line'] + for st_line, datum in zip(self, data): + payment_aml_rec = AccountMoveLine.browse(datum.get('payment_aml_ids', [])) for aml_dict in datum.get('counterpart_aml_dicts', []): - aml_dict['move_line'] = aml_obj.browse(cr, uid, aml_dict['counterpart_aml_id'], context) + aml_dict['move_line'] = AccountMoveLine.browse(aml_dict['counterpart_aml_id']) del aml_dict['counterpart_aml_id'] st_line.process_reconciliation(datum.get('counterpart_aml_dicts', []), payment_aml_rec, datum.get('new_aml_dicts', [])) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 6fe9a217aa6..1623af869eb 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -5,13 +5,13 @@ from lxml import etree from datetime import datetime from dateutil.relativedelta import relativedelta -from openerp import api, fields, models, _ -from openerp.tools import float_is_zero, float_compare -from openerp.tools.misc import formatLang +from odoo import api, fields, models, _ +from odoo.tools import float_is_zero, float_compare +from odoo.tools.misc import formatLang -from openerp.exceptions import UserError, RedirectWarning, ValidationError +from odoo.exceptions import UserError, RedirectWarning, ValidationError -import openerp.addons.decimal_precision as dp +import odoo.addons.decimal_precision as dp # mapping invoice type to journal type TYPE2JOURNAL = { @@ -585,17 +585,17 @@ class AccountInvoice(models.Model): line_to_reconcile += inv.move_id.line_ids.filtered(lambda r: not r.reconciled and r.account_id.internal_type in ('payable', 'receivable')) return (line_to_reconcile + payment_line).reconcile(writeoff_acc_id, writeoff_journal_id) - @api.v7 - def assign_outstanding_credit(self, cr, uid, id, credit_aml_id, context=None): - credit_aml = self.pool.get('account.move.line').browse(cr, uid, credit_aml_id, context=context) - inv = self.browse(cr, uid, id, context=context) - if not credit_aml.currency_id and inv.currency_id != inv.company_id.currency_id: + @api.multi + def assign_outstanding_credit(self, credit_aml_id): + self.ensure_one() + credit_aml = self.env['account.move.line'].browse(credit_aml_id) + if not credit_aml.currency_id and self.currency_id != self.company_id.currency_id: credit_aml.with_context(allow_amount_currency=True).write({ - 'amount_currency': inv.company_id.currency_id.with_context(date=credit_aml.date).compute(credit_aml.balance, inv.currency_id), - 'currency_id': inv.currency_id.id}) + 'amount_currency': self.company_id.currency_id.with_context(date=credit_aml.date).compute(credit_aml.balance, self.currency_id), + 'currency_id': self.currency_id.id}) if credit_aml.payment_id: credit_aml.payment_id.write({'invoice_ids': [(4, id, None)]}) - return inv.register_payment(credit_aml) + return self.register_payment(credit_aml) @api.multi def action_date_assign(self): @@ -998,7 +998,7 @@ class AccountInvoice(models.Model): new_invoices += refund_invoice return new_invoices - @api.v8 + @api.multi def pay_and_reconcile(self, pay_journal, pay_amount=None, date=None, writeoff_acc=None): """ Create and post an account.payment for the invoice self, which creates a journal entry that reconciles the invoice. @@ -1033,13 +1033,6 @@ class AccountInvoice(models.Model): }) payment.post() - @api.v7 - def pay_and_reconcile(self, cr, uid, ids, pay_journal_id, pay_amount=None, date=None, writeoff_acc_id=None, context=None): - recs = self.browse(cr, uid, ids, context) - pay_journal = self.pool.get('account.journal').browse(cr, uid, pay_journal_id, context=context) - writeoff_acc = self.pool.get('account.account').browse(cr, uid, writeoff_acc_id, context=context) - return AccountInvoice.pay_and_reconcile(recs, pay_journal, pay_amount, date, writeoff_acc) - @api.multi def _track_subtype(self, init_values): self.ensure_one() diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 84b449d6b8d..b3f0883da05 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -3,9 +3,9 @@ from datetime import datetime, timedelta from babel.dates import format_datetime, format_date -from openerp import models, api, _, fields -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF -from openerp.tools.misc import formatLang +from odoo import models, api, _, fields +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF +from odoo.tools.misc import formatLang class account_journal(models.Model): _inherit = "account.journal" @@ -311,9 +311,7 @@ class account_journal(models.Model): 'default_type': invoice_type, 'type': invoice_type }) - ir_model_obj = self.pool['ir.model.data'] - model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context) + [action] = self.env.ref('account.%s' % action_name).read() action['context'] = ctx action['domain'] = self._context.get('use_domain', []) return action @@ -352,13 +350,13 @@ class account_journal(models.Model): ctx = dict(self.env.context, default_journal_id=self.id) if ctx.get('search_default_journal', False): ctx.update(search_default_journal_id=self.id) - ir_model_obj = self.pool['ir.model.data'] - model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context) + ir_model_obj = self.env['ir.model.data'] + model, action_id = ir_model_obj.get_object_reference('account', action_name) + [action] = self.env[model].browse(action_id).read() action['context'] = ctx if ctx.get('use_domain', False): action['domain'] = ['|', ('journal_id', '=', self.id), ('journal_id', '=', False)] - action['name'] += ' for journal '+self.name + action['name'] += ' for journal ' + self.name return action @api.multi diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 4de95ac4dfc..a9e8087f0a6 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2,12 +2,12 @@ import time from collections import OrderedDict -from openerp import api, fields, models, _ -from openerp.osv import expression -from openerp.exceptions import RedirectWarning, UserError, ValidationError -from openerp.tools.misc import formatLang -from openerp.tools import float_is_zero, float_compare -from openerp.tools.safe_eval import safe_eval +from odoo import api, fields, models, _ +from odoo.osv import expression +from odoo.exceptions import RedirectWarning, UserError, ValidationError +from odoo.tools.misc import formatLang +from odoo.tools import float_is_zero, float_compare +from odoo.tools.safe_eval import safe_eval from lxml import etree #---------------------------------------------------------- @@ -633,13 +633,7 @@ class AccountMoveLine(models.Model): target_currency = account.currency_id or account.company_id.currency_id return lines.prepare_move_lines_for_reconciliation_widget(target_currency=target_currency) - @api.v7 - def prepare_move_lines_for_reconciliation_widget(self, cr, uid, line_ids, target_currency_id=False, context=None): - recs = self.browse(cr, uid, line_ids, context) - target_currency = target_currency_id and self.pool.get('res.currency').browse(cr, uid, target_currency_id, context=context) or False - return AccountMoveLine.prepare_move_lines_for_reconciliation_widget(recs, target_currency=target_currency) - - @api.v8 + @api.multi def prepare_move_lines_for_reconciliation_widget(self, target_currency=False, target_date=False): """ Returns move lines formatted for the manual/bank reconciliation widget @@ -712,8 +706,8 @@ class AccountMoveLine(models.Model): ret.append(ret_line) return ret - @api.v7 - def process_reconciliations(self, cr, uid, data, context=None): + @api.model + def process_reconciliations(self, data): """ Used to validate a batch of reconciliations in a single call :param data: list of dicts containing: - 'type': either 'partner' or 'account' @@ -723,14 +717,14 @@ class AccountMoveLine(models.Model): """ for datum in data: if len(datum['mv_line_ids']) >= 1 or len(datum['mv_line_ids']) + len(datum['new_mv_line_dicts']) >= 2: - self.process_reconciliation(cr, uid, datum['mv_line_ids'], datum['new_mv_line_dicts'], context=context) + self.process_reconciliation(datum['mv_line_ids'], datum['new_mv_line_dicts']) if datum['type'] == 'partner': - partners = self.pool['res.partner'].browse(cr, uid, datum['id'], context=context) - self.pool['res.partner'].mark_as_reconciled(cr, uid, partners.ids, context=context) + partners = self.env['res.partner'].browse(datum['id']) + partners.mark_as_reconciled() if datum['type'] == 'account': - accounts = self.pool['account.account'].browse(cr, uid, datum['id'], context=context) - self.pool['account.account'].mark_as_reconciled(cr, uid, accounts.ids, context=context) + accounts = self.env['account.account'].browse(datum['id']) + accounts.mark_as_reconciled() @api.multi def process_reconciliation(self, new_mv_line_dicts): @@ -1035,7 +1029,6 @@ class AccountMoveLine(models.Model): if not move_id: if not vals.get('move_id', False): if journal.sequence_id: - #name = self.pool.get('ir.sequence').next_by_id(cr, uid, journal.sequence_id.id) v = { 'date': vals.get('date', time.strftime('%Y-%m-%d')), 'journal_id': context['journal_id'] @@ -1299,8 +1292,7 @@ class AccountMoveLine(models.Model): @api.multi def open_reconcile_view(self): - model, action_id = self.pool['ir.model.data'].get_object_reference(self._cr, self._uid, 'account', "action_account_moves_all_a") - action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context) + [action] = self.env.ref('account.action_account_moves_all_a').read() ids = [] for aml in self: if aml.account_id.reconcile: diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index cd3a26874c4..496f0a56bae 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import models, fields, api, _ -from openerp.exceptions import UserError, ValidationError +from odoo import models, fields, api, _ +from odoo.exceptions import UserError, ValidationError MAP_INVOICE_TYPE_PARTNER_TYPE = { 'out_invoice': 'customer', diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 7258e087f28..c74fdd7f702 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -1,15 +1,8 @@ # -*- coding: utf-8 -*- -import time -import math - -from openerp.osv import expression -from openerp.tools.float_utils import float_round as round -from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT -from openerp.exceptions import AccessError, UserError, ValidationError -import openerp.addons.decimal_precision as dp -from openerp import api, fields, models, _ -from openerp import SUPERUSER_ID +from odoo.exceptions import AccessError +from odoo import api, fields, models, _ +from odoo import SUPERUSER_ID import logging _logger = logging.getLogger(__name__) @@ -18,7 +11,11 @@ def migrate_set_tags_and_taxes_updatable(cr, registry, module): ''' This is a utility function used to manually set the flag noupdate to False on tags and account tax templates on localization modules that need migration (for example in case of VAT report improvements) ''' - xml_record_ids = registry['ir.model.data'].search(cr, SUPERUSER_ID, [('model', 'in', ['account.tax.template', 'account.account.tag']), ('module', 'like', module)]) + env = api.Environment(cr, SUPERUSER_ID, {}) + xml_record_ids = env['ir.model.data'].search([ + ('model', 'in', ['account.tax.template', 'account.account.tag']), + ('module', 'like', module) + ]).ids if xml_record_ids: cr.execute("update ir_model_data set noupdate = 'f' where id in %s", (tuple(xml_record_ids),)) @@ -29,12 +26,20 @@ def migrate_tags_on_taxes(cr, registry): Note: This unusual decision has been made in order to help the improvement of VAT reports on version 9.0, to have them more flexible and working out of the box when people are creating/using new taxes. ''' - xml_record_ids = registry['ir.model.data'].search(cr, SUPERUSER_ID, [('model', '=', 'account.tax.template'), ('module', 'like', 'l10n_%')]) - tax_template_ids = [x['res_id'] for x in registry['ir.model.data'].read(cr, SUPERUSER_ID, xml_record_ids, ['res_id'])] - for tax_template in registry['account.tax.template'].browse(cr, SUPERUSER_ID, tax_template_ids): - tax_id = registry['account.tax'].search(cr, SUPERUSER_ID, [('name', '=', tax_template.name), ('type_tax_use', '=', tax_template.type_tax_use), ('description', '=', tax_template.description)]) - if len(tax_id) == 1: - registry['account.tax'].write(cr, SUPERUSER_ID, tax_id, {'tag_ids': [(6,0,[x.id for x in tax_template.tag_ids])]}) + env = api.Environment(cr, SUPERUSER_ID, {}) + xml_records = env['ir.model.data'].search([ + ('model', '=', 'account.tax.template'), + ('module', 'like', 'l10n_%') + ]) + tax_template_ids = [x['res_id'] for x in xml_records.sudo().read(['res_id'])] + for tax_template in env['account.tax.template'].browse(tax_template_ids): + tax_id = env['account.tax'].search([ + ('name', '=', tax_template.name), + ('type_tax_use', '=', tax_template.type_tax_use), + ('description', '=', tax_template.description) + ]) + if len(tax_id.ids) == 1: + tax_id.sudo().write({'tag_ids': [(6, 0, [tax_template.tag_ids.ids])]}) # --------------------------------------------------------------- # Account Templates: Account, Tax, Tax Code and chart. + Wizard diff --git a/addons/account/models/company.py b/addons/account/models/company.py index faa20059bc4..d4ed009ccdc 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import fields, models, api, _ +from odoo import fields, models, api, _ from datetime import timedelta diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index fb879b85e9f..faa6b147da1 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -3,10 +3,10 @@ from operator import itemgetter import time -from openerp import api, fields, models, _ -from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT -from openerp.exceptions import ValidationError -from openerp.addons.base.res.res_partner import WARNING_MESSAGE, WARNING_HELP +from odoo import api, fields, models, _ +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT +from odoo.exceptions import ValidationError +from odoo.addons.base.res.res_partner import WARNING_MESSAGE, WARNING_HELP class AccountFiscalPosition(models.Model): _name = 'account.fiscal.position' @@ -44,25 +44,7 @@ class AccountFiscalPosition(models.Model): raise ValidationError(_('Invalid "Zip Range", please configure it properly.')) return True - @api.v7 - def map_tax(self, cr, uid, fposition_id, taxes, product=None, partner=None, context=None): - if not taxes: - return [] - if not fposition_id: - return map(lambda x: x.id, taxes) - result = set() - for t in taxes: - ok = False - for tax in fposition_id.tax_ids: - if tax.tax_src_id.id == t.id: - if tax.tax_dest_id: - result.add(tax.tax_dest_id.id) - ok = True - if not ok: - result.add(t.id) - return list(result) - - @api.v8 # noqa + @api.model # noqa def map_tax(self, taxes, product=None, partner=None): result = self.env['account.tax'].browse() for tax in taxes: @@ -76,24 +58,14 @@ class AccountFiscalPosition(models.Model): result |= tax return result - @api.v7 - def map_account(self, cr, uid, fposition_id, account_id, context=None): - if not fposition_id: - return account_id - for pos in fposition_id.account_ids: - if pos.account_src_id.id == account_id: - account_id = pos.account_dest_id.id - break - return account_id - - @api.v8 + @api.model def map_account(self, account): for pos in self.account_ids: if pos.account_src_id == account: return pos.account_dest_id return account - @api.v8 + @api.model def map_accounts(self, accounts): """ Receive a dictionary having accounts in values and try to replace those accounts accordingly to the fiscal position. """ diff --git a/addons/account/models/product.py b/addons/account/models/product.py index b411ae50f15..117cb5ae826 100644 --- a/addons/account/models/product.py +++ b/addons/account/models/product.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models, _ -from openerp.exceptions import UserError +from odoo import api, fields, models, _ +from odoo.exceptions import UserError class ProductCategory(models.Model): diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index 778d5cd1460..76de3db1d25 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -4,11 +4,11 @@ import time import datetime from dateutil.relativedelta import relativedelta -import openerp -from openerp import SUPERUSER_ID -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF -from openerp import api, fields, models, _ -from openerp.exceptions import UserError +import odoo +from odoo import SUPERUSER_ID +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF +from odoo import api, fields, models, _ +from odoo.exceptions import UserError class AccountConfigSettings(models.TransientModel): diff --git a/addons/account/models/web_planner.py b/addons/account/models/web_planner.py index b5ecbaa7008..40e7f44676e 100644 --- a/addons/account/models/web_planner.py +++ b/addons/account/models/web_planner.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from openerp import api, models +from odoo import api, models class PlannerAccount(models.Model): diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 50e83d25d5a..614144289a3 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import time -from openerp import api, models, _ -from openerp.tools import float_is_zero +from odoo import api, models, _ +from odoo.tools import float_is_zero from datetime import datetime from dateutil.relativedelta import relativedelta diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 4422ddd5db3..bd7e0de187e 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from openerp import api, models +from odoo import api, models class ReportTrialBalance(models.AbstractModel): diff --git a/addons/account/report/account_financial_report.py b/addons/account/report/account_financial_report.py index d06a2cc02b1..0dd860b1d18 100644 --- a/addons/account/report/account_financial_report.py +++ b/addons/account/report/account_financial_report.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from openerp import api, models, fields +from odoo import api, models, fields # --------------------------------------------------------- # Account Financial Report diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index ce9a3db095c..7350d8909e7 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from openerp import api, models +from odoo import api, models class ReportGeneralLedger(models.AbstractModel): diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 70e79867d20..2012d7fd2e8 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import tools -from openerp import models, fields, api +from odoo import tools +from odoo import models, fields, api class AccountInvoiceReport(models.Model): @@ -160,10 +160,11 @@ class AccountInvoiceReport(models.Model): """ return group_by_str - def init(self, cr): + @api.model_cr + def init(self): # self._table = account_invoice_report - tools.drop_view_if_exists(cr, self._table) - cr.execute("""CREATE or REPLACE VIEW %s as ( + tools.drop_view_if_exists(self.env.cr, self._table) + self.env.cr.execute("""CREATE or REPLACE VIEW %s as ( WITH currency_rate AS (%s) %s FROM ( @@ -175,5 +176,5 @@ class AccountInvoiceReport(models.Model): cr.date_start <= COALESCE(sub.date, NOW()) AND (cr.date_end IS NULL OR cr.date_end > COALESCE(sub.date, NOW()))) )""" % ( - self._table, self.pool['res.currency']._select_companies_rates(), + self._table, self.env['res.currency']._select_companies_rates(), self._select(), self._sub_select(), self._from(), self._group_by())) diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 5d5341e6d2e..77a3d2d5a28 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_invoice_report_pivot" model="ir.ui.view"> <field name="name">account.invoice.report.pivot</field> @@ -126,4 +126,4 @@ view_mode="graph"/> </data> -</openerp> +</odoo> diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 55ef6635172..8e4184c3e1a 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from openerp import api, models +from odoo import api, models class ReportJournal(models.AbstractModel): diff --git a/addons/account/report/account_overdue_report.py b/addons/account/report/account_overdue_report.py index 6cfd79b1bbb..bb190d0816c 100644 --- a/addons/account/report/account_overdue_report.py +++ b/addons/account/report/account_overdue_report.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from openerp import api, fields, models +from odoo import api, fields, models class ReportOverdue(models.AbstractModel): diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 975083649ad..945a7830dbe 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -2,8 +2,8 @@ from datetime import datetime import time -from openerp import api, models -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT +from odoo import api, models +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT class ReportPartnerLedger(models.AbstractModel): diff --git a/addons/account/report/account_report_financial.py b/addons/account/report/account_report_financial.py index c988aacdd98..97e3525a469 100644 --- a/addons/account/report/account_report_financial.py +++ b/addons/account/report/account_report_financial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from openerp import api, models +from odoo import api, models class ReportFinancial(models.AbstractModel): diff --git a/addons/account/report/inherited_layouts.xml b/addons/account/report/inherited_layouts.xml index 290c1ba3a23..33bbebc9aea 100644 --- a/addons/account/report/inherited_layouts.xml +++ b/addons/account/report/inherited_layouts.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <template id="external_layout_footer" inherit_id="report.external_layout_footer"> @@ -19,4 +19,4 @@ </template> </data> -</openerp> +</odoo> diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index 1984c94d8f3..574435c1c00 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data noupdate="0"> <record id="group_account_invoice" model="res.groups"> @@ -123,4 +123,4 @@ </record> </data> -</openerp> +</odoo> diff --git a/addons/account/static/src/js/account_reconciliation_widgets.js b/addons/account/static/src/js/account_reconciliation_widgets.js index 7965d3184d9..0a038cd26e4 100644 --- a/addons/account/static/src/js/account_reconciliation_widgets.js +++ b/addons/account/static/src/js/account_reconciliation_widgets.js @@ -1,5 +1,3 @@ -/*global openerp:false */ - odoo.define('account.reconciliation', function (require) { "use strict"; diff --git a/addons/account/test/account_minimal_test.xml b/addons/account/test/account_minimal_test.xml index b59a6a5ec4e..e127af9b289 100644 --- a/addons/account/test/account_minimal_test.xml +++ b/addons/account/test/account_minimal_test.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data noupdate="0"> <!-- This should be loaded for non python tests in other modules that require accounting test data but that don't depend on any localization --> @@ -307,4 +307,4 @@ <field name="company_id" ref="base.main_company"/> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/tests/account_test_classes.py b/addons/account/tests/account_test_classes.py index 42764a5725c..76f8cd54013 100644 --- a/addons/account/tests/account_test_classes.py +++ b/addons/account/tests/account_test_classes.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from openerp.tests.common import HttpCase +from odoo.tests.common import HttpCase class AccountingTestCase(HttpCase): """ This class extends the base TransactionCase, in order to test the diff --git a/addons/account/tests/account_test_users.py b/addons/account/tests/account_test_users.py index 3c2af90c37d..5b5bde0a9cc 100644 --- a/addons/account/tests/account_test_users.py +++ b/addons/account/tests/account_test_users.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase class AccountTestUsers(AccountingTestCase): diff --git a/addons/account/tests/test_account_customer_invoice.py b/addons/account/tests/test_account_customer_invoice.py index ad92a99a16a..f24b9460cc8 100644 --- a/addons/account/tests/test_account_customer_invoice.py +++ b/addons/account/tests/test_account_customer_invoice.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_users import AccountTestUsers +from odoo.addons.account.tests.account_test_users import AccountTestUsers import datetime diff --git a/addons/account/tests/test_account_move_closed_period.py b/addons/account/tests/test_account_move_closed_period.py index d3e9a5b08c2..120b7cbb556 100644 --- a/addons/account/tests/test_account_move_closed_period.py +++ b/addons/account/tests/test_account_move_closed_period.py @@ -1,7 +1,7 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase -from openerp.osv.orm import except_orm +from odoo.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.osv.orm import except_orm from datetime import datetime, timedelta -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT class TestPeriodState(AccountingTestCase): """ @@ -10,16 +10,14 @@ class TestPeriodState(AccountingTestCase): def setUp(self): super(TestPeriodState, self).setUp() - cr, uid = self.cr, self.uid self.day_before_yesterday = datetime.now() - timedelta(2) self.yesterday = datetime.now() - timedelta(1) - self.user_id = self.env['res.users'].browse(self.uid) + self.user_id = self.env.user self.user_id.company_id.write({'fiscalyear_lock_date': self.yesterday.strftime(DEFAULT_SERVER_DATE_FORMAT)}) self.sale_journal_id = self.env['account.journal'].search([('type', '=', 'sale')])[0] self.account_id = self.env['account.account'].search([('internal_type', '=', 'receivable')])[0] def test_period_state(self): - cr, uid = self.cr, self.uid with self.assertRaises(except_orm): move = self.env['account.move'].create({ 'name': '/', diff --git a/addons/account/tests/test_account_supplier_invoice.py b/addons/account/tests/test_account_supplier_invoice.py index afe8ddc867a..81a2517f2db 100644 --- a/addons/account/tests/test_account_supplier_invoice.py +++ b/addons/account/tests/test_account_supplier_invoice.py @@ -1,5 +1,5 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase -from openerp.exceptions import Warning +from odoo.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.exceptions import Warning class TestAccountSupplierInvoice(AccountingTestCase): diff --git a/addons/account/tests/test_account_validate_account_move.py b/addons/account/tests/test_account_validate_account_move.py index e5265ead8e2..db59505af23 100644 --- a/addons/account/tests/test_account_validate_account_move.py +++ b/addons/account/tests/test_account_validate_account_move.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase class TestAccountValidateAccount(AccountingTestCase): diff --git a/addons/account/tests/test_bank_statement_reconciliation.py b/addons/account/tests/test_bank_statement_reconciliation.py index b31150db953..56f38fa3e69 100644 --- a/addons/account/tests/test_bank_statement_reconciliation.py +++ b/addons/account/tests/test_bank_statement_reconciliation.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase class TestBankStatementReconciliation(AccountingTestCase): diff --git a/addons/account/tests/test_bank_stmt_reconciliation_widget_ui.py b/addons/account/tests/test_bank_stmt_reconciliation_widget_ui.py index 9ed81c5c915..9db8bba061c 100644 --- a/addons/account/tests/test_bank_stmt_reconciliation_widget_ui.py +++ b/addons/account/tests/test_bank_stmt_reconciliation_widget_ui.py @@ -1,4 +1,4 @@ -from openerp.tests import HttpCase +from odoo.tests import HttpCase class TestUi(HttpCase): post_install = True diff --git a/addons/account/tests/test_fiscal_position.py b/addons/account/tests/test_fiscal_position.py index 11c5f71170c..e3c933ea6e0 100644 --- a/addons/account/tests/test_fiscal_position.py +++ b/addons/account/tests/test_fiscal_position.py @@ -1,4 +1,4 @@ -from openerp.tests import common +from odoo.tests import common class TestFiscalPosition(common.TransactionCase): """Tests for fiscal positions in auto apply (account.fiscal.position). diff --git a/addons/account/tests/test_manual_reconciliation.py b/addons/account/tests/test_manual_reconciliation.py index a7a7f24d8cd..c9c286711f7 100644 --- a/addons/account/tests/test_manual_reconciliation.py +++ b/addons/account/tests/test_manual_reconciliation.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase class TestManualReconciliation(AccountingTestCase): diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py index b8e2cc3379b..374ceb9c5f3 100644 --- a/addons/account/tests/test_payment.py +++ b/addons/account/tests/test_payment.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase import time class TestPayment(AccountingTestCase): diff --git a/addons/account/tests/test_product_id_change.py b/addons/account/tests/test_product_id_change.py index 9458a8618de..2aeb4309b9d 100644 --- a/addons/account/tests/test_product_id_change.py +++ b/addons/account/tests/test_product_id_change.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase import time class TestProductIdChange(AccountingTestCase): diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 50c12c035b9..2b518a1b253 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_classes import AccountingTestCase +from odoo.addons.account.tests.account_test_classes import AccountingTestCase import time import unittest @@ -258,15 +258,15 @@ class TestReconciliation(AccountingTestCase): # For instance, with a company set in EUR, and a USD rate set to 0.033, # the reconciliation of an invoice of 2.00 USD (60.61 EUR) and a bank statement of two lines of 1.00 USD (30.30 EUR) # will lead to an exchange loss, that should be handled correctly within the journal items. - cr, uid = self.cr, self.uid + env = api.Environment(self.cr, self.uid, {}) # We update the currency rate of the currency USD in order to force the gain/loss exchanges in next steps - rateUSDbis_id = self.registry("ir.model.data").get_object_reference(self.cr, self.uid, "base", "rateUSDbis")[1] - self.res_currency_rate_model.write(cr, uid, rateUSDbis_id, { + rateUSDbis = env.ref("base.rateUSDbis") + rateUSDbis.write({ 'name': time.strftime('%Y-%m-%d') + ' 00:00:00', 'rate': 0.033, }) # We create a customer invoice of 2.00 USD - invoice_id = self.account_invoice_model.create(cr, uid, { + invoice = self.account_invoice_model.create({ 'partner_id': self.partner_agrolait_id, 'currency_id': self.currency_usd_id, 'name': 'Foreign invoice with exchange gain', @@ -282,10 +282,9 @@ class TestReconciliation(AccountingTestCase): }) ] }) - self.registry('account.invoice').signal_workflow(cr, uid, [invoice_id], 'invoice_open') - invoice = self.account_invoice_model.browse(cr, uid, invoice_id) + invoice.signal_workflow('invoice_open') # We create a bank statement with two lines of 1.00 USD each. - bank_stmt_id = self.acc_bank_stmt_model.create(cr, uid, { + statement = self.acc_bank_stmt_model.create({ 'journal_id': self.bank_journal_usd_id, 'date': time.strftime('%Y-%m-%d'), 'line_ids': [ @@ -304,8 +303,6 @@ class TestReconciliation(AccountingTestCase): ] }) - statement = self.acc_bank_stmt_model.browse(cr, uid, bank_stmt_id) - # We process the reconciliation of the invoice line with the two bank statement lines line_id = None for l in invoice.move_id.line_id: @@ -313,7 +310,7 @@ class TestReconciliation(AccountingTestCase): line_id = l break for statement_line in statement.line_ids: - self.acc_bank_stmt_line_model.process_reconciliation(cr, uid, statement_line.id, [ + statement_line.process_reconciliation([ {'counterpart_move_line_id': line_id.id, 'credit': 1.0, 'debit': 0.0, 'name': line_id.name} ]) diff --git a/addons/account/tests/test_search.py b/addons/account/tests/test_search.py index eb94a9bd910..9f2057d1108 100644 --- a/addons/account/tests/test_search.py +++ b/addons/account/tests/test_search.py @@ -1,4 +1,4 @@ -from openerp.addons.account.tests.account_test_users import AccountTestUsers +from odoo.addons.account.tests.account_test_users import AccountTestUsers class TestSearch(AccountTestUsers): diff --git a/addons/account/tests/test_tax.py b/addons/account/tests/test_tax.py index d221e705412..1eb214cf313 100644 --- a/addons/account/tests/test_tax.py +++ b/addons/account/tests/test_tax.py @@ -1,6 +1,6 @@ -from openerp.addons.account.tests.account_test_users import AccountTestUsers -from openerp.tests.common import TransactionCase -from openerp.tools import float_compare +from odoo.addons.account.tests.account_test_users import AccountTestUsers +from odoo.tests.common import TransactionCase +from odoo.tools import float_compare import time diff --git a/addons/account/views/account.xml b/addons/account/views/account.xml index 41bf0ceb410..76654479e48 100644 --- a/addons/account/views/account.xml +++ b/addons/account/views/account.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <template id="assets_backend" name="account assets" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> @@ -16,4 +16,4 @@ </xpath> </template> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_analytic_view.xml b/addons/account/views/account_analytic_view.xml index 8b4af3f9bcf..cf2184b3b97 100644 --- a/addons/account/views/account_analytic_view.xml +++ b/addons/account/views/account_analytic_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_analytic_line_form_inherit_account" model="ir.ui.view"> <field name="name">account.analytic.line.form.inherit.account</field> @@ -108,4 +108,4 @@ groups="base.group_no_one"/> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_end_fy.xml b/addons/account/views/account_end_fy.xml index abcb8520c66..04decacb705 100644 --- a/addons/account/views/account_end_fy.xml +++ b/addons/account/views/account_end_fy.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index 97c8d4b3f15..601a551ef89 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <!-- Invoices --> @@ -679,4 +679,4 @@ src_model="account.journal"/> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_invoice_workflow.xml b/addons/account/views/account_invoice_workflow.xml index beb403832ba..b5e5e3a1948 100644 --- a/addons/account/views/account_invoice_workflow.xml +++ b/addons/account/views/account_invoice_workflow.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="wkf" model="workflow"> @@ -110,4 +110,4 @@ write({'state':'cancel'})</field> <field name="signal">invoice_cancel</field> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_menuitem.xml b/addons/account/views/account_menuitem.xml index 16d609305bb..ac2e904b2e5 100644 --- a/addons/account/views/account_menuitem.xml +++ b/addons/account/views/account_menuitem.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <!-- Top menu item --> @@ -31,5 +31,5 @@ <menuitem id="menu_account_reports" name="Financial Reports" parent="menu_finance_configuration" groups="group_account_user"/> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index e54aa4317c1..1f12802b74c 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_payment_tree" model="ir.ui.view"> @@ -272,4 +272,4 @@ /> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_report.xml b/addons/account/views/account_report.xml index 6285e1f6224..605c6f7c64b 100644 --- a/addons/account/views/account_report.xml +++ b/addons/account/views/account_report.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <!-- QWeb Reports --> <report @@ -88,4 +88,4 @@ /> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_tip_data.xml b/addons/account/views/account_tip_data.xml index e2f114ab05f..8a71be77756 100644 --- a/addons/account/views/account_tip_data.xml +++ b/addons/account/views/account_tip_data.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<openerp> +<odoo> <data> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_unit_test.xml b/addons/account/views/account_unit_test.xml index 7f09e31abeb..3991ce9ffcc 100644 --- a/addons/account/views/account_unit_test.xml +++ b/addons/account/views/account_unit_test.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <!-- This file must be loaded _after_ account_demo.xml ! --> <record id="test_invoice_1" model="account.invoice"> @@ -59,4 +59,4 @@ <test expr="state">paid</test> </assert> </data> -</openerp> +</odoo> diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 86de39f5344..be5cad82be2 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> @@ -1997,4 +1997,4 @@ <menuitem id="menu_account_report_tree_hierarchy" name="Account Reports Hierarchy" parent="menu_account_reports" action="action_account_report_tree_hierarchy"/> </data> -</openerp> +</odoo> diff --git a/addons/account/views/company_view.xml b/addons/account/views/company_view.xml index 63805ceb6d9..a3bd3fac5fc 100644 --- a/addons/account/views/company_view.xml +++ b/addons/account/views/company_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record model="ir.ui.view" id="view_company_inherit_form"> <field name="name">res.company.form.inherit</field> @@ -23,4 +23,4 @@ </record> </data> -</openerp> +</odoo> diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml index 973e593e2dd..b562e607834 100644 --- a/addons/account/views/partner_view.xml +++ b/addons/account/views/partner_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_position_form" model="ir.ui.view"> @@ -203,4 +203,4 @@ </field> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/views/product_view.xml b/addons/account/views/product_view.xml index c743731fcbb..8027954db05 100644 --- a/addons/account/views/product_view.xml +++ b/addons/account/views/product_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="product_template_form_view" model="ir.ui.view"> <field name="name">product.template.form.inherit</field> @@ -45,4 +45,4 @@ </field> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 30ed8c32853..75ff000446e 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <template id="report_invoice_document"> <t t-call="report.external_layout"> @@ -158,4 +158,4 @@ </t> </template> </data> -</openerp> +</odoo> diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml index 32b766bedfd..ba595c74aa8 100644 --- a/addons/account/views/res_config_view.xml +++ b/addons/account/views/res_config_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="open_account_charts_modules" model="ir.actions.act_window"> <field name="name">Chart Templates</field> @@ -273,4 +273,4 @@ <menuitem id="menu_account_config" name="Settings" parent="menu_finance_configuration" sequence="0" action="action_account_config" groups="base.group_system"/> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/account_financial_report.py b/addons/account/wizard/account_financial_report.py index 040093a4531..aca71bfc333 100644 --- a/addons/account/wizard/account_financial_report.py +++ b/addons/account/wizard/account_financial_report.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models +from odoo import api, fields, models class AccountingReport(models.TransientModel): diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 8f6cc34d06a..e32d2745a40 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from openerp import models, fields, api, _ -from openerp.tools.safe_eval import safe_eval as eval -from openerp.exceptions import UserError +from odoo import models, fields, api, _ +from odoo.tools.safe_eval import safe_eval as eval +from odoo.exceptions import UserError class AccountInvoiceRefund(models.TransientModel): diff --git a/addons/account/wizard/account_invoice_refund_view.xml b/addons/account/wizard/account_invoice_refund_view.xml index 6222a3a2d16..170ec5f67ce 100644 --- a/addons/account/wizard/account_invoice_refund_view.xml +++ b/addons/account/wizard/account_invoice_refund_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_invoice_refund" model="ir.ui.view"> @@ -58,4 +58,4 @@ </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py index cc76078deac..e631bab8348 100644 --- a/addons/account/wizard/account_invoice_state.py +++ b/addons/account/wizard/account_invoice_state.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import models, api, _ -from openerp.exceptions import UserError +from odoo import models, api, _ +from odoo.exceptions import UserError class AccountInvoiceConfirm(models.TransientModel): diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml index 815215829eb..50233b713ad 100644 --- a/addons/account/wizard/account_invoice_state_view.xml +++ b/addons/account/wizard/account_invoice_state_view.xml @@ -1,4 +1,4 @@ -<openerp> +<odoo> <data> <record id="account_invoice_confirm_view" model="ir.ui.view"> @@ -49,4 +49,4 @@ </record> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py index f3c6ce5e5aa..9fecac50a21 100644 --- a/addons/account/wizard/account_move_reversal.py +++ b/addons/account/wizard/account_move_reversal.py @@ -1,5 +1,5 @@ -from openerp import models, fields, api -from openerp.tools.translate import _ +from odoo import models, fields, api +from odoo.tools.translate import _ class AccountMoveReversal(models.TransientModel): """ diff --git a/addons/account/wizard/account_move_reversal_view.xml b/addons/account/wizard/account_move_reversal_view.xml index 5710b673972..b7ec625065d 100644 --- a/addons/account/wizard/account_move_reversal_view.xml +++ b/addons/account/wizard/account_move_reversal_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_move_reversal" model="ir.ui.view"> @@ -37,4 +37,4 @@ <field name="model">account.move</field> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py index e3788d5a69d..3ca9d5cc47f 100644 --- a/addons/account/wizard/account_reconcile.py +++ b/addons/account/wizard/account_reconcile.py @@ -1,6 +1,6 @@ -from openerp import models, fields, api, _ -from openerp.tools.float_utils import float_round -from openerp.exceptions import UserError +from odoo import models, fields, api, _ +from odoo.tools.float_utils import float_round +from odoo.exceptions import UserError class AccountMoveLineReconcile(models.TransientModel): diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml index 760c0f3dd85..e8087327fa2 100644 --- a/addons/account/wizard/account_reconcile_view.xml +++ b/addons/account/wizard/account_reconcile_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="view_account_move_line_reconcile_full" model="ir.ui.view"> @@ -64,4 +64,4 @@ </field> </record> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/account_report_aged_partner_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py index 9aefea22184..eb93fb8b838 100644 --- a/addons/account/wizard/account_report_aged_partner_balance.py +++ b/addons/account/wizard/account_report_aged_partner_balance.py @@ -3,8 +3,8 @@ import time from datetime import datetime from dateutil.relativedelta import relativedelta -from openerp import api, fields, models, _ -from openerp.exceptions import UserError +from odoo import api, fields, models, _ +from odoo.exceptions import UserError class AccountAgedTrialBalance(models.TransientModel): diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py index a11404a34bd..97bd1874d25 100644 --- a/addons/account/wizard/account_report_common.py +++ b/addons/account/wizard/account_report_common.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models, _ +from odoo import api, fields, models, _ class AccountCommonReport(models.TransientModel): diff --git a/addons/account/wizard/account_report_common_account.py b/addons/account/wizard/account_report_common_account.py index e483b408d8b..bbb217d5b29 100644 --- a/addons/account/wizard/account_report_common_account.py +++ b/addons/account/wizard/account_report_common_account.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models +from odoo import api, fields, models class AccountCommonAccountReport(models.TransientModel): diff --git a/addons/account/wizard/account_report_common_journal.py b/addons/account/wizard/account_report_common_journal.py index 2108d655152..2e7ffd1c38c 100644 --- a/addons/account/wizard/account_report_common_journal.py +++ b/addons/account/wizard/account_report_common_journal.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import api, fields, models +from odoo import api, fields, models class AccountCommonJournalReport(models.TransientModel): diff --git a/addons/account/wizard/account_report_common_partner.py b/addons/account/wizard/account_report_common_partner.py index c4ca6e8dad2..21ff0d5e330 100644 --- a/addons/account/wizard/account_report_common_partner.py +++ b/addons/account/wizard/account_report_common_partner.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import fields, models +from odoo import fields, models class AccountingCommonPartnerReport(models.TransientModel): diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py index e6919740480..c5a79b5cd99 100644 --- a/addons/account/wizard/account_report_general_ledger.py +++ b/addons/account/wizard/account_report_general_ledger.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import fields, models, _ -from openerp.exceptions import UserError +from odoo import fields, models, _ +from odoo.exceptions import UserError class AccountReportGeneralLedger(models.TransientModel): diff --git a/addons/account/wizard/account_report_partner_ledger.py b/addons/account/wizard/account_report_partner_ledger.py index 08edc3c4056..c8eaf2b9c36 100644 --- a/addons/account/wizard/account_report_partner_ledger.py +++ b/addons/account/wizard/account_report_partner_ledger.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from openerp import fields, models, _ -from openerp.exceptions import UserError +from odoo import fields, models, _ +from odoo.exceptions import UserError class AccountPartnerLedger(models.TransientModel): diff --git a/addons/account/wizard/account_report_print_journal.py b/addons/account/wizard/account_report_print_journal.py index e4ca225c0cc..2523a3f33b5 100644 --- a/addons/account/wizard/account_report_print_journal.py +++ b/addons/account/wizard/account_report_print_journal.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import fields, models +from odoo import fields, models class AccountPrintJournal(models.TransientModel): diff --git a/addons/account/wizard/account_report_trial_balance.py b/addons/account/wizard/account_report_trial_balance.py index 18130183b21..156111b0b8e 100644 --- a/addons/account/wizard/account_report_trial_balance.py +++ b/addons/account/wizard/account_report_trial_balance.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import fields, models +from odoo import fields, models class AccountBalanceReport(models.TransientModel): diff --git a/addons/account/wizard/account_unreconcile.py b/addons/account/wizard/account_unreconcile.py index 6a8ed9d1ea7..10ccb7bd1c0 100644 --- a/addons/account/wizard/account_unreconcile.py +++ b/addons/account/wizard/account_unreconcile.py @@ -1,4 +1,4 @@ -from openerp import models, api +from odoo import models, api class AccountUnreconcile(models.TransientModel): diff --git a/addons/account/wizard/account_unreconcile_view.xml b/addons/account/wizard/account_unreconcile_view.xml index ed4f37ea34f..ec435cdb189 100644 --- a/addons/account/wizard/account_unreconcile_view.xml +++ b/addons/account/wizard/account_unreconcile_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <record id="account_unreconcile_view" model="ir.ui.view"> @@ -36,4 +36,4 @@ </record> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index 0200cbfc075..f74b7aefb5c 100644 --- a/addons/account/wizard/account_validate_account_move.py +++ b/addons/account/wizard/account_validate_account_move.py @@ -1,5 +1,5 @@ -from openerp import models, api, _ -from openerp.exceptions import UserError +from odoo import models, api, _ +from odoo.exceptions import UserError class ValidateAccountMove(models.TransientModel): diff --git a/addons/account/wizard/account_validate_move_view.xml b/addons/account/wizard/account_validate_move_view.xml index e192c515712..021b952bf99 100644 --- a/addons/account/wizard/account_validate_move_view.xml +++ b/addons/account/wizard/account_validate_move_view.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<openerp> +<odoo> <data> <!--Account Move lines--> @@ -39,4 +39,4 @@ </record> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/pos_box.py b/addons/account/wizard/pos_box.py index 9d9d7be7799..f720449d552 100644 --- a/addons/account/wizard/pos_box.py +++ b/addons/account/wizard/pos_box.py @@ -1,5 +1,5 @@ -from openerp import models, fields, api, _ -from openerp.exceptions import UserError +from odoo import models, fields, api, _ +from odoo.exceptions import UserError class CashBox(models.TransientModel): _register = False diff --git a/addons/account/wizard/pos_box.xml b/addons/account/wizard/pos_box.xml index 6588782eb33..f325c39a33c 100644 --- a/addons/account/wizard/pos_box.xml +++ b/addons/account/wizard/pos_box.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<openerp> +<odoo> <data> <record model="ir.ui.view" id="cash_box_in_form"> <field name="name">cash_box_in</field> @@ -56,4 +56,4 @@ key2="client_action_multi" id="action_cash_box_out" /> </data> -</openerp> +</odoo> diff --git a/addons/account/wizard/wizard_tax_adjustments.py b/addons/account/wizard/wizard_tax_adjustments.py index fa29d0b6bcb..8c5002347c0 100644 --- a/addons/account/wizard/wizard_tax_adjustments.py +++ b/addons/account/wizard/wizard_tax_adjustments.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from openerp import models, fields, api +from odoo import models, fields, api class TaxAdjustments(models.TransientModel): diff --git a/addons/account_bank_statement_import/account_journal.py b/addons/account_bank_statement_import/account_journal.py index 7964ecc9aec..0ddb88713fd 100644 --- a/addons/account_bank_statement_import/account_journal.py +++ b/addons/account_bank_statement_import/account_journal.py @@ -10,11 +10,8 @@ class AccountJournal(models.Model): @api.multi def import_statement(self): """return action to import bank/cash statements. This button should be called only on journals with type =='bank'""" - model = 'account.bank.statement' action_name = 'action_account_bank_statement_import' - ir_model_obj = self.pool['ir.model.data'] - model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account_bank_statement_import', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self.env.context) + [action] = self.env.ref('account_bank_statement_import.%s' % action_name).read() # Note: this drops action['context'], which is a dict stored as a string, which is not easy to update action.update({'context': (u"{'journal_id': " + str(self.id) + u"}")}) return action diff --git a/addons/account_check_printing/data/account_check_printing_data.xml b/addons/account_check_printing/data/account_check_printing_data.xml index 4fd632173af..95fd0ab2d20 100644 --- a/addons/account_check_printing/data/account_check_printing_data.xml +++ b/addons/account_check_printing/data/account_check_printing_data.xml @@ -16,7 +16,7 @@ <field name="model_id" ref="account.model_account_payment"/> <field name="code"> if context.get('active_model') == 'account.payment' and context.get('active_ids'): - action = self.pool['account.payment'].print_checks(cr, uid, context['active_ids'], context=context) + action = self.env['account.payment'].browse(context['active_ids']).print_checks() </field> </record> diff --git a/addons/account_tax_python/models/account_tax.py b/addons/account_tax_python/models/account_tax.py index 286d0e27969..01f8576ec8e 100644 --- a/addons/account_tax_python/models/account_tax.py +++ b/addons/account_tax_python/models/account_tax.py @@ -35,7 +35,7 @@ class AccountTaxPython(models.Model): return localdict['result'] return super(AccountTaxPython, self)._compute_amount(base_amount, price_unit, quantity, product, partner) - @api.v8 + @api.multi def compute_all(self, price_unit, currency=None, quantity=1.0, product=None, partner=None): taxes = self.env['account.tax'] company = self.env.user.company_id @@ -46,15 +46,6 @@ class AccountTaxPython(models.Model): taxes += tax return super(AccountTaxPython, taxes).compute_all(price_unit, currency, quantity, product, partner) - @api.v7 - def compute_all(self, cr, uid, ids, price_unit, currency_id=None, quantity=1.0, product_id=None, partner_id=None, context=None): - currency = currency_id and self.pool.get('res.currency').browse(cr, uid, currency_id, context=context) or None - product = product_id and self.pool.get('product.product').browse(cr, uid, product_id, context=context) or None - partner = partner_id and self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) or None - ids = isinstance(ids, (int, long)) and [ids] or ids - recs = self.browse(cr, uid, ids, context=context) - return AccountTaxPython.compute_all(recs, price_unit, currency, quantity, product, partner) - class AccountTaxTemplatePython(models.Model): _inherit = 'account.tax.template' |
