Files
enterprise-addons/esg/views/esg_emission_factor_views.xml
T

196 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="emission_factor_form_view" model="ir.ui.view">
<field name="name">emission.factor.form</field>
<field name="model">esg.emission.factor</field>
<field name="arch" type="xml">
<form>
<header>
<button string="Assign" name="%(factors_auto_assignment_wizard_action)d" type="action" class="btn btn-secondary"/>
</header>
<div
class="alert alert-warning d-flex align-items-center" role="alert"
invisible="nb_linked_emissions == 0"
>
<i class="fa fa-exclamation-triangle me-2"/>
You are modifying an emission factor already assigned to emissions.
Changing it will update these emissions. To keep the old value, duplicate the factor.
</div>
<sheet>
<div class="oe_button_box" name="button_box">
<button
class="oe_stat_button"
type="object"
name="action_open_linked_emissions"
icon="fa-leaf"
invisible="nb_linked_emissions == 0"
>
<div class="o_stat_info">
<span class="o_stat_text d-flex align-items-baseline gap-1">
<field name="nb_linked_emissions" widget="statinfo" nolabel="1" class="oe_inline"/>
<t invisible="nb_linked_emissions != 1">Emission</t>
<t invisible="nb_linked_emissions == 1">Emissions</t>
</span>
</div>
</button>
</div>
<div class="oe_title">
<h1>
<field name="name" placeholder="e.g. Office Computer" widget="text" class="o_text_overflow" options="{'line_breaks': False}"/>
</h1>
<field name="code" groups="base.group_no_one" readonly="1"/>
</div>
<group>
<group>
<field name="unit_name" invisible="1"/> <!-- Needed for the esg_value widget -->
<field name="esg_emissions_value" widget="esg_value" readonly="gas_line_ids" class="oe_inline"/>
<field name="source_id"/>
<field name="company_id"/>
<field name="region"/>
<field name="valid_from" widget="daterange" string="Validity Period"
options="{'always_range': 1, 'end_date_field': 'valid_to'}"/>
</group>
<group>
<field name="esg_uncertainty_value" widget="percentage"/>
<field name="compute_method"/>
<field name="database_id"/>
<field name="uom_id" required="compute_method == 'physically'" invisible="compute_method == 'monetary'" options="{'no_open': True}"/>
<field name="currency_id" required="compute_method == 'monetary'" invisible="compute_method == 'physically'" options="{'no_open': True}"/>
</group>
</group>
<notebook>
<page name="gas_emissions" string="Gas Emissions">
<field name="gas_line_ids" nolabel="1">
<list editable="bottom">
<field name="gas_id"/>
<field name="activity_type_id"/>
<field name="quantity" widget="float"/>
<field name="esg_emissions_value" widget="float" digits="[1,8]" width="250px"/>
</list>
</field>
</page>
<page name="assignations" string="Assignations">
<field name="assignation_line_ids" widget="emission_factor_x2many" nolabel="1">
<list editable="bottom">
<field name="account_id" options="{'no_quick_create': True}" context="{'from_emission_factor_line': True}"/>
<field name="partner_id"/>
<field name="product_id"/>
</list>
</field>
</page>
<page name="description" string="Description">
<field name="description" nolabel="1"/>
</page>
</notebook>
</sheet>
<chatter reload_on_follower="True"/>
</form>
</field>
</record>
<record id="emission_factor_list_view" model="ir.ui.view">
<field name="name">emission.factor.list</field>
<field name="model">esg.emission.factor</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
<field name="esg_emissions_value" width="200px"/>
<field name="unit_name" string="Unit"/>
<field name="esg_uncertainty_value" widget="percentage" width="200px"/>
<field name="source_id" string="Emission source"/>
<field name="database_id" string="Source Database"/>
<field name="compute_method" optional="hide"/>
<field name="valid_from" optional="hide"/>
<field name="valid_to" optional="hide"/>
<field name="company_id" optional="hide"/>
<field name="region" optional="hide"/>
</list>
</field>
</record>
<record id="emission_factor_kanban_view" model="ir.ui.view">
<field name="name">emission.factor.kanban</field>
<field name="model">esg.emission.factor</field>
<field name="arch" type="xml">
<kanban>
<templates>
<t t-name="card">
<div class="d-flex mb-1">
<field name="name" class="fw-bold fs-5 text-truncate"/>
<div class="flex-shrink-0 ms-auto">
<field name="esg_emissions_value"/>
<span class="ms-1">kgCO₂e / <field name="unit_name"/></span>
</div>
</div>
<field class="mb-1" name="scope_complete_name"/>
<footer class="pt-0">
<field name="database_id"/>
<label class="ms-auto" for="esg_uncertainty_value">Uncertainty:</label>
<field name="esg_uncertainty_value" widget="percentage"/>
</footer>
</t>
</templates>
</kanban>
</field>
</record>
<record id="emission_factor_search_view" model="ir.ui.view">
<field name="name">emission.factor.search</field>
<field name="model">esg.emission.factor</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="source_id"/>
<field name="database_id"/>
<field name="compute_method"/>
<filter name="monetary" string="Monetary" domain="[('compute_method', '=', 'monetary')]"/>
<filter name="physically" string="Physically" domain="[('compute_method', '=', 'physically')]"/>
<separator/>
<filter name="detailed_by_gas" string="Detailed by gas" domain="[('gas_line_ids', '!=', False)]"/>
<filter name="not_detailed_by_gas" string="Not detailed by gas" domain="[('gas_line_ids', '=', False)]"/>
<separator/>
<filter name="archived" string="Archived" domain="[('active', '=', False)]"/>
<separator/>
<group>
<filter name="group_by_scope" context="{'group_by': 'scope'}"/>
<filter name="group_by_valid_from" context="{'group_by': 'valid_from'}"/>
<filter name="group_by_valid_to" context="{'group_by': 'valid_to'}"/>
<separator/>
<filter name="group_by_compute_method" context="{'group_by': 'compute_method'}"/>
<filter name="group_by_database_id" context="{'group_by': 'database_id'}"/>
<filter name="group_by_uncertainty" context="{'group_by': 'esg_uncertainty_value'}"/>
<filter name="group_by_uom_id" context="{'group_by': 'uom_id'}"/>
<filter name="group_by_region" context="{'group_by': 'region'}"/>
</group>
</search>
</field>
</record>
<record id="action_view_emission_factor" model="ir.actions.act_window">
<field name="name">Emission Factors</field>
<field name="path">esg-emission-factors</field>
<field name="res_model">esg.emission.factor</field>
<field name="view_mode">list,kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create emission factors.
</p>
<p>
Define how activity data translates into CO₂e.
</p>
</field>
</record>
<record id="action_apply_factors_auto_assignment" model="ir.actions.server">
<field name="name">Assign Emission Factors</field>
<field name="model_id" ref="esg.model_esg_emission_factor"/>
<field name="binding_model_id" ref="esg.model_esg_emission_factor"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
action = env['ir.actions.act_window']._for_xml_id('esg.factors_auto_assignment_wizard_action')
action['context'] = {'from_list_view': True}
</field>
</record>
</odoo>