[REF] account_asset_management: the name of the company_currency_id field is changed to currency_id and currency_field is not required.
This commit is contained in:
parent
f1371e5b33
commit
12a018de43
@ -61,14 +61,12 @@ class AccountAsset(models.Model):
|
||||
purchase_value = fields.Monetary(
|
||||
required=True,
|
||||
states=READONLY_STATES,
|
||||
currency_field="company_currency_id",
|
||||
help="This amount represent the initial value of the asset."
|
||||
"\nThe Depreciation Base is calculated as follows:"
|
||||
"\nPurchase Value - Salvage Value.",
|
||||
)
|
||||
salvage_value = fields.Monetary(
|
||||
states=READONLY_STATES,
|
||||
currency_field="company_currency_id",
|
||||
help="The estimated value that an asset will realize upon "
|
||||
"its sale at the end of its useful life.\n"
|
||||
"This value is used to determine the depreciation amounts.",
|
||||
@ -76,20 +74,17 @@ class AccountAsset(models.Model):
|
||||
depreciation_base = fields.Monetary(
|
||||
compute="_compute_depreciation_base",
|
||||
store=True,
|
||||
currency_field="company_currency_id",
|
||||
help="This amount represent the depreciation base "
|
||||
"of the asset (Purchase Value - Salvage Value).",
|
||||
)
|
||||
value_residual = fields.Monetary(
|
||||
compute="_compute_depreciation",
|
||||
string="Residual Value",
|
||||
currency_field="company_currency_id",
|
||||
store=True,
|
||||
)
|
||||
value_depreciated = fields.Monetary(
|
||||
compute="_compute_depreciation",
|
||||
string="Depreciated Value",
|
||||
currency_field="company_currency_id",
|
||||
store=True,
|
||||
)
|
||||
note = fields.Text()
|
||||
@ -262,7 +257,7 @@ class AccountAsset(models.Model):
|
||||
readonly=True,
|
||||
default=lambda self: self._default_company_id(),
|
||||
)
|
||||
company_currency_id = fields.Many2one(
|
||||
currency_id = fields.Many2one(
|
||||
comodel_name="res.currency",
|
||||
related="company_id.currency_id",
|
||||
string="Company Currency",
|
||||
@ -514,7 +509,7 @@ class AccountAsset(models.Model):
|
||||
|
||||
def validate(self):
|
||||
for asset in self:
|
||||
if asset.company_currency_id.is_zero(asset.value_residual):
|
||||
if asset.currency_id.is_zero(asset.value_residual):
|
||||
asset.state = "close"
|
||||
else:
|
||||
asset.state = "open"
|
||||
|
@ -33,20 +33,17 @@ class AccountAssetLine(models.Model):
|
||||
depreciation_base = fields.Monetary(
|
||||
related="asset_id.depreciation_base",
|
||||
string="Depreciation Base",
|
||||
currency_field="company_currency_id",
|
||||
)
|
||||
amount = fields.Monetary(required=True, currency_field="company_currency_id")
|
||||
amount = fields.Monetary(required=True)
|
||||
remaining_value = fields.Monetary(
|
||||
compute="_compute_values",
|
||||
string="Next Period Depreciation",
|
||||
store=True,
|
||||
currency_field="company_currency_id",
|
||||
)
|
||||
depreciated_value = fields.Monetary(
|
||||
compute="_compute_values",
|
||||
string="Amount Already Depreciated",
|
||||
store=True,
|
||||
currency_field="company_currency_id",
|
||||
)
|
||||
line_date = fields.Date(string="Date", required=True)
|
||||
line_days = fields.Integer(string="Days", readonly=True)
|
||||
@ -74,7 +71,7 @@ class AccountAssetLine(models.Model):
|
||||
"for which Odoo has not generated accounting entries.",
|
||||
)
|
||||
company_id = fields.Many2one(related="asset_id.company_id", store=True)
|
||||
company_currency_id = fields.Many2one(
|
||||
currency_id = fields.Many2one(
|
||||
related="asset_id.company_id.currency_id", store=True, string="Company Currency"
|
||||
)
|
||||
|
||||
@ -281,7 +278,7 @@ class AccountAssetLine(models.Model):
|
||||
asset_ids.add(asset.id)
|
||||
# we re-evaluate the assets to determine if we can close them
|
||||
for asset in self.env["account.asset"].browse(list(asset_ids)):
|
||||
if asset.company_currency_id.is_zero(asset.value_residual):
|
||||
if asset.currency_id.is_zero(asset.value_residual):
|
||||
asset.state = "close"
|
||||
return created_move_ids
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
||||
groups="base.group_multi_company"
|
||||
/>
|
||||
<field
|
||||
name="company_currency_id"
|
||||
name="currency_id"
|
||||
groups="base.group_multi_currency"
|
||||
invisible="1"
|
||||
/>
|
||||
@ -174,7 +174,7 @@
|
||||
<field name="init_entry" string="Init" />
|
||||
<field name="move_check" />
|
||||
<field name="parent_state" invisible="1" />
|
||||
<field name="company_currency_id" invisible="1" />
|
||||
<field name="currency_id" invisible="1" />
|
||||
<button
|
||||
name="create_move"
|
||||
icon="fa-cog"
|
||||
@ -207,10 +207,7 @@
|
||||
name="depreciation_base"
|
||||
invisible="1"
|
||||
/>
|
||||
<field
|
||||
name="company_currency_id"
|
||||
invisible="1"
|
||||
/>
|
||||
<field name="currency_id" invisible="1" />
|
||||
<field name="type" />
|
||||
<field name="name" />
|
||||
<field
|
||||
@ -302,7 +299,7 @@
|
||||
decoration-info="state == 'draft'"
|
||||
decoration-muted="state == 'close'"
|
||||
/>
|
||||
<field name="company_currency_id" invisible="1" />
|
||||
<field name="currency_id" invisible="1" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -24,7 +24,7 @@ class AccountAssetRemove(models.TransientModel):
|
||||
required=True,
|
||||
default=lambda self: self._default_company_id(),
|
||||
)
|
||||
company_currency_id = fields.Many2one(
|
||||
currency_id = fields.Many2one(
|
||||
related="company_id.currency_id", string="Company Currency"
|
||||
)
|
||||
date_remove = fields.Date(
|
||||
@ -37,7 +37,6 @@ class AccountAssetRemove(models.TransientModel):
|
||||
force_date = fields.Date(string="Force accounting date")
|
||||
sale_value = fields.Monetary(
|
||||
default=lambda self: self._default_sale_value(),
|
||||
currency_field="company_currency_id",
|
||||
)
|
||||
account_sale_id = fields.Many2one(
|
||||
comodel_name="account.account",
|
||||
@ -107,7 +106,7 @@ class AccountAssetRemove(models.TransientModel):
|
||||
)
|
||||
for line in inv_lines:
|
||||
inv = line.move_id
|
||||
comp_curr = inv.company_currency_id
|
||||
comp_curr = inv.currency_id
|
||||
inv_curr = inv.currency_id
|
||||
if line.move_id.payment_state == "paid" or line.parent_state == "draft":
|
||||
account_sale_id = line.account_id.id
|
||||
|
Loading…
Reference in New Issue
Block a user