[MIG] account: Migrate remaining old API chuncks of code
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import api, fields, models, _
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class AccountAnalyticLine(models.Model):
|
||||
|
||||
@@ -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', []))
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import fields, models, api, _
|
||||
from odoo import fields, models, api, _
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp import api, models
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class PlannerAccount(models.Model):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
from openerp import api, models
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ReportTrialBalance(models.AbstractModel):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
from openerp import api, models
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ReportGeneralLedger(models.AbstractModel):
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
from openerp import api, models
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ReportJournal(models.AbstractModel):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
from openerp import api, models
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ReportFinancial(models.AbstractModel):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/*global openerp:false */
|
||||
|
||||
odoo.define('account.reconciliation', function (require) {
|
||||
"use strict";
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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': '/',
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from openerp.tests import HttpCase
|
||||
from odoo.tests import HttpCase
|
||||
|
||||
class TestUi(HttpCase):
|
||||
post_install = True
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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}
|
||||
])
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- QWeb Reports -->
|
||||
<report
|
||||
@@ -88,4 +88,4 @@
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import api, fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountingReport(models.TransientModel):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import api, fields, models, _
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class AccountCommonReport(models.TransientModel):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import api, fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountCommonAccountReport(models.TransientModel):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import api, fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountCommonJournalReport(models.TransientModel):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountingCommonPartnerReport(models.TransientModel):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountPrintJournal(models.TransientModel):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountBalanceReport(models.TransientModel):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from openerp import models, api
|
||||
from odoo import models, api
|
||||
|
||||
|
||||
class AccountUnreconcile(models.TransientModel):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user