-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] account_ux: Moved from l10n_ar_ux and account_reports_multicurr…
…ency is_monetary logic
- Loading branch information
Showing
5 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import logging | ||
|
||
from odoo import api, models, fields | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class AccountAccount(models.Model): | ||
_inherit = "account.account" | ||
|
||
is_monetary = fields.Boolean(default=True) | ||
|
||
@api.model | ||
def set_non_monetary(self, company): | ||
"""Set is_monetary in False to the corresponding accounts taking into account the account type""" | ||
account_types = [ | ||
"asset_non_current", | ||
"asset_fixed", | ||
"liability_non_current", | ||
"equity", | ||
"equity_unaffected", | ||
"income", | ||
"income_other", | ||
"expense", | ||
"expense_depreciation", | ||
"expense_direct_cost", | ||
"off_balance" | ||
] | ||
if accounts := self.search( | ||
[("account_type", "in", account_types), *self.env["account.account"]._check_company_domain(company)] | ||
).filtered(lambda x: x.company_fiscal_country_code == "AR"): | ||
accounts.write({"is_monetary": False}) | ||
_logger.info("Is Monetary is False on %s accounts ." % (company.name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="account_ux_view_list" model="ir.ui.view"> | ||
<field name="name">account.account.tds.tcs.view.list.inherit</field> | ||
<field name="model">account.account</field> | ||
<field name="inherit_id" ref="account.view_account_list"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='account_type']" position="after"> | ||
<field name="is_monetary" optional="hide"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |