Skip to content

Commit e283826

Browse files
committed
[MIG] assets_management filtering only compulsory changes from #2704
1 parent 772b6d2 commit e283826

38 files changed

Lines changed: 1078 additions & 2257 deletions

assets_management/__manifest__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
{
66
"name": "ITA - Gestione Cespiti",
7-
"version": "12.0.1.0.0",
7+
"version": "14.0.1.0.0",
88
"category": "Localization/Italy",
99
"summary": "Gestione Cespiti",
1010
"author": "Openforce, Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/l10n-italy" "/tree/12.0/assets_management",
1212
"license": "AGPL-3",
1313
"depends": [
1414
"account",
15-
"account_cancel",
1615
"account_financial_report",
1716
"account_fiscal_year",
1817
"mail",
@@ -30,7 +29,6 @@
3029
"report/reports.xml",
3130
"views/action_client.xml",
3231
"views/asset_menuitems.xml",
33-
"views/account_invoice.xml",
3432
"views/account_move.xml",
3533
"views/asset.xml",
3634
"views/asset_accounting_info.xml",
@@ -41,7 +39,6 @@
4139
"views/asset_depreciation_mode.xml",
4240
"views/asset_depreciation_type.xml",
4341
"views/asset_tag.xml",
44-
"wizard/account_invoice_manage_asset_view.xml",
4542
"wizard/account_move_manage_asset_view.xml",
4643
"wizard/asset_generate_depreciation_view.xml",
4744
"wizard/asset_journal_report_view.xml",

assets_management/data/asset_data.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<odoo noupdate="0">
2+
<odoo noupdate="1">
33

44
<!-- Natura ammortamento -->
55
<record id="ad_type_civilistico" model="asset.depreciation.type">

assets_management/models/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
from . import account_account
66
from . import account_fiscal_year
7-
from . import account_invoice
8-
from . import account_invoice_line
97
from . import account_journal
108
from . import account_move
119
from . import account_move_line

assets_management/models/account_account.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
# Copyright 2019 Openforce Srls Unipersonale (www.openforce.it)
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

5-
from odoo import _, api, models
5+
from odoo import _, models
66
from odoo.exceptions import UserError
77

88

99
class AccountAccount(models.Model):
1010
_inherit = "account.account"
1111

12-
@api.multi
1312
def unlink(self):
1413
if (
1514
self.env["asset.category"]

assets_management/models/account_invoice.py

Lines changed: 0 additions & 128 deletions
This file was deleted.

assets_management/models/account_invoice_line.py

Lines changed: 0 additions & 92 deletions
This file was deleted.

assets_management/models/account_journal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
# Copyright 2019 Openforce Srls Unipersonale (www.openforce.it)
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

5-
from odoo import _, api, models
5+
from odoo import _, models
66
from odoo.exceptions import UserError
77

88

99
class AccountJournal(models.Model):
1010
_inherit = "account.journal"
1111

12-
@api.multi
1312
def unlink(self):
1413
if (
1514
self.env["asset.category"]

assets_management/models/account_move.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def check_company(self):
4242
).format(move.name_get()[0][-1])
4343
)
4444

45-
@api.multi
4645
def button_cancel(self):
4746
res = super().button_cancel()
4847
if self:
@@ -55,7 +54,6 @@ def button_cancel(self):
5554
dep_lines.filtered(lambda l: not l.asset_accounting_info_ids).unlink()
5655
return res
5756

58-
@api.multi
5957
@api.depends(
6058
"asset_accounting_info_ids",
6159
"asset_accounting_info_ids.asset_id",
@@ -75,27 +73,29 @@ def _compute_asset_data(self):
7573
}
7674
)
7775

78-
@api.multi
7976
def _compute_hide_link_asset_button(self):
80-
valid_account_ids = self.get_valid_accounts()
77+
valid_account_ids = (
78+
self.get_valid_accounts()
79+
) # todo verificare che venga fatto solo su invoice_line_ids
8180
if not valid_account_ids:
8281
self.update({"hide_link_asset_button": True})
8382
else:
8483
for move in self:
8584
move.hide_link_asset_button = (
8685
not any(
8786
[
88-
l.account_id.id in valid_account_ids.ids
89-
for l in move.line_ids
87+
line.account_id.id in valid_account_ids.ids
88+
for line in move.line_ids
9089
]
9190
)
9291
or move.state != "posted"
9392
)
9493

95-
@api.multi
9694
def open_wizard_manage_asset(self):
9795
self.ensure_one()
98-
lines = self.line_ids.filtered(lambda l: not l.asset_accounting_info_ids)
96+
lines = self.line_ids.filtered(
97+
lambda line: not line.asset_accounting_info_ids
98+
) # todo verificare che venga fatto solo su invoice_line_ids
9999
if not lines:
100100
raise ValidationError(_("Every line is already linked to an asset."))
101101

@@ -105,11 +105,12 @@ def open_wizard_manage_asset(self):
105105
ctx.update(
106106
{
107107
"default_company_id": self.company_id.id,
108-
"default_dismiss_date": self.date or fields.Date.today(),
108+
"default_dismiss_date": self.invoice_date or self.invoice_date_due,
109109
"default_move_ids": [(6, 0, self.ids)],
110110
"default_move_line_ids": [(6, 0, lines.ids)],
111-
"default_purchase_date": self.date or fields.Date.today(),
111+
"default_purchase_date": self.invoice_date or self.invoice_date_due,
112112
"move_ids": self.ids,
113+
# "default_move_type": "entry", # todo verificare
113114
}
114115
)
115116
act.update({"context": ctx})

0 commit comments

Comments
 (0)