Files
dn20/accountant_cn/views/views__dn_accounting_views.xml
2026-11-17 17:57:08 +08:00

435 lines
25 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- ============================ year-end closing wizard -->
<record id="view_dn_fiscal_year_closing_form" model="ir.ui.view">
<field name="name">dn.fiscal.year.closing.form</field>
<field name="model">dn.fiscal.year.closing</field>
<field name="arch" type="xml">
<form string="Year-End Closing">
<header>
<button name="action_preview" type="object" string="Preview"
class="btn-secondary"/>
<button name="action_close" type="object" string="Generate Closing Entry"
class="oe_highlight"/>
<field name="move_id" invisible="1"/>
</header>
<sheet>
<div class="alert alert-info" role="alert">
Closing transfers every profit and loss balance of the period to retained
earnings, so income and expense accounts start the new fiscal year at zero.
Assets, liabilities and equity are not affected. Use Preview to check the
amounts before generating the entry.
</div>
<group>
<group string="Period">
<field name="company_id" groups="base.group_multi_company"/>
<field name="fiscal_year_id"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group string="Settings">
<field name="journal_id"/>
<field name="retained_earnings_account_id"/>
<field name="post_move"/>
<field name="lock_after_close"/>
<field name="currency_id" invisible="1"/>
</group>
</group>
<group>
<group string="Result">
<field name="amount"/>
<field name="line_count"/>
</group>
<group string="Generated Entry">
<field name="move_id"/>
</group>
</group>
<notebook>
<page string="Closing Details" name="preview">
<field name="preview_line_ids" readonly="1">
<list>
<field name="account_code"/>
<field name="account_name"/>
<field name="balance"/>
<field name="closing_amount"/>
<field name="currency_id" column_invisible="1"/>
</list>
</field>
<div class="text-muted mt-2" invisible="preview_line_ids">
No preview yet. Click Preview to list the accounts and amounts
that will be closed.
</div>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- ============================ lock date wizard -->
<!--
Layout follows the enterprise `account.change.lock.date` dialog: one
row per lock date, with the effective exception shown inline and a
Revoke link right next to it. The geometry is the same on purpose —
the "For me / For everyone" suffix only makes sense when it sits on
the same line as the date it qualifies, and stacking it underneath
hides the fact that a period is still open for one audience only.
-->
<record id="view_dn_lock_date_wizard_form" model="ir.ui.view">
<field name="name">dn.lock.date.wizard.form</field>
<field name="model">dn.lock.date.wizard</field>
<field name="arch" type="xml">
<form string="Lock Journal Entries">
<sheet>
<group>
<field name="company_id" invisible="1"/>
<field name="show_draft_entries_warning" invisible="1"/>
<div class="alert alert-warning mb-0 d-flex gap-2 flex-wrap"
role="alert" colspan="2"
invisible="not show_draft_entries_warning">
There are still draft entries in the period you want to lock. You should either post or delete them.
<a type="object" class="oe_link fw-bold"
name="action_show_draft_moves_in_locked_period">
Review
</a>
</div>
<field name="show_posted_tax_closing_warning" invisible="1"/>
<div class="alert alert-warning mb-0 d-flex gap-2 flex-wrap"
role="alert" colspan="2"
invisible="not show_posted_tax_closing_warning">
A posted tax return closing entry exists after this tax lock date. You might want to reset the related tax return to non-submitted.
<a type="object" class="oe_link fw-bold"
name="action_show_posted_tax_closing_in_locked_period">
Review
</a>
</div>
<div class="text-muted mb-1 dn_italic" colspan="2">
Lock transactions up to specific dates, inclusive
</div>
<!-- The eight exception pointers are technical: they
are what the Revoke buttons act on, so they have to
be in the view but never in front of the user. -->
<field name="min_sale_lock_date_exception_for_me_id" invisible="1"/>
<field name="min_purchase_lock_date_exception_for_me_id" invisible="1"/>
<field name="min_tax_lock_date_exception_for_me_id" invisible="1"/>
<field name="min_fiscalyear_lock_date_exception_for_me_id" invisible="1"/>
<field name="min_sale_lock_date_exception_for_everyone_id" invisible="1"/>
<field name="min_purchase_lock_date_exception_for_everyone_id" invisible="1"/>
<field name="min_tax_lock_date_exception_for_everyone_id" invisible="1"/>
<field name="min_fiscalyear_lock_date_exception_for_everyone_id" invisible="1"/>
<field name="exception_needed_fields" invisible="1"/>
<label for="sale_lock_date"/>
<div class="d-flex">
<field name="sale_lock_date" placeholder="Not locked"
class="oe_inline"
decoration-info="exception_needed_fields and 'sale_lock_date' in exception_needed_fields"
options="{'warning': 'future'}"/>
<span class="text-muted o_form_label"
invisible="not min_sale_lock_date_exception_for_me_id">
For me:
<field name="sale_lock_date_for_me" nolabel="1" class="oe_inline"
invisible="not sale_lock_date_for_me"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_sale_lock_date_exception_for_me">
Revoke
</a>
</span>
<span class="text-muted o_form_label dn_lock_sep"
invisible="not min_sale_lock_date_exception_for_me_id
or not min_sale_lock_date_exception_for_everyone_id"/>
<span class="text-muted o_form_label"
invisible="not min_sale_lock_date_exception_for_everyone_id">
For everyone:
<field name="sale_lock_date_for_everyone" nolabel="1" class="oe_inline"
invisible="not sale_lock_date_for_everyone"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_sale_lock_date_exception_for_everyone">
Revoke
</a>
</span>
</div>
<label for="purchase_lock_date"/>
<div class="d-flex">
<field name="purchase_lock_date" placeholder="Not locked"
class="oe_inline"
decoration-info="exception_needed_fields and 'purchase_lock_date' in exception_needed_fields"
options="{'warning': 'future'}"/>
<span class="text-muted o_form_label"
invisible="not min_purchase_lock_date_exception_for_me_id">
For me:
<field name="purchase_lock_date_for_me" nolabel="1" class="oe_inline"
invisible="not purchase_lock_date_for_me"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_purchase_lock_date_exception_for_me">
Revoke
</a>
</span>
<span class="text-muted o_form_label dn_lock_sep"
invisible="not min_purchase_lock_date_exception_for_me_id
or not min_purchase_lock_date_exception_for_everyone_id"/>
<span class="text-muted o_form_label"
invisible="not min_purchase_lock_date_exception_for_everyone_id">
For everyone:
<field name="purchase_lock_date_for_everyone" nolabel="1" class="oe_inline"
invisible="not purchase_lock_date_for_everyone"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_purchase_lock_date_exception_for_everyone">
Revoke
</a>
</span>
</div>
<label for="tax_lock_date"/>
<div class="d-flex">
<field name="tax_lock_date" placeholder="Not locked"
class="oe_inline"
decoration-info="exception_needed_fields and 'tax_lock_date' in exception_needed_fields"
options="{'warning': 'future'}"/>
<div class="text-muted dn_italic ms-2"
invisible="min_tax_lock_date_exception_for_me_id or min_tax_lock_date_exception_for_everyone_id">
after a tax closing
</div>
<span class="text-muted o_form_label"
invisible="not min_tax_lock_date_exception_for_me_id">
For me:
<field name="tax_lock_date_for_me" nolabel="1" class="oe_inline"
invisible="not tax_lock_date_for_me"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_tax_lock_date_exception_for_me">
Revoke
</a>
</span>
<span class="text-muted o_form_label dn_lock_sep"
invisible="not min_tax_lock_date_exception_for_me_id
or not min_tax_lock_date_exception_for_everyone_id"/>
<span class="text-muted o_form_label"
invisible="not min_tax_lock_date_exception_for_everyone_id">
For everyone:
<field name="tax_lock_date_for_everyone" nolabel="1" class="oe_inline"
invisible="not tax_lock_date_for_everyone"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_tax_lock_date_exception_for_everyone">
Revoke
</a>
</span>
</div>
<label for="fiscalyear_lock_date"/>
<div class="d-flex">
<field name="fiscalyear_lock_date" placeholder="Not locked"
class="oe_inline"
decoration-info="exception_needed_fields and 'fiscalyear_lock_date' in exception_needed_fields"
options="{'warning': 'future'}"/>
<div class="text-muted dn_italic ms-2"
invisible="min_fiscalyear_lock_date_exception_for_me_id or min_fiscalyear_lock_date_exception_for_everyone_id">
but allow exceptions
</div>
<span class="text-muted o_form_label"
invisible="not min_fiscalyear_lock_date_exception_for_me_id">
For me:
<field name="fiscalyear_lock_date_for_me" nolabel="1" class="oe_inline"
invisible="not fiscalyear_lock_date_for_me"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_fiscalyear_lock_date_exception_for_me">
Revoke
</a>
</span>
<span class="text-muted o_form_label dn_lock_sep"
invisible="not min_fiscalyear_lock_date_exception_for_me_id
or not min_fiscalyear_lock_date_exception_for_everyone_id"/>
<span class="text-muted o_form_label"
invisible="not min_fiscalyear_lock_date_exception_for_everyone_id">
For everyone:
<field name="fiscalyear_lock_date_for_everyone" nolabel="1" class="oe_inline"
invisible="not fiscalyear_lock_date_for_everyone"/>
<a type="object" class="oe_link fw-bold"
name="action_revoke_min_fiscalyear_lock_date_exception_for_everyone">
Revoke
</a>
</span>
</div>
<!-- Exception form. Only shown when the user is trying
to move a lock date backwards: a plain forward
move needs no justification, and showing the form
anyway would suggest it does. -->
<div class="alert alert-info ps-3 mt-2 mb-0 d-flex flex-wrap"
role="alert" colspan="2" style="white-space: pre;"
invisible="not exception_needed_fields">
Exception
<field name="exception_applies_to" class="oe_inline mx-3"/>
<field name="exception_duration" class="oe_inline"/>
<field name="exception_reason" placeholder="Reason..."
class="oe_inline mx-3 flex-grow-1"
widget="text"
options="{'line_breaks': False}"
invisible="exception_applies_to == 'everyone' and exception_duration == 'forever'"/>
</div>
<div class="d-flex justify-content-start" colspan="2">
<div class="alert alert-danger ps-3 mb-3" role="alert">
<div>Need an irreversible lock to ensure inalterability, for all users?</div>
<div class="d-flex">
<label for="hard_lock_date"/>
<field name="hard_lock_date" placeholder="Not locked"
class="oe_inline mx-3"
decoration-info="exception_needed_fields and 'hard_lock_date' in exception_needed_fields"
options="{'warning': 'future'}"/>
<div class="text-danger o_form_label dn_italic"
invisible="hard_lock_date == current_hard_lock_date">
This change is irreversible
</div>
<field name="current_hard_lock_date" invisible="1"/>
</div>
</div>
</div>
<!-- Closing checklist. Not part of the enterprise
dialog, but this module also owns the year-end
closing, and locking a period whose result has
not been transferred yet makes the closing entry
impossible to book. -->
<div class="text-muted mt-2 dn_italic" colspan="2">
Checks before locking
</div>
<group colspan="2">
<group>
<field name="draft_move_count" readonly="1"/>
<button name="action_show_draft_moves" type="object"
string="Show Draft Entries" class="btn-link"
colspan="2" invisible="draft_move_count == 0"/>
</group>
<group>
<field name="unreconciled_count" readonly="1"/>
<button name="action_show_unreconciled" type="object"
string="Show Unreconciled Items" class="btn-link"
colspan="2" invisible="unreconciled_count == 0"/>
<field name="unreconciled_statement_count" readonly="1"/>
<button name="action_show_unreconciled_statements" type="object"
string="Show Unreconciled Bank Transactions" class="btn-link"
colspan="2" invisible="unreconciled_statement_count == 0"/>
</group>
</group>
<div class="alert alert-warning mb-0" role="alert" colspan="2"
invisible="not has_pl_balance">
The period still has a profit and loss balance. Run the year-end closing first, otherwise the closing entry cannot be booked into this period.
</div>
</group>
</sheet>
<footer>
<button string="Save" name="action_apply" type="object"
class="btn-primary" data-hotkey="q"/>
<button class="btn-secondary" special="cancel" data-hotkey="x"/>
</footer>
</form>
</field>
</record>
<!-- ============================ fiscal year registry -->
<record id="view_dn_fiscal_year_list" model="ir.ui.view">
<field name="name">dn.fiscal.year.list</field>
<field name="model">dn.fiscal.year</field>
<field name="arch" type="xml">
<list decoration-success="state == 'closed'"
decoration-warning="state == 'open' and locked">
<field name="name"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="profit" sum="Total Period Result"/>
<field name="state" widget="badge"
decoration-success="state == 'closed'"
decoration-info="state == 'open'"/>
<field name="locked"/>
<field name="closing_move_id"/>
<field name="currency_id" column_invisible="1"/>
<field name="company_id" groups="base.group_multi_company"/>
<button name="action_open_closing_wizard" type="object"
string="Close" icon="fa-calculator"
invisible="state == 'closed'"/>
</list>
</field>
</record>
<record id="view_dn_fiscal_year_form" model="ir.ui.view">
<field name="name">dn.fiscal.year.form</field>
<field name="model">dn.fiscal.year</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_open_closing_wizard" type="object"
string="Run Closing" class="oe_highlight"
invisible="state == 'closed'"/>
<button name="action_reopen" type="object"
string="Mark as Open"
invisible="state != 'closed'"
confirm="This only resets the status flag; the closing entry is kept. Continue?"/>
</header>
<sheet>
<div class="oe_title">
<h1><field name="name" placeholder="e.g. Fiscal Year 2026"/></h1>
</div>
<group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="state"/>
<field name="locked"/>
<field name="profit"/>
<field name="closing_move_id"/>
<field name="currency_id" invisible="1"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!-- ============================ actions -->
<record id="action_dn_fiscal_year_closing" model="ir.actions.act_window">
<field name="name">Year-End Closing</field>
<field name="res_model">dn.fiscal.year.closing</field>
<field name="view_mode">form</field>
<field name="target">current</field>
<field name="context">{'create': True}</field>
</record>
<record id="action_dn_lock_date_wizard" model="ir.actions.act_window">
<field name="name">Lock Journal Entries</field>
<field name="res_model">dn.lock.date.wizard</field>
<field name="view_mode">form</field>
<!-- `target=new` like the enterprise action: the dialog is a side
step, the user should land back on the report or list they were
looking at once the lock date is saved. -->
<field name="target">new</field>
<field name="context">{'create': True}</field>
</record>
<record id="action_dn_fiscal_year" model="ir.actions.act_window">
<field name="name">Fiscal Years</field>
<field name="res_model">dn.fiscal.year</field>
<field name="view_mode">list,form</field>
</record>
<!-- ============================ menus -->
<menuitem id="menu_dn_accounting_root" name="Closing &amp; Locking"
parent="account.menu_finance_entries"
sequence="40"
groups="account.group_account_manager"/>
<menuitem id="menu_dn_fiscal_year" name="Fiscal Years"
parent="menu_dn_accounting_root"
action="action_dn_fiscal_year" sequence="10"/>
<!-- Same label as the enterprise menu item so a user migrating from
enterprise finds it where they expect. -->
<menuitem id="menu_dn_lock_date" name="Lock Dates…"
parent="menu_dn_accounting_root"
action="action_dn_lock_date_wizard" sequence="20"
groups="account.group_account_manager"/>
</odoo>