242 lines
11 KiB
XML
242 lines
11 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- ============================================================
|
|
Checks — kanban
|
|
The check is worked through one at a time, so the card shows the
|
|
description inline rather than hiding it behind a click: the whole
|
|
point is that the reviewer reads the instruction.
|
|
============================================================ -->
|
|
<record id="view_dn_audit_check_kanban" model="ir.ui.view">
|
|
<field name="name">dn.audit.check.kanban</field>
|
|
<field name="model">dn.audit.check</field>
|
|
<field name="arch" type="xml">
|
|
<kanban default_group_by="result" records_draggable="1" create="1">
|
|
<!-- `name` has to be declared even though the card prints it
|
|
through `record.name.raw_value`: the record only carries
|
|
the fields the view asks for, so reading a raw_value for
|
|
an undeclared field is `undefined.raw_value` and blows the
|
|
whole kanban up the moment a record is rendered. -->
|
|
<field name="name"/>
|
|
<field name="result"/>
|
|
<field name="check_type"/>
|
|
<field name="cycle_id"/>
|
|
<field name="return_id"/>
|
|
<field name="attachment_count"/>
|
|
<templates>
|
|
<t t-name="card" class="o_dn_audit_check_card">
|
|
<div class="d-flex flex-column w-100">
|
|
<div class="d-flex justify-content-between align-items-start gap-2">
|
|
<strong><field name="name"/></strong>
|
|
<span t-if="record.check_type.raw_value === 'file'"
|
|
class="badge text-bg-secondary flex-shrink-0">Document</span>
|
|
</div>
|
|
<div t-if="record.cycle_id.raw_value" class="small text-muted mt-1">
|
|
<field name="cycle_id"/>
|
|
</div>
|
|
<div class="small text-muted mt-1" t-if="record.attachment_count.raw_value">
|
|
<i class="fa fa-paperclip me-1"/><field name="attachment_count"/>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
<t t-name="menu">
|
|
<a class="dropdown-item" type="object" name="action_open">Open</a>
|
|
</t>
|
|
</templates>
|
|
</kanban>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_dn_audit_check_form" model="ir.ui.view">
|
|
<field name="name">dn.audit.check.form</field>
|
|
<field name="model">dn.audit.check</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Check">
|
|
<header>
|
|
<!-- Direct method buttons rather than server actions: the
|
|
whole job is a one-field write, and referencing a
|
|
server action defined further down the same file
|
|
resolves at load time, before that record exists. -->
|
|
<button name="action_mark_done" type="object"
|
|
string="Mark Done" class="btn-primary"
|
|
invisible="result in ('done', 'na')"/>
|
|
<button name="action_mark_na" type="object"
|
|
string="Not Applicable" invisible="result in ('done', 'na')"/>
|
|
<field name="result" widget="statusbar"
|
|
statusbar_visible="todo,done,na,comment"/>
|
|
</header>
|
|
<sheet>
|
|
<div class="oe_title">
|
|
<label for="name"/>
|
|
<h1><field name="name"/></h1>
|
|
</div>
|
|
<group>
|
|
<group>
|
|
<field name="return_id" readonly="1"/>
|
|
<field name="cycle_id"/>
|
|
<field name="check_type"/>
|
|
</group>
|
|
<group>
|
|
<field name="user_id"/>
|
|
<field name="date_review"/>
|
|
<field name="date_from" invisible="1"/>
|
|
<field name="date_to" invisible="1"/>
|
|
</group>
|
|
</group>
|
|
<group string="Instructions">
|
|
<field name="description" nolabel="1" colspan="2" readonly="1"/>
|
|
</group>
|
|
<group string="Review">
|
|
<field name="comment" nolabel="1" colspan="2"
|
|
placeholder="What did you check, and what did you find?"/>
|
|
</group>
|
|
<group string="Documents"
|
|
invisible="check_type != 'file' and not attachment_ids">
|
|
<field name="attachment_ids" nolabel="1" colspan="2"
|
|
widget="many2many_binary"/>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_dn_audit_check_list" model="ir.ui.view">
|
|
<field name="name">dn.audit.check.list</field>
|
|
<field name="model">dn.audit.check</field>
|
|
<field name="arch" type="xml">
|
|
<list string="Checks" decoration-danger="result == 'todo'"
|
|
decoration-success="result in ('done', 'na')">
|
|
<field name="return_id"/>
|
|
<field name="name"/>
|
|
<field name="cycle_id"/>
|
|
<field name="check_type"/>
|
|
<field name="result" widget="badge"
|
|
decoration-danger="result == 'todo'"
|
|
decoration-success="result in ('done', 'na')"
|
|
decoration-warning="result == 'comment'"/>
|
|
<field name="user_id"/>
|
|
<field name="date_review"/>
|
|
<field name="attachment_count"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_dn_audit_check_search" model="ir.ui.view">
|
|
<field name="name">dn.audit.check.search</field>
|
|
<field name="model">dn.audit.check</field>
|
|
<field name="arch" type="xml">
|
|
<search>
|
|
<field name="name"/>
|
|
<field name="return_id"/>
|
|
<field name="cycle_id"/>
|
|
<filter name="todo" string="To Do" domain="[('result', '=', 'todo')]"/>
|
|
<filter name="done" string="Done" domain="[('result', '=', 'done')]"/>
|
|
<filter name="na" string="Not Applicable" domain="[('result', '=', 'na')]"/>
|
|
<separator/>
|
|
<filter name="mine" string="Assigned to Me"
|
|
domain="[('user_id', '=', uid)]"/>
|
|
<separator/>
|
|
<filter name="group_cycle" string="Cycle" context="{'group_by': 'cycle_id'}"/>
|
|
<filter name="group_result" string="Result" context="{'group_by': 'result'}"/>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="action_dn_audit_check" model="ir.actions.act_window">
|
|
<field name="name">Checks</field>
|
|
<field name="res_model">dn.audit.check</field>
|
|
<field name="view_mode">kanban,list,form</field>
|
|
<field name="search_view_id" ref="view_dn_audit_check_search"/>
|
|
<field name="context">{'search_default_todo': 1}</field>
|
|
</record>
|
|
|
|
<!-- Small server actions, so the two statusbar buttons on the check form
|
|
do not need a wizard just to write a selection value. -->
|
|
<record id="action_dn_audit_check_set_done" model="ir.actions.server">
|
|
<field name="name">Mark Check Done</field>
|
|
<field name="model_id" ref="model_dn_audit_check"/>
|
|
<field name="binding_model_id" ref="model_dn_audit_check"/>
|
|
<field name="binding_view_types">form</field>
|
|
<field name="state">code</field>
|
|
<field name="code">records.action_set_result('done')</field>
|
|
</record>
|
|
<record id="action_dn_audit_check_set_na" model="ir.actions.server">
|
|
<field name="name">Mark Check Not Applicable</field>
|
|
<field name="model_id" ref="model_dn_audit_check"/>
|
|
<field name="binding_model_id" ref="model_dn_audit_check"/>
|
|
<field name="binding_view_types">form</field>
|
|
<field name="state">code</field>
|
|
<field name="code">records.action_set_result('na')</field>
|
|
</record>
|
|
|
|
<!-- ============================================================
|
|
Cycles and templates — configuration
|
|
============================================================ -->
|
|
<record id="view_dn_audit_cycle_list" model="ir.ui.view">
|
|
<field name="name">dn.audit.cycle.list</field>
|
|
<field name="model">dn.audit.cycle</field>
|
|
<field name="arch" type="xml">
|
|
<list editable="bottom" string="Audit Cycles">
|
|
<field name="sequence" widget="handle"/>
|
|
<field name="name"/>
|
|
<field name="code"/>
|
|
<field name="description"/>
|
|
<field name="active" widget="boolean_toggle"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="action_dn_audit_cycle" model="ir.actions.act_window">
|
|
<field name="name">Audit Cycles</field>
|
|
<field name="res_model">dn.audit.cycle</field>
|
|
<field name="view_mode">list,form</field>
|
|
</record>
|
|
|
|
<record id="view_dn_audit_check_template_list" model="ir.ui.view">
|
|
<field name="name">dn.audit.check.template.list</field>
|
|
<field name="model">dn.audit.check.template</field>
|
|
<field name="arch" type="xml">
|
|
<list editable="bottom" string="Check Templates">
|
|
<field name="sequence" widget="handle"/>
|
|
<field name="name"/>
|
|
<field name="cycle_id"/>
|
|
<field name="check_type"/>
|
|
<field name="active" widget="boolean_toggle"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_dn_audit_check_template_form" model="ir.ui.view">
|
|
<field name="name">dn.audit.check.template.form</field>
|
|
<field name="model">dn.audit.check.template</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Check Template">
|
|
<sheet>
|
|
<div class="oe_title">
|
|
<label for="name"/>
|
|
<h1><field name="name"/></h1>
|
|
</div>
|
|
<group>
|
|
<group>
|
|
<field name="cycle_id"/>
|
|
<field name="check_type"/>
|
|
<field name="sequence"/>
|
|
</group>
|
|
<group>
|
|
<field name="active"/>
|
|
</group>
|
|
</group>
|
|
<group string="Instructions">
|
|
<field name="description" nolabel="1" colspan="2"/>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="action_dn_audit_check_template" model="ir.actions.act_window">
|
|
<field name="name">Check Templates</field>
|
|
<field name="res_model">dn.audit.check.template</field>
|
|
<field name="view_mode">list,form</field>
|
|
</record>
|
|
</odoo>
|