[MIG] account_asset_management: Migration to v14

TT26410
This commit is contained in:
João Marques
2021-01-14 07:53:25 +00:00
parent ff25e6269e
commit a88ea6e7bf
20 changed files with 212 additions and 319 deletions

View File

@@ -1,4 +1,5 @@
# Copyright 2009-2018 Noviat
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
@@ -58,11 +59,11 @@ class AccountMove(models.Model):
)
return super().write(vals)
def post(self):
super().post()
def action_post(self):
super().action_post()
for move in self:
for aml in move.line_ids.filtered("asset_profile_id"):
depreciation_base = aml.debit or -aml.credit
depreciation_base = aml.price_subtotal
vals = {
"name": aml.name,
"code": move.name,