ga_asset_management/views/account_asset_views.xml

150 lines
7.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- GA Asset Tree View -->
<record id="view_ga_account_asset_tree" model="ir.ui.view">
<field name="name">ga.account.asset.tree</field>
<field name="model">account.asset</field>
<field name="arch" type="xml">
<tree string="Fixed Assets" sample="1">
<field name="asset_code"/>
<field name="name"/>
<field name="product_id" optional="show"/>
<field name="acquisition_date"/>
<field name="original_value"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'open'" decoration-danger="state == 'close'"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<!-- GA Asset Form View -->
<record id="view_ga_account_asset_form" model="ir.ui.view">
<field name="name">ga.account.asset.form</field>
<field name="model">account.asset</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<form string="Fixed Asset">
<header>
<button name="action_open_transfer_wizard" string="Transfer Asset" type="object" class="oe_highlight" invisible="state == 'model' or in_transit"/>
<field name="state" widget="statusbar" statusbar_visible="draft,open,close"/>
</header>
<sheet>
<field name="company_id" invisible="1"/>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="e.g. Laptop"/>
</h1>
</div>
<group>
<group>
<field name="product_id"/>
<field name="asset_code" readonly="1"/>
<field name="acquisition_date"/>
</group>
<group>
<field name="original_value"/>
<field name="model_id" string="Asset Model"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
<field name="location_id"/>
<field name="employee_id"/>
<field name="employee_id"/>
<field name="in_transit" invisible="1"/>
</group>
</group>
<group string="Depreciation Board">
<label for="method_number" string="Duration"/>
<div class="o_row">
<field name="method_number" nolabel="1" readonly="1" force_save="1"/>
<field name="method_period" nolabel="1" readonly="1" force_save="1"/>
</div>
<!-- Hidden fields for logic -->
<field name="method" invisible="1"/>
<field name="prorata_computation_type" invisible="1"/>
</group>
<!-- Accounting Group Removed as per request -->
<notebook>
<page string="Description">
<field name="description"/>
</page>
<page string="Depreciation Board" invisible="1">
<!-- Hiding depreciation details for GA as per requirement to simplify -->
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- Action -->
<record id="action_ga_asset_management" model="ir.actions.act_window">
<field name="name">Assets</field>
<field name="res_model">account.asset</field>
<field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_ga_account_asset_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_ga_account_asset_form')})]"/>
<field name="search_view_id" ref="account_asset.view_account_asset_search"/>
<field name="domain">[('state', '!=', 'model')]</field> <!-- Filter out Asset Models -->
<field name="context">{'default_state': 'draft'}</field>
</record>
<!-- Duplicate view links removed -->
<!-- Menu Items -->
<menuitem id="menu_ga_root" name="General Affair" web_icon="ga_asset_management,static/description/icon.png" sequence="10" groups="ga_asset_management.group_ga_asset_user"/>
<menuitem id="menu_ga_asset_management"
name="Assets"
parent="menu_ga_root"
action="action_ga_asset_management"
sequence="1"/>
<!-- Inheritance to modify Standard Account Asset Form -->
<record id="view_account_asset_form_inherit_ga" model="ir.ui.view">
<field name="name">account.asset.form.inherit.ga</field>
<field name="model">account.asset</field>
<field name="inherit_id" ref="account_asset.view_account_asset_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='main_page']//field[@name='method']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='method_number']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='method_period']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='prorata_computation_type']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='account_asset_id']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='account_depreciation_id']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='account_depreciation_expense_id']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='journal_id']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
<xpath expr="//page[@name='main_page']//field[@name='analytic_distribution']" position="attributes">
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</xpath>
</field>
</record>
</odoo>