2
0

[IMP] : pre-commit stuff

This commit is contained in:
Alexis de Lattre 2022-11-29 23:30:33 +01:00 committed by Rodrigo
parent 0466dc9c43
commit 3c5d26b456
10 changed files with 129 additions and 91 deletions

View File

@ -11,7 +11,8 @@ class AccountAccount(models.Model):
asset_profile_id = fields.Many2one( asset_profile_id = fields.Many2one(
comodel_name="account.asset.profile", comodel_name="account.asset.profile",
string="Asset Profile", string="Asset Profile",
help="Default Asset Profile when creating invoice lines " "with this account.", check_company=True,
help="Default Asset Profile when creating invoice lines with this account.",
) )
@api.constrains("asset_profile_id") @api.constrains("asset_profile_id")

View File

@ -58,37 +58,41 @@ class AccountAsset(models.Model):
size=32, size=32,
states=READONLY_STATES, states=READONLY_STATES,
) )
purchase_value = fields.Float( purchase_value = fields.Monetary(
string="Purchase Value",
required=True, required=True,
states=READONLY_STATES, states=READONLY_STATES,
currency_field="company_currency_id",
help="This amount represent the initial value of the asset." help="This amount represent the initial value of the asset."
"\nThe Depreciation Base is calculated as follows:" "\nThe Depreciation Base is calculated as follows:"
"\nPurchase Value - Salvage Value.", "\nPurchase Value - Salvage Value.",
) )
salvage_value = fields.Float( salvage_value = fields.Monetary(
digits="Account", string="Salvage Value",
states=READONLY_STATES, states=READONLY_STATES,
currency_field="company_currency_id",
help="The estimated value that an asset will realize upon " help="The estimated value that an asset will realize upon "
"its sale at the end of its useful life.\n" "its sale at the end of its useful life.\n"
"This value is used to determine the depreciation amounts.", "This value is used to determine the depreciation amounts.",
) )
depreciation_base = fields.Float( depreciation_base = fields.Monetary(
compute="_compute_depreciation_base", compute="_compute_depreciation_base",
digits="Account", string="Depreciation Base",
store=True, store=True,
currency_field="company_currency_id",
help="This amount represent the depreciation base " help="This amount represent the depreciation base "
"of the asset (Purchase Value - Salvage Value).", "of the asset (Purchase Value - Salvage Value).",
) )
value_residual = fields.Float( value_residual = fields.Monetary(
compute="_compute_depreciation", compute="_compute_depreciation",
digits="Account",
string="Residual Value", string="Residual Value",
currency_field="company_currency_id",
store=True, store=True,
) )
value_depreciated = fields.Float( value_depreciated = fields.Monetary(
compute="_compute_depreciation", compute="_compute_depreciation",
digits="Account",
string="Depreciated Value", string="Depreciated Value",
currency_field="company_currency_id",
store=True, store=True,
) )
note = fields.Text() note = fields.Text()
@ -266,7 +270,6 @@ class AccountAsset(models.Model):
related="company_id.currency_id", related="company_id.currency_id",
string="Company Currency", string="Company Currency",
store=True, store=True,
readonly=True,
) )
account_analytic_id = fields.Many2one( account_analytic_id = fields.Many2one(
comodel_name="account.analytic.account", comodel_name="account.analytic.account",
@ -607,8 +610,8 @@ class AccountAsset(models.Model):
last_line, last_line,
posted_lines, posted_lines,
): ):
digits = self.env["decimal.precision"].precision_get("Account")
company = self.company_id company = self.company_id
currency = company.currency_id
fiscalyear_lock_date = company.fiscalyear_lock_date or fields.Date.to_date( fiscalyear_lock_date = company.fiscalyear_lock_date or fields.Date.to_date(
"1901-01-01" "1901-01-01"
) )
@ -639,14 +642,14 @@ class AccountAsset(models.Model):
if amount or self.carry_forward_missed_depreciations: if amount or self.carry_forward_missed_depreciations:
vals = { vals = {
"previous_id": depr_line.id, "previous_id": depr_line.id,
"amount": round(amount, digits), "amount": currency.round(amount),
"asset_id": self.id, "asset_id": self.id,
"name": name, "name": name,
"line_date": line["date"], "line_date": line["date"],
"line_days": line["days"], "line_days": line["days"],
"init_entry": fiscalyear_lock_date >= line["date"], "init_entry": fiscalyear_lock_date >= line["date"],
} }
depreciated_value += round(amount, digits) depreciated_value += currency.round(amount)
depr_line = self.env["account.asset.line"].create(vals) depr_line = self.env["account.asset.line"].create(vals)
else: else:
seq -= 1 seq -= 1
@ -655,10 +658,10 @@ class AccountAsset(models.Model):
def compute_depreciation_board(self): def compute_depreciation_board(self):
line_obj = self.env["account.asset.line"] line_obj = self.env["account.asset.line"]
digits = self.env["decimal.precision"].precision_get("Account")
for asset in self: for asset in self:
if asset.value_residual == 0.0: currency = asset.company_id.currency_id
if currency.is_zero(asset.value_residual):
continue continue
domain = [ domain = [
("asset_id", "=", asset.id), ("asset_id", "=", asset.id),
@ -740,7 +743,7 @@ class AccountAsset(models.Model):
posted_line.amount for posted_line in posted_lines posted_line.amount for posted_line in posted_lines
) )
residual_amount = asset.depreciation_base - depreciated_value residual_amount = asset.depreciation_base - depreciated_value
amount_diff = round(residual_amount_table - residual_amount, digits) amount_diff = currency.round(residual_amount_table - residual_amount)
if amount_diff: if amount_diff:
# We will auto-create a new line because the number of lines in # We will auto-create a new line because the number of lines in
# the tables are the same as the posted depreciations and there # the tables are the same as the posted depreciations and there
@ -987,7 +990,8 @@ class AccountAsset(models.Model):
def _compute_depreciation_amount_per_fiscal_year( def _compute_depreciation_amount_per_fiscal_year(
self, table, line_dates, depreciation_start_date, depreciation_stop_date self, table, line_dates, depreciation_start_date, depreciation_stop_date
): ):
digits = self.env["decimal.precision"].precision_get("Account") self.ensure_one()
currency = self.company_id.currency_id
fy_residual_amount = self.depreciation_base fy_residual_amount = self.depreciation_base
i_max = len(table) - 1 i_max = len(table) - 1
asset_sign = self.depreciation_base >= 0 and 1 or -1 asset_sign = self.depreciation_base >= 0 and 1 or -1
@ -1019,17 +1023,22 @@ class AccountAsset(models.Model):
firstyear = i == 0 and True or False firstyear = i == 0 and True or False
fy_factor = self._get_fy_duration_factor(entry, firstyear) fy_factor = self._get_fy_duration_factor(entry, firstyear)
fy_amount = year_amount * fy_factor fy_amount = year_amount * fy_factor
if asset_sign * (fy_amount - fy_residual_amount) > 0: if (
currency.compare_amounts(
asset_sign * (fy_amount - fy_residual_amount), 0
)
> 0
):
fy_amount = fy_residual_amount fy_amount = fy_residual_amount
period_amount = round(period_amount, digits) period_amount = currency.round(period_amount)
fy_amount = round(fy_amount, digits) fy_amount = currency.round(fy_amount)
else: else:
fy_amount = False fy_amount = False
if self.method_time == "number": if self.method_time == "number":
number = self.method_number number = self.method_number
else: else:
number = len(line_dates) number = len(line_dates)
period_amount = round(self.depreciation_base / number, digits) period_amount = currency.round(self.depreciation_base / number)
entry.update( entry.update(
{ {
"period_amount": period_amount, "period_amount": period_amount,
@ -1039,7 +1048,7 @@ class AccountAsset(models.Model):
) )
if self.method_time == "year": if self.method_time == "year":
fy_residual_amount -= fy_amount fy_residual_amount -= fy_amount
if round(fy_residual_amount, digits) == 0: if currency.is_zero(fy_residual_amount):
break break
i_max = i i_max = i
table = table[: i_max + 1] table = table[: i_max + 1]
@ -1049,7 +1058,8 @@ class AccountAsset(models.Model):
self, table, depreciation_start_date, depreciation_stop_date, line_dates self, table, depreciation_start_date, depreciation_stop_date, line_dates
): ):
digits = self.env["decimal.precision"].precision_get("Account") self.ensure_one()
currency = self.company_id.currency_id
asset_sign = 1 if self.depreciation_base >= 0 else -1 asset_sign = 1 if self.depreciation_base >= 0 else -1
i_max = len(table) - 1 i_max = len(table) - 1
remaining_value = self.depreciation_base remaining_value = self.depreciation_base
@ -1068,7 +1078,7 @@ class AccountAsset(models.Model):
prev_date = max(entry["date_start"], depreciation_start_date) prev_date = max(entry["date_start"], depreciation_start_date)
for li, line_date in enumerate(line_dates): for li, line_date in enumerate(line_dates):
line_days = (line_date - prev_date).days + 1 line_days = (line_date - prev_date).days + 1
if round(remaining_value, digits) == 0.0: if currency.is_zero(remaining_value):
break break
if line_date > min(entry["date_stop"], depreciation_stop_date) and not ( if line_date > min(entry["date_stop"], depreciation_stop_date) and not (
@ -1081,20 +1091,23 @@ class AccountAsset(models.Model):
if ( if (
self.method == "degr-linear" self.method == "degr-linear"
and asset_sign * (fy_amount - fy_amount_check) < 0 and currency.compare_amounts(
asset_sign * (fy_amount - fy_amount_check), 0
)
< 0
): ):
break break
if i == 0 and li == 0: if i == 0 and li == 0:
if entry.get("day_amount") > 0.0: if currency.compare_amounts(entry.get("day_amount"), 0) > 0:
amount = line_days * entry.get("day_amount") amount = line_days * entry.get("day_amount")
else: else:
amount = self._get_first_period_amount( amount = self._get_first_period_amount(
table, entry, depreciation_start_date, line_dates table, entry, depreciation_start_date, line_dates
) )
amount = round(amount, digits) amount = currency.round(amount)
else: else:
if entry.get("day_amount") > 0.0: if currency.compare_amounts(entry.get("day_amount"), 0) > 0:
amount = line_days * entry.get("day_amount") amount = line_days * entry.get("day_amount")
else: else:
amount = entry.get("period_amount") amount = entry.get("period_amount")
@ -1127,7 +1140,7 @@ class AccountAsset(models.Model):
# The code has now been simplified with compensation # The code has now been simplified with compensation
# always in last FT depreciation line. # always in last FT depreciation line.
if self.method_time == "year" and not entry.get("day_amount"): if self.method_time == "year" and not entry.get("day_amount"):
if round(fy_amount_check - fy_amount, digits) != 0: if not currency.is_zero(fy_amount_check - fy_amount):
diff = fy_amount_check - fy_amount diff = fy_amount_check - fy_amount
amount = amount - diff amount = amount - diff
remaining_value += diff remaining_value += diff

View File

@ -27,23 +27,28 @@ class AccountAssetLine(models.Model):
readonly=True, readonly=True,
) )
parent_state = fields.Selection( parent_state = fields.Selection(
related="asset_id.state", string="State of Asset", readonly=True related="asset_id.state",
string="State of Asset",
) )
depreciation_base = fields.Float( depreciation_base = fields.Monetary(
related="asset_id.depreciation_base", string="Depreciation Base", readonly=True related="asset_id.depreciation_base",
string="Depreciation Base",
currency_field="company_currency_id",
) )
amount = fields.Float(digits="Account", required=True) amount = fields.Monetary(
remaining_value = fields.Float( string="Amount", required=True, currency_field="company_currency_id"
)
remaining_value = fields.Monetary(
compute="_compute_values", compute="_compute_values",
digits="Account",
string="Next Period Depreciation", string="Next Period Depreciation",
store=True, store=True,
currency_field="company_currency_id",
) )
depreciated_value = fields.Float( depreciated_value = fields.Monetary(
compute="_compute_values", compute="_compute_values",
digits="Account",
string="Amount Already Depreciated", string="Amount Already Depreciated",
store=True, store=True,
currency_field="company_currency_id",
) )
line_date = fields.Date(string="Date", required=True) line_date = fields.Date(string="Date", required=True)
line_days = fields.Integer(string="Days", readonly=True) line_days = fields.Integer(string="Days", readonly=True)
@ -70,11 +75,9 @@ class AccountAssetLine(models.Model):
help="Set this flag for entries of previous fiscal years " help="Set this flag for entries of previous fiscal years "
"for which Odoo has not generated accounting entries.", "for which Odoo has not generated accounting entries.",
) )
company_id = fields.Many2one( company_id = fields.Many2one(related="asset_id.company_id", store=True)
"res.company", company_currency_id = fields.Many2one(
store=True, related="asset_id.company_id.currency_id", store=True, string="Company Currency"
readonly=True,
related="asset_id.company_id",
) )
@api.depends("amount", "previous_id", "type") @api.depends("amount", "previous_id", "type")
@ -229,15 +232,17 @@ class AccountAssetLine(models.Model):
def _setup_move_line_data(self, depreciation_date, account, ml_type, move): def _setup_move_line_data(self, depreciation_date, account, ml_type, move):
"""Prepare data to be propagated to account.move.line""" """Prepare data to be propagated to account.move.line"""
asset = self.asset_id asset = self.asset_id
currency = asset.company_id.currency_id
amount = self.amount amount = self.amount
amount_comp = currency.compare_amounts(amount, 0)
analytic_id = False analytic_id = False
analytic_tags = self.env["account.analytic.tag"] analytic_tags = self.env["account.analytic.tag"]
if ml_type == "depreciation": if ml_type == "depreciation":
debit = amount < 0 and -amount or 0.0 debit = amount_comp < 0 and -amount or 0.0
credit = amount > 0 and amount or 0.0 credit = amount_comp > 0 and amount or 0.0
elif ml_type == "expense": elif ml_type == "expense":
debit = amount > 0 and amount or 0.0 debit = amount_comp > 0 and amount or 0.0
credit = amount < 0 and -amount or 0.0 credit = amount_comp < 0 and -amount or 0.0
analytic_id = asset.account_analytic_id.id analytic_id = asset.account_analytic_id.id
analytic_tags = asset.analytic_tag_ids analytic_tags = asset.analytic_tag_ids
move_line_data = { move_line_data = {

View File

@ -33,13 +33,12 @@ class AccountMove(models.Model):
asset_count = fields.Integer(compute="_compute_asset_count") asset_count = fields.Integer(compute="_compute_asset_count")
def _compute_asset_count(self): def _compute_asset_count(self):
for rec in self: rg_res = self.env["account.asset.line"].read_group(
assets = ( [("move_id", "in", self.ids)], ["move_id"], ["move_id"]
self.env["account.asset.line"] )
.search([("move_id", "=", rec.id)]) mapped_data = {x["move_id"][0]: x["move_id_count"] for x in rg_res}
.mapped("asset_id") for move in self:
) move.asset_count = mapped_data.get(move.id, 0)
rec.asset_count = len(assets)
def unlink(self): def unlink(self):
# for move in self: # for move in self:
@ -179,6 +178,7 @@ class AccountMoveLine(models.Model):
comodel_name="account.asset", comodel_name="account.asset",
string="Asset", string="Asset",
ondelete="restrict", ondelete="restrict",
check_company=True,
) )
@api.depends("account_id", "asset_id") @api.depends("account_id", "asset_id")

View File

@ -5,8 +5,18 @@
<field name="model">account.account</field> <field name="model">account.account</field>
<field name="inherit_id" ref="account.view_account_form" /> <field name="inherit_id" ref="account.view_account_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="user_type_id" position="before"> <group name="options_group" position="inside">
<field name="asset_profile_id" /> <field name="asset_profile_id" />
</group>
</field>
</record>
<record id="view_account_list" model="ir.ui.view">
<field name="model">account.account</field>
<field name="inherit_id" ref="account.view_account_list" />
<field name="arch" type="xml">
<field name="tag_ids" position="after">
<field name="asset_profile_id" optional="hide" />
</field> </field>
</field> </field>
</record> </record>

View File

@ -70,21 +70,9 @@
/> />
<field name="move_line_check" invisible="1" /> <field name="move_line_check" invisible="1" />
<newline /> <newline />
<field <field name="depreciation_base" />
name="depreciation_base" <field name="value_depreciated" />
widget="monetary" <field name="value_residual" />
options="{'currency_field': 'company_currency_id'}"
/>
<field
name="value_depreciated"
widget="monetary"
options="{'currency_field': 'company_currency_id'}"
/>
<field
name="value_residual"
widget="monetary"
options="{'currency_field': 'company_currency_id'}"
/>
<field name="active" invisible="1" /> <field name="active" invisible="1" />
</group> </group>
<notebook colspan="4"> <notebook colspan="4">
@ -93,8 +81,6 @@
<group> <group>
<field <field
name="purchase_value" name="purchase_value"
widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':['|', ('move_line_check', '=', True), ('state', '!=', 'draft')]}" attrs="{'readonly':['|', ('move_line_check', '=', True), ('state', '!=', 'draft')]}"
/> />
<field <field
@ -105,8 +91,6 @@
<group> <group>
<field <field
name="salvage_value" name="salvage_value"
widget="monetary"
options="{'currency_field': 'company_currency_id'}"
attrs="{'readonly': [('state', '!=', 'draft')]}" attrs="{'readonly': [('state', '!=', 'draft')]}"
/> />
<field name="date_remove" /> <field name="date_remove" />
@ -186,6 +170,7 @@
<field name="init_entry" string="Init" /> <field name="init_entry" string="Init" />
<field name="move_check" /> <field name="move_check" />
<field name="parent_state" invisible="1" /> <field name="parent_state" invisible="1" />
<field name="company_currency_id" invisible="1" />
<button <button
name="create_move" name="create_move"
icon="fa-cog" icon="fa-cog"
@ -218,6 +203,10 @@
name="depreciation_base" name="depreciation_base"
invisible="1" invisible="1"
/> />
<field
name="company_currency_id"
invisible="1"
/>
<field name="type" /> <field name="type" />
<field name="name" /> <field name="name" />
<field <field
@ -315,6 +304,7 @@
decoration-info="state == 'draft'" decoration-info="state == 'draft'"
decoration-muted="state == 'close'" decoration-muted="state == 'close'"
/> />
<field name="company_currency_id" invisible="1" />
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -24,6 +24,9 @@ class AccountAssetRemove(models.TransientModel):
required=True, required=True,
default=lambda self: self._default_company_id(), default=lambda self: self._default_company_id(),
) )
company_currency_id = fields.Many2one(
related="company_id.currency_id", string="Company Currency"
)
date_remove = fields.Date( date_remove = fields.Date(
string="Asset Removal Date", string="Asset Removal Date",
required=True, required=True,
@ -32,7 +35,11 @@ class AccountAssetRemove(models.TransientModel):
"in case of early removal", "in case of early removal",
) )
force_date = fields.Date(string="Force accounting date") force_date = fields.Date(string="Force accounting date")
sale_value = fields.Float(default=lambda self: self._default_sale_value()) sale_value = fields.Monetary(
string="Sale Value",
default=lambda self: self._default_sale_value(),
currency_field="company_currency_id",
)
account_sale_id = fields.Many2one( account_sale_id = fields.Many2one(
comodel_name="account.account", comodel_name="account.account",
string="Asset Sale Account", string="Asset Sale Account",
@ -70,9 +77,9 @@ class AccountAssetRemove(models.TransientModel):
) )
note = fields.Text("Notes") note = fields.Text("Notes")
@api.constrains("sale_value") @api.constrains("sale_value", "company_id")
def _check_sale_value(self): def _check_sale_value(self):
if self.sale_value < 0: if self.company_id.currency_id.compare_amounts(self.sale_value, 0) < 0:
raise ValidationError(_("The Sale Value must be positive!")) raise ValidationError(_("The Sale Value must be positive!"))
@api.model @api.model
@ -105,10 +112,11 @@ class AccountAssetRemove(models.TransientModel):
inv_curr = inv.currency_id inv_curr = inv.currency_id
if line.move_id.payment_state == "paid" or line.parent_state == "draft": if line.move_id.payment_state == "paid" or line.parent_state == "draft":
account_sale_id = line.account_id.id account_sale_id = line.account_id.id
amount = line.price_subtotal amount_inv_cur = line.price_subtotal
if inv_curr != comp_curr: amount_comp_cur = inv_curr._convert(
amount = comp_curr.compute(amount) amount_inv_cur, comp_curr, inv.company_id, inv.date
sale_value += amount )
sale_value += amount_comp_cur
return {"sale_value": sale_value, "account_sale_id": account_sale_id} return {"sale_value": sale_value, "account_sale_id": account_sale_id}
@api.model @api.model
@ -234,7 +242,7 @@ class AccountAssetRemove(models.TransientModel):
date_remove = self.date_remove date_remove = self.date_remove
asset_line_obj = self.env["account.asset.line"] asset_line_obj = self.env["account.asset.line"]
digits = self.env["decimal.precision"].precision_get("Account") currency = asset.company_id.currency_id
def _dlines(asset): def _dlines(asset):
lines = asset.depreciation_line_ids lines = asset.depreciation_line_ids
@ -279,11 +287,10 @@ class AccountAssetRemove(models.TransientModel):
period_number_days = (first_date - last_depr_date).days + same_month period_number_days = (first_date - last_depr_date).days + same_month
new_line_date = date_remove + relativedelta(days=-1) new_line_date = date_remove + relativedelta(days=-1)
to_depreciate_days = (new_line_date - last_depr_date).days + same_month to_depreciate_days = (new_line_date - last_depr_date).days + same_month
to_depreciate_amount = round( to_depreciate_amount = currency.round(
float(to_depreciate_days) float(to_depreciate_days)
/ float(period_number_days) / float(period_number_days)
* first_to_depreciate_dl.amount, * first_to_depreciate_dl.amount,
digits,
) )
residual_value = asset.value_residual - to_depreciate_amount residual_value = asset.value_residual - to_depreciate_amount
if to_depreciate_amount: if to_depreciate_amount:
@ -302,25 +309,28 @@ class AccountAssetRemove(models.TransientModel):
move_lines = [] move_lines = []
partner_id = asset.partner_id and asset.partner_id.id or False partner_id = asset.partner_id and asset.partner_id.id or False
profile = asset.profile_id profile = asset.profile_id
currency = asset.company_id.currency_id
# asset and asset depreciation account reversal # asset and asset depreciation account reversal
depr_amount = asset.depreciation_base - residual_value depr_amount = asset.depreciation_base - residual_value
depr_amount_comp = currency.compare_amounts(depr_amount, 0)
if depr_amount: if depr_amount:
move_line_vals = { move_line_vals = {
"name": asset.name, "name": asset.name,
"account_id": profile.account_depreciation_id.id, "account_id": profile.account_depreciation_id.id,
"debit": depr_amount > 0 and depr_amount or 0.0, "debit": depr_amount_comp > 0 and depr_amount or 0.0,
"credit": depr_amount < 0 and -depr_amount or 0.0, "credit": depr_amount_comp < 0 and -depr_amount or 0.0,
"partner_id": partner_id, "partner_id": partner_id,
"asset_id": asset.id, "asset_id": asset.id,
} }
move_lines.append((0, 0, move_line_vals)) move_lines.append((0, 0, move_line_vals))
depreciation_base_comp = currency.compare_amounts(asset.depreciation_base, 0)
move_line_vals = { move_line_vals = {
"name": asset.name, "name": asset.name,
"account_id": profile.account_asset_id.id, "account_id": profile.account_asset_id.id,
"debit": (asset.depreciation_base < 0 and -asset.depreciation_base or 0.0), "debit": (depreciation_base_comp < 0 and -asset.depreciation_base or 0.0),
"credit": (asset.depreciation_base > 0 and asset.depreciation_base or 0.0), "credit": (depreciation_base_comp > 0 and asset.depreciation_base or 0.0),
"partner_id": partner_id, "partner_id": partner_id,
"asset_id": asset.id, "asset_id": asset.id,
} }
@ -356,9 +366,10 @@ class AccountAssetRemove(models.TransientModel):
} }
move_lines.append((0, 0, move_line_vals)) move_lines.append((0, 0, move_line_vals))
balance = self.sale_value - residual_value balance = self.sale_value - residual_value
balance_comp = currency.compare_amounts(balance, 0)
account_id = ( account_id = (
self.account_plus_value_id.id self.account_plus_value_id.id
if balance > 0 if balance_comp > 0
else self.account_min_value_id.id else self.account_min_value_id.id
) )
move_line_vals = { move_line_vals = {
@ -366,8 +377,8 @@ class AccountAssetRemove(models.TransientModel):
"account_id": account_id, "account_id": account_id,
"analytic_account_id": asset.account_analytic_id.id, "analytic_account_id": asset.account_analytic_id.id,
"analytic_tag_ids": [(4, tag.id) for tag in asset.analytic_tag_ids], "analytic_tag_ids": [(4, tag.id) for tag in asset.analytic_tag_ids],
"debit": balance < 0 and -balance or 0.0, "debit": balance_comp < 0 and -balance or 0.0,
"credit": balance > 0 and balance or 0.0, "credit": balance_comp > 0 and balance or 0.0,
"partner_id": partner_id, "partner_id": partner_id,
"asset_id": asset.id, "asset_id": asset.id,
} }

View File

@ -1,2 +1,3 @@
# generated from manifests external_dependencies # generated from manifests external_dependencies
freezegun freezegun
python-dateutil

View File

@ -0,0 +1 @@
../../../../account_asset_management

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)