mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Improve calls to super with Python3
This commit is contained in:
committed by
OCA-git-bot
parent
63d0bba1cd
commit
05a2b6aeb8
@@ -249,7 +249,7 @@ class AccountAsset(models.Model):
|
||||
@api.multi
|
||||
@api.constrains('parent_id')
|
||||
def _check_recursion(self, parent=None):
|
||||
res = super(AccountAsset, self)._check_recursion(parent=parent)
|
||||
res = super()._check_recursion(parent=parent)
|
||||
if not res:
|
||||
raise UserError(
|
||||
_("Error ! You can not create recursive assets."))
|
||||
@@ -332,7 +332,7 @@ class AccountAsset(models.Model):
|
||||
vals['prorata'] = True
|
||||
if vals.get('type') == 'view':
|
||||
vals['date_start'] = False
|
||||
asset = super(AccountAsset, self).create(vals)
|
||||
asset = super().create(vals)
|
||||
if self.env.context.get('create_asset_from_move_line'):
|
||||
# Trigger compute of depreciation_base
|
||||
asset.salvage_value = 0.0
|
||||
@@ -345,7 +345,7 @@ class AccountAsset(models.Model):
|
||||
if vals.get('method_time'):
|
||||
if vals['method_time'] != 'year' and not vals.get('prorata'):
|
||||
vals['prorata'] = True
|
||||
res = super(AccountAsset, self).write(vals)
|
||||
res = super().write(vals)
|
||||
for asset in self:
|
||||
asset_type = vals.get('type') or asset.type
|
||||
if asset_type == 'view' or \
|
||||
@@ -392,7 +392,7 @@ class AccountAsset(models.Model):
|
||||
allow_asset_removal=True, from_parent_object=True
|
||||
).mapped('account_move_line_ids')
|
||||
amls.write({'asset_id': False})
|
||||
return super(AccountAsset, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
@api.model
|
||||
def name_search(self, name, args=None, operator='ilike', limit=100):
|
||||
|
||||
@@ -156,7 +156,7 @@ class AccountAssetLine(models.Model):
|
||||
raise UserError(_(
|
||||
"You cannot set the date on a depreciation line "
|
||||
"prior to already posted entries."))
|
||||
return super(AccountAssetLine, self).write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
|
||||
@@ -157,7 +157,7 @@ class AccountAssetProfile(models.Model):
|
||||
def create(self, vals):
|
||||
if vals.get('method_time') != 'year' and not vals.get('prorata'):
|
||||
vals['prorata'] = True
|
||||
profile = super(AccountAssetProfile, self).create(vals)
|
||||
profile = super().create(vals)
|
||||
acc_id = vals.get('account_asset_id')
|
||||
if acc_id:
|
||||
account = self.env['account.account'].browse(acc_id)
|
||||
@@ -170,7 +170,7 @@ class AccountAssetProfile(models.Model):
|
||||
if vals.get('method_time'):
|
||||
if vals['method_time'] != 'year' and not vals.get('prorata'):
|
||||
vals['prorata'] = True
|
||||
res = super(AccountAssetProfile, self).write(vals)
|
||||
res = super().write(vals)
|
||||
# TODO last profile in self is defined as default on the related
|
||||
# account. must be improved.
|
||||
account = self.env['account.account'].browse(
|
||||
|
||||
@@ -91,14 +91,14 @@ class AccountInvoice(models.Model):
|
||||
for inv in self:
|
||||
move = inv.move_id
|
||||
assets = move.line_ids.mapped('asset_id')
|
||||
super(AccountInvoice, self).action_cancel()
|
||||
super().action_cancel()
|
||||
if assets:
|
||||
assets.unlink()
|
||||
return True
|
||||
|
||||
@api.model
|
||||
def line_get_convert(self, line, part):
|
||||
res = super(AccountInvoice, self).line_get_convert(line, part)
|
||||
res = super().line_get_convert(line, part)
|
||||
if line.get('asset_profile_id'):
|
||||
# skip empty debit/credit
|
||||
if res.get('debit') or res.get('credit'):
|
||||
@@ -107,14 +107,14 @@ class AccountInvoice(models.Model):
|
||||
|
||||
@api.model
|
||||
def inv_line_characteristic_hashcode(self, invoice_line):
|
||||
res = super(AccountInvoice, self).inv_line_characteristic_hashcode(
|
||||
res = super().inv_line_characteristic_hashcode(
|
||||
invoice_line)
|
||||
res += '-%s' % invoice_line.get('asset_profile_id', 'False')
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def invoice_line_move_line_get(self):
|
||||
res = super(AccountInvoice, self).invoice_line_move_line_get()
|
||||
res = super().invoice_line_move_line_get()
|
||||
invoice_line_obj = self.env['account.invoice.line']
|
||||
for vals in res:
|
||||
if vals.get('invl_id'):
|
||||
@@ -143,4 +143,4 @@ class AccountInvoiceLine(models.Model):
|
||||
@api.onchange('account_id')
|
||||
def _onchange_account_id(self):
|
||||
self.asset_profile_id = self.account_id.asset_profile_id.id
|
||||
return super(AccountInvoiceLine, self)._onchange_account_id()
|
||||
return super()._onchange_account_id()
|
||||
|
||||
@@ -34,7 +34,7 @@ class AccountMove(models.Model):
|
||||
"\nYou should remove such entries from the asset."))
|
||||
# trigger store function
|
||||
deprs.write({'move_id': False})
|
||||
return super(AccountMove, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
@@ -45,7 +45,7 @@ class AccountMove(models.Model):
|
||||
raise UserError(
|
||||
_("You cannot change an accounting entry "
|
||||
"linked to an asset depreciation line."))
|
||||
return super(AccountMove, self).write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
@@ -91,7 +91,7 @@ class AccountMoveLine(models.Model):
|
||||
create_asset_from_move_line=True,
|
||||
move_id=vals['move_id']).create(asset_vals)
|
||||
vals['asset_id'] = asset.id
|
||||
return super(AccountMoveLine, self).create(vals)
|
||||
return super().create(vals)
|
||||
|
||||
@api.multi
|
||||
def _prepare_asset_create(self, vals):
|
||||
@@ -147,7 +147,7 @@ class AccountMoveLine(models.Model):
|
||||
create_asset_from_move_line=True,
|
||||
move_id=aml.move_id.id).create(asset_vals)
|
||||
vals['asset_id'] = asset.id
|
||||
return super(AccountMoveLine, self).write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
@api.model
|
||||
def _get_asset_analytic_values(self, vals, asset_vals):
|
||||
|
||||
@@ -28,7 +28,7 @@ class DateRange(models.Model):
|
||||
}
|
||||
self.env['account.asset.recompute.trigger'].sudo().create(
|
||||
recompute_vals)
|
||||
return super(DateRange, self).create(vals)
|
||||
return super().create(vals)
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
@@ -47,4 +47,4 @@ class DateRange(models.Model):
|
||||
}
|
||||
self.env['account.asset.recompute.trigger'].sudo().\
|
||||
create(recompute_vals)
|
||||
return super(DateRange, self).write(vals)
|
||||
return super().write(vals)
|
||||
|
||||
@@ -20,7 +20,7 @@ class TestAssetManagement(common.TransactionCase):
|
||||
self.registry._assertion_report)
|
||||
|
||||
def setUp(self):
|
||||
super(TestAssetManagement, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self._load('account', 'test', 'account_minimal_test.xml')
|
||||
self._load('account_asset_management', 'tests',
|
||||
|
||||
Reference in New Issue
Block a user