mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[IMP] account_asset_management: Simplify code for opening related entries
We don't need the search having the one2many field and no need also for list comprehension having mapped operator.
This commit is contained in:
@@ -443,9 +443,6 @@ class AccountAsset(models.Model):
|
||||
@api.multi
|
||||
def open_entries(self):
|
||||
self.ensure_one()
|
||||
amls = self.env['account.move.line'].search(
|
||||
[('asset_id', '=', self.id)], order='date ASC')
|
||||
am_ids = [l.move_id.id for l in amls]
|
||||
# needed for avoiding errors after grouping in assets
|
||||
context = dict(self.env.context)
|
||||
context.pop('group_by', None)
|
||||
@@ -457,7 +454,8 @@ class AccountAsset(models.Model):
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'context': context,
|
||||
'domain': [('id', 'in', am_ids)],
|
||||
'domain': [
|
||||
('id', 'in', self.account_move_line_ids.mapped('move_id').ids)]
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user