mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] Create function search domain asset lines
This commit is contained in:
@@ -1203,6 +1203,15 @@ class AccountAsset(models.Model):
|
||||
"""use this method to customise the name of the accounting entry"""
|
||||
return (self.code or str(self.id)) + "/" + str(seq)
|
||||
|
||||
def _get_asset_line_domain(self, date_end):
|
||||
return [
|
||||
("asset_id", "in", self.ids),
|
||||
("type", "=", "depreciate"),
|
||||
("init_entry", "=", False),
|
||||
("line_date", "<=", date_end),
|
||||
("move_check", "=", False),
|
||||
]
|
||||
|
||||
def _compute_entries(self, date_end, check_triggers=False):
|
||||
# TODO : add ir_cron job calling this method to
|
||||
# generate periodical accounting entries
|
||||
@@ -1218,13 +1227,7 @@ class AccountAsset(models.Model):
|
||||
asset.compute_depreciation_board()
|
||||
|
||||
depreciations = self.env["account.asset.line"].search(
|
||||
[
|
||||
("asset_id", "in", self.ids),
|
||||
("type", "=", "depreciate"),
|
||||
("init_entry", "=", False),
|
||||
("line_date", "<=", date_end),
|
||||
("move_check", "=", False),
|
||||
],
|
||||
self._get_asset_line_domain(date_end),
|
||||
order="line_date",
|
||||
)
|
||||
for depreciation in depreciations:
|
||||
|
||||
Reference in New Issue
Block a user