diff --git a/l10n_it_asset_management/README.rst b/l10n_it_asset_management/README.rst
index fd096a46402d..0cc435f94d6d 100644
--- a/l10n_it_asset_management/README.rst
+++ b/l10n_it_asset_management/README.rst
@@ -50,6 +50,11 @@ Depreciations can be generated by using the related wizard found in
Assets -> Assets Management -> Generate Depreciations, or by triggering
the same wizard from a single asset form view.
+When an asset is returned, it is possible to recharge its purchase and
+fund amounts choosing "Partial Recharge" in the "Link to Asset" wizard
+of the credit note. The wizard will allow to link to the credit note
+only the assets of the refunded invoice.
+
**Italiano**
È possibile creare e gestire cespiti dalla sezione contabilità di Odoo.
@@ -63,6 +68,11 @@ contabili. Gli ammortamenti possono essere generati utilizzando
l'apposito wizard in Cespiti -> Gestione Cestpiti -> Genera
Ammortamenti, o aprendo quello stesso wizard dalla scheda del cespite.
+Quando un cespite viene restituito, è possibile ricaricare gli importi
+di acquisto e di fondo scegliendo "Ricarica parziale" nella procedura
+"Collega a cespite" della nota di credito. La procedura consentirà di
+collegare alla nota di credito solo i cespiti della fattura rimborsata.
+
Bug Tracker
===========
@@ -99,8 +109,7 @@ Contributors
- Nextev Srl
Base icon made by `surang `__
-from
-[`www.flaticon.com](https://www.flaticon.com/) `__.
+from `www.flaticon.com `__.
Maintainers
-----------
diff --git a/l10n_it_asset_management/models/account_move.py b/l10n_it_asset_management/models/account_move.py
index 6f13756a8516..048384155e8f 100644
--- a/l10n_it_asset_management/models/account_move.py
+++ b/l10n_it_asset_management/models/account_move.py
@@ -107,6 +107,7 @@ def open_wizard_manage_asset(self):
{
"default_company_id": self.company_id.id,
"default_dismiss_date": self.invoice_date or self.invoice_date_due,
+ "default_recharge_date": self.invoice_date or self.invoice_date_due,
"default_move_ids": [Command.set(self.ids)],
"default_move_line_ids": [Command.set(lines.ids)],
"default_purchase_date": self.invoice_date or self.invoice_date_due,
diff --git a/l10n_it_asset_management/models/asset_accounting_info.py b/l10n_it_asset_management/models/asset_accounting_info.py
index 94e3a7c03bfa..bd0d26a710e0 100644
--- a/l10n_it_asset_management/models/asset_accounting_info.py
+++ b/l10n_it_asset_management/models/asset_accounting_info.py
@@ -51,6 +51,7 @@ class AssetAccountingInfo(models.Model):
relation_type = fields.Selection(
[
("create", "Asset Creation"),
+ ("partial_recharge", "Partial Recharge"),
("update", "Asset Update"),
("partial_dismiss", "Asset Partial Dismissal"),
("dismiss", "Asset Dismissal"),
diff --git a/l10n_it_asset_management/models/asset_depreciation.py b/l10n_it_asset_management/models/asset_depreciation.py
index 994d50671c25..ea2f33ef241d 100644
--- a/l10n_it_asset_management/models/asset_depreciation.py
+++ b/l10n_it_asset_management/models/asset_depreciation.py
@@ -252,7 +252,7 @@ def _compute_last_depreciation_date(self):
for dep in self:
dep_lines = dep.line_ids.filtered(
lambda line: line.move_type == "depreciated"
- and not line.partial_dismissal
+ and not (line.partial_dismissal or line.partial_recharge)
)
if dep_lines:
dep.last_depreciation_date = max(dep_lines.mapped("date"))
diff --git a/l10n_it_asset_management/models/asset_depreciation_line.py b/l10n_it_asset_management/models/asset_depreciation_line.py
index 40296df2b197..500787877b12 100644
--- a/l10n_it_asset_management/models/asset_depreciation_line.py
+++ b/l10n_it_asset_management/models/asset_depreciation_line.py
@@ -100,6 +100,7 @@ class AssetDepreciationLine(models.Model):
)
partial_dismissal = fields.Boolean()
+ partial_recharge = fields.Boolean()
percentage = fields.Float(string="%")
@@ -265,9 +266,8 @@ def get_update_move_types(self):
def is_depreciation_nr_required(self):
"""Defines if a line requires to be numbered"""
self.ensure_one()
- return (
- self.move_type in self.get_numbered_move_types()
- and not self.partial_dismissal
+ return self.move_type in self.get_numbered_move_types() and not (
+ self.partial_dismissal or self.partial_recharge
)
def make_name(self):
@@ -394,15 +394,22 @@ def get_depreciated_account_move_line_vals(self):
self.ensure_one()
# Asset depreciation
- if not self.partial_dismissal:
+ if not (self.partial_dismissal or self.partial_recharge):
credit_account_id = self.asset_id.category_id.fund_account_id.id
debit_account_id = self.asset_id.category_id.depreciation_account_id.id
- # Asset partial dismissal
else:
+ # Asset partial dismissal
debit_account_id = self.asset_id.category_id.fund_account_id.id
credit_account_id = self.asset_id.category_id.asset_account_id.id
+ # Asset partial recharge
+ if self.partial_recharge:
+ credit_account_id, debit_account_id = (
+ debit_account_id,
+ credit_account_id,
+ )
+
amt = abs(self.amount)
credit_line_vals = {
"account_id": credit_account_id,
@@ -495,3 +502,6 @@ def post_partial_dismiss_asset(self):
)
if to_create_move:
to_create_move.generate_account_move()
+
+ def post_partial_recharge_asset(self):
+ return self.post_partial_dismiss_asset()
diff --git a/l10n_it_asset_management/readme/USAGE.md b/l10n_it_asset_management/readme/USAGE.md
index 75a337b11f92..809dc498e223 100644
--- a/l10n_it_asset_management/readme/USAGE.md
+++ b/l10n_it_asset_management/readme/USAGE.md
@@ -10,6 +10,9 @@ Depreciations can be generated by using the related wizard found in
Assets -\> Assets Management -\> Generate Depreciations, or by
triggering the same wizard from a single asset form view.
+When an asset is returned, it is possible to recharge its purchase and fund amounts choosing "Partial Recharge" in the "Link to Asset" wizard of the credit note.
+The wizard will allow to link to the credit note only the assets of the refunded invoice.
+
**Italiano**
È possibile creare e gestire cespiti dalla sezione contabilità di Odoo.
@@ -22,3 +25,6 @@ I cespiti possono essere creati manualmente o da fatture e registrazioni
contabili. Gli ammortamenti possono essere generati utilizzando
l'apposito wizard in Cespiti -\> Gestione Cestpiti -\> Genera
Ammortamenti, o aprendo quello stesso wizard dalla scheda del cespite.
+
+Quando un cespite viene restituito, è possibile ricaricare gli importi di acquisto e di fondo scegliendo "Ricarica parziale" nella procedura "Collega a cespite" della nota di credito.
+La procedura consentirà di collegare alla nota di credito solo i cespiti della fattura rimborsata.
diff --git a/l10n_it_asset_management/report/asset_journal.py b/l10n_it_asset_management/report/asset_journal.py
index f00a7ece325a..fa9abe8fbfd0 100644
--- a/l10n_it_asset_management/report/asset_journal.py
+++ b/l10n_it_asset_management/report/asset_journal.py
@@ -728,7 +728,7 @@ def get_report_dep_line_year_data(self):
line.amount
for line in self.dep_line_ids.filtered(
lambda line: line.move_type == "depreciated"
- and not line.partial_dismissal
+ and not (line.partial_dismissal or line.partial_recharge)
)
]
)
@@ -737,7 +737,7 @@ def get_report_dep_line_year_data(self):
line.amount
for line in self.dep_line_ids.filtered(
lambda line: line.move_type == "depreciated"
- and line.partial_dismissal
+ and (line.partial_dismissal or line.partial_recharge)
)
]
)
diff --git a/l10n_it_asset_management/report/asset_previsional.py b/l10n_it_asset_management/report/asset_previsional.py
index efe2d0e9aabf..a2cb7b52f564 100644
--- a/l10n_it_asset_management/report/asset_previsional.py
+++ b/l10n_it_asset_management/report/asset_previsional.py
@@ -245,7 +245,9 @@ def generate_structure(self):
if fyear.date_to >= dep.date_start:
prev = not lines or not any(
line.move_type == "depreciated"
- and not line.partial_dismissal
+ and not (
+ line.partial_dismissal or line.partial_recharge
+ )
for line in lines
)
sequence += 1
@@ -797,7 +799,7 @@ def get_report_dep_line_year_data(self):
line.amount
for line in self.dep_line_ids.filtered(
lambda line: line.move_type == "depreciated"
- and not line.partial_dismissal
+ and not (line.partial_dismissal or line.partial_recharge)
)
]
)
@@ -806,7 +808,7 @@ def get_report_dep_line_year_data(self):
line.amount
for line in self.dep_line_ids.filtered(
lambda line: line.move_type == "depreciated"
- and line.partial_dismissal
+ and (line.partial_dismissal or line.partial_recharge)
)
]
)
diff --git a/l10n_it_asset_management/static/description/index.html b/l10n_it_asset_management/static/description/index.html
index e8d20b8bfad4..bd6937de2970 100644
--- a/l10n_it_asset_management/static/description/index.html
+++ b/l10n_it_asset_management/static/description/index.html
@@ -394,6 +394,10 @@
Depreciations can be generated by using the related wizard found in
Assets -> Assets Management -> Generate Depreciations, or by triggering
the same wizard from a single asset form view.
+
When an asset is returned, it is possible to recharge its purchase and
+fund amounts choosing “Partial Recharge” in the “Link to Asset” wizard
+of the credit note. The wizard will allow to link to the credit note
+only the assets of the refunded invoice.
Italiano
È possibile creare e gestire cespiti dalla sezione contabilità di Odoo.
La configurazione dei cespiti dev’essere fatta andando in Cespiti ->
@@ -403,6 +407,10 @@
contabili. Gli ammortamenti possono essere generati utilizzando
l’apposito wizard in Cespiti -> Gestione Cestpiti -> Genera
Ammortamenti, o aprendo quello stesso wizard dalla scheda del cespite.
+
Quando un cespite viene restituito, è possibile ricaricare gli importi
+di acquisto e di fondo scegliendo “Ricarica parziale” nella procedura
+“Collega a cespite” della nota di credito. La procedura consentirà di
+collegare alla nota di credito solo i cespiti della fattura rimborsata.