[FIX] account_asset_invoice: setting account_id on an invoice line with an asset
Thanks to this commit: 342dad44cd
(1) Asset Account
(2) Depreciation Entries: Asset Account
(3) Depreciation Entries: Expense Account
Now it's possible in 9.0 to set the account_income_recognition_id.
So in the case of a vendor bill if the account_income_recognition_id(3) is set,
it means that the depreciation entries are debited on this account(3).
Then the asset account can be used on the invoice line.
NB: When the account_income_recognition_id(3) is not set, it means that
The Asset Account(1) is used to debit the depreciation entries so it cannot be used as an asset account.
In this case, (1) is used as (3)
And the Depreciation Entries: Asset Account(2) is used as (1) and (2) because the all assets are first debited
on this account and progressively the depreciation entries are credited on this account too.
This is why in 10.0, there is an onchange on account_asset_id on model "account.asset.category" which sets
the same value for (1) and (2).
Example with account_income_recognition_id set: Purchase of 100k with a 5 years depreciation:
on (1) debit=100k and credit=0
on (2) each year debit=0 and credit=20k
on (3) each year debit=20k and credit=0
Example without account_income_recognition_id set: Purchase of 100k with a 5 years depreciation:
on (2) debit=100k and credit=0
on (2) each year debit=0 and credit=20k
on (1) each year debit=20k and credit=0
This behavior can be analysed in function create_move on model "account.asset.depreciation.line"
opw:702265
This commit is contained in:
@@ -77,7 +77,11 @@ class AccountInvoiceLine(models.Model):
|
||||
if self.invoice_id.type == 'out_invoice' and self.asset_category_id:
|
||||
self.account_id = self.asset_category_id.account_asset_id.id
|
||||
elif self.invoice_id.type == 'in_invoice' and self.asset_category_id:
|
||||
self.account_id = self.asset_category_id.account_depreciation_id.id
|
||||
#DO NOT FORWARDPORT
|
||||
if self.asset_category_id.account_income_recognition_id:
|
||||
self.account_id = self.asset_category_id.account_asset_id.id
|
||||
else:
|
||||
self.account_id = self.asset_category_id.account_depreciation_id.id
|
||||
|
||||
@api.onchange('uom_id')
|
||||
def _onchange_uom_id(self):
|
||||
|
||||
Reference in New Issue
Block a user