[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 with6120babb45and 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:eb8d4aaa59opw:703860,702265
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -433,6 +433,16 @@ msgstr ""
|
||||
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"
|
||||
@@ -871,8 +881,14 @@ msgstr ""
|
||||
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 ""
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user