diff options
| author | Goffin Simon <sig@odoo.com> | 2017-01-16 14:32:17 +0100 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2017-01-17 09:53:58 +0100 |
| commit | 342dad44cd78e1567bc9e7ae95a75be8adb26c4e (patch) | |
| tree | cd20447fd07aeda95a1de9d999f09f02e76c4a68 | |
| parent | 77767801c6b40766dd5e8dc76f3f6e3d56bbe9be (diff) | |
[FIX] account_asset: To ensure the migration compatibility with 9.0
This fix allow to keep the same behavior of 8.0 and 10.0 to manage the assets.
In 9.0, the field account_income_recognition_id(oldname='account_expense_depreciation_id') has been
deleted from the account.asset.category.form view with 6120babb4569cb846dacaae885cd2ba27f587d06 and
then it was not possible to manage the assets like in 8.0 and 10.0
But as this fix is in a stable version, it must be compatible with instances without any upgrade
of the view account.asset.category.form.
This issue has been solved in saas-11 with this commit: eb8d4aaa59562b41704c715202d0c794fd950a0b
opw:703860,702265
| -rw-r--r-- | addons/account_asset/account_asset.py | 7 | ||||
| -rw-r--r-- | addons/account_asset/i18n/account_asset.pot | 16 | ||||
| -rw-r--r-- | addons/account_asset/views/account_asset_view.xml | 15 |
3 files changed, 30 insertions, 8 deletions
diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 0939f1beebc..b829779ae73 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -18,8 +18,9 @@ class AccountAssetCategory(models.Model): name = fields.Char(required=True, index=True, string="Asset Type") account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account', domain=[('account_type', '=', 'normal')]) account_asset_id = fields.Many2one('account.account', string='Asset Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)]) - account_income_recognition_id = fields.Many2one('account.account', string='Recognition Income Account', domain=[('internal_type','=','other'), ('deprecated', '=', False)], oldname='account_expense_depreciation_id') - account_depreciation_id = fields.Many2one('account.account', string='Depreciation Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)]) + account_income_recognition_id = fields.Many2one('account.account', string='Depreciation Entries: Expense Account', domain=[('internal_type','=','other'), ('deprecated', '=', False)], oldname='account_expense_depreciation_id', + help="Account used in the periodical entries, to record a part of the asset as expense. But the asset account is used if empty.") + account_depreciation_id = fields.Many2one('account.account', string='Depreciation Entries: Asset Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)]) journal_id = fields.Many2one('account.journal', string='Journal', required=True) company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env['res.company']._company_default_get('account.asset.category')) method = fields.Selection([('linear', 'Linear'), ('degressive', 'Degressive')], string='Computation Method', required=True, default='linear', @@ -436,7 +437,7 @@ class AccountAssetDepreciationLine(models.Model): journal_id = line.asset_id.category_id.journal_id.id partner_id = line.asset_id.partner_id.id categ_type = line.asset_id.category_id.type - debit_account = line.asset_id.category_id.account_asset_id.id + debit_account = line.asset_id.category_id.account_income_recognition_id.id or line.asset_id.category_id.account_asset_id.id credit_account = line.asset_id.category_id.account_depreciation_id.id prec = self.env['decimal.precision'].precision_get('Account') move_line_1 = { diff --git a/addons/account_asset/i18n/account_asset.pot b/addons/account_asset/i18n/account_asset.pot index c64d5b9df1f..8124cf53b82 100644 --- a/addons/account_asset/i18n/account_asset.pot +++ b/addons/account_asset/i18n/account_asset.pot @@ -434,6 +434,16 @@ msgid "Depreciation Entry" msgstr "" #. module: account_asset +#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_account_depreciation_id +msgid "Depreciation Entries: Asset Account" +msgstr "" + +#. module: account_asset +#: model:ir.model.fields,field_description:account_asset.field_account_asset_category_account_income_recognition_id +msgid "Depreciation Entries: Expense Account" +msgstr "" + +#. module: account_asset #: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form msgid "Depreciation Expense Account" msgstr "" @@ -872,7 +882,13 @@ msgid "Reason" msgstr "" #. module: account_asset +#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form +msgid "Recognition Account" +msgstr "" + +#. module: account_asset #: model:ir.model.fields,field_description:account_asset.field_account_asset_category_account_income_recognition_id +#: model:ir.ui.view,arch_db:account_asset.view_account_asset_category_form msgid "Recognition Income Account" msgstr "" diff --git a/addons/account_asset/views/account_asset_view.xml b/addons/account_asset/views/account_asset_view.xml index a67f4e1bd9c..35b98dd403e 100644 --- a/addons/account_asset/views/account_asset_view.xml +++ b/addons/account_asset/views/account_asset_view.xml @@ -23,17 +23,22 @@ </group> <group string="Journal Entries"> <field name="journal_id"/> + <!-- DO NOT FORWARDPORT --> <div> - <label for="account_asset_id" string="Depreciation Asset Account" attrs="{'invisible': [('type','!=','purchase')]}"/> - <!-- DO NOT FORWARDPORT --> - <label for="account_asset_id" string="Income Account" attrs="{'invisible': [('type','!=','sale')]}"/> + <label for="account_asset_id" attrs="{'invisible': [('type','!=','purchase')]}"/> + <label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/> </div> <field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/> <div> - <label for="account_depreciation_id" string="Depreciation Expense Account" attrs="{'invisible': [('type','!=','purchase')]}"/> - <label for="account_depreciation_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/> + <label for="account_depreciation_id" attrs="{'invisible': [('type','!=','purchase')]}"/> + <label for="account_depreciation_id" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/> </div> <field name="account_depreciation_id" nolabel="1"/> + <div> + <label for="account_income_recognition_id" attrs="{'invisible': [('type','!=','purchase')]}"/> + <label for="account_income_recognition_id" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/> + </div> + <field name="account_income_recognition_id" nolabel="1"/> <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/> </group> <group string="Periodicity"> |
