[MIG] account_asset: Migrate to new API

This commit is contained in:
Denis Vermylen (dve)
2016-08-05 11:05:35 +02:00
committed by Yannick Tivisse
parent d43cdd696c
commit 62a1c97d37
16 changed files with 38 additions and 32 deletions
+1
View File
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import models
import wizard
+1 -7
View File
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Assets Management',
'version': '1.0',
'depends': ['account_accountant'],
'description': """
Assets management
@@ -17,10 +17,6 @@ Keeps track of depreciations, and creates corresponding journal entries.
'demo': [
'data/account_asset_demo.yml',
],
# 'test': [
# '../account/test/account_minimal_test.xml',
# 'test/account_asset_demo_test.xml',
# ],
'data': [
'security/account_asset_security.xml',
'security/ir.model.access.csv',
@@ -36,6 +32,4 @@ Keeps track of depreciations, and creates corresponding journal entries.
'qweb': [
"static/src/xml/account_asset_template.xml",
],
'installable': True,
'application': False,
}
+1
View File
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
+4 -3
View File
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from openerp import api, fields, models, _
from openerp.exceptions import UserError, ValidationError
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
class AccountAssetCategory(models.Model):
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp import api, fields, models
from openerp.exceptions import Warning
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo import api, fields, models
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
import odoo.addons.decimal_precision as dp
class AccountInvoice(models.Model):
@@ -85,7 +85,6 @@ class AccountInvoiceLine(models.Model):
self.onchange_asset_category_id()
return result
@api.onchange('product_id')
def _onchange_product_id(self):
vals = super(AccountInvoiceLine, self)._onchange_product_id()
+1
View File
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
+1
View File
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import account_asset_report
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import fields, models, tools
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class AssetAssetReport(models.Model):
@@ -24,9 +26,9 @@ class AssetAssetReport(models.Model):
unposted_value = fields.Float(string='Unposted Amount', readonly=True)
company_id = fields.Many2one('res.company', string='Company', readonly=True)
def init(self, cr):
tools.drop_view_if_exists(cr, 'asset_asset_report')
cr.execute("""
@api.model_cr
def init(self):
self._cr.execute("""
create or replace view asset_asset_report as (
select
min(dl.id) as id,
@@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!--
+1 -2
View File
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
#
##############################################################################
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_account_asset
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import tools
from openerp.tests import common
from openerp.modules.module import get_module_resource
from odoo import tools
from odoo.tests import common
from odoo.modules.module import get_resource_path
class TestAccountAsset(common.TransactionCase):
def _load(self, module, *args):
tools.convert_file(self.cr, 'account_asset',
get_module_resource(module, *args),
get_resource_path(module, *args),
{}, 'init', False, 'test', self.registry._assertion_report)
def test_00_account_asset_asset(self):
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Add "Asset Category" to supplier invoices -->
+1
View File
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import asset_depreciation_confirmation_wizard
import asset_modify
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class AssetDepreciationConfirmationWizard(models.TransientModel):
+5 -3
View File
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from lxml import etree
from openerp import api, fields, models
from openerp.osv.orm import setup_modifiers
from openerp.tools.translate import _
from odoo import api, fields, models, _
from odoo.osv.orm import setup_modifiers
class AssetModify(models.TransientModel):
_name = 'asset.modify'