yaltik_odoo_custom/grant_followup/views/grant_file_views.xml

296 lines
14 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo>
<data>
<!-- Trees -->
<record id="grant_file_tree" model="ir.ui.view">
<field name="name">Grant File Tree</field>
<field name="model">grant.file</field>
<field name="arch" type="xml">
<tree colors="grey: state=='1_draft'; black: state in ('2_sent', '3_edited'); blue: state == '4_grant_notification'; red: state=='0_refused'; green: state in ('6_first_paiement_received','7_finished')">
<field name="title"/>
<field name="partner_id"/>
<field name="partner_ids" widget="many2many_tags" />
<field name="reply_deadline"/>
<field name="significance" />
<field name="currency_id" invisible="1" />
<field name="requested_amount"/>
<field name="notified_amount"/>
<field name="received_amount"/>
<field name="responsible_id"/>
<field name="assessment_sent"/>
<field name="doc_count"/>
<field name="state"/>
</tree>
</field>
</record>
<!-- Forms -->
<record id="grant_file_form" model="ir.ui.view">
<field name="name">Grant File Form</field>
<field name="model">grant.file</field>
<field name="arch" type="xml">
<form string="Grant">
<header>
<button name="state_refused" type="object" string="Mark as refused"
confirm="Are you sure you want to mark this file as refused ?"
states="2_sent,3_edited" />
<button name="state_draft" type="object" string="Go back to draft"
states="2_sent,0_refused" />
<button name="state_sent" type="object" string="Mark as sent"
class="oe_highlight" states="1_draft" />
<button name="state_edit" type="object" string="Edit file"
class="oe_highlight" states="2_sent,3_edited" />
<button name="state_grant_notification" type="object"
string="Grant notified" class="oe_highlight" states="2_sent,3_edited" />
<button name="sent_assessment" type="object"
string="Mark Assessment as Sent" class="oe_highlight"
confirm="Are you sure you want to mark assessment as sent ?"
attrs="{'invisible': ['|', ('assessment_sent', '!=', False),
('state', 'not in', ('4_grant_notification', '6_first_paiement_received', '7_finished'))]}" />
<button name="unsent_assessment" type="object"
string="Mark Assessment as Not Sent"
confirm="Are you sure you want to mark assessment as not sent ?"
attrs="{'invisible': ['|', ('assessment_sent', '=', False),
('state', 'not in', ('4_grant_notification', '6_first_paiement_received', '7_finished'))]}" />
<field name="state" widget="statusbar" />
</header>
<sheet>
<group>
<group>
<field name="id" invisible="1" />
<field name="title" />
<field name="partner_id" />
<field name="partner_ids" widget="many2many_tags" />
<field name="reply_deadline" />
<field name="assessment_deadline" />
<field name="significance" widget="priority"/>
</group>
<group>
<field name="currency_id" invisible="1" />
<field name="requested_amount" />
<field name="notified_amount" />
<field name="received_amount" />
<field name="responsible_id" />
<field name="assessment_sent" />
</group>
</group>
<group>
<field name="description" />
</group>
<notebook>
<page name="amount_lines" string="Amount details">
<p style="color: red;" attrs="{'invisible': [('id', '!=', False)]}">
You must save your grant file before being able to enter amount lines.
</p>
<group>
<field name="amount_line_ids" nolabel="1"
context="{'default_file_id': active_id}"
attrs="{'readonly': [('id', '=', False)]}">
<tree editable="bottom"
colors="gray: notified_amount == 0.0; blue: received_amount != 0.0 and received_amount &lt; notified_amount; green: received_amount != 0.0 and received_amount == notified_amount;">
<field name="file_id" invisible="1" />
<field name="file_requested_amount" invisible="1" />
<field name="file_notified_amount" invisible="1" />
<field name="file_received_amount" invisible="1" />
<field name="currency_id" invisible="1" />
<field name="name" />
<field name="requested_amount" sum="Total requested" />
<field name="notified_amount" sum="Total notified" />
<field name="received_amount" sum="Total received" />
<field name="remaining_amount" sum="Total remaining" />
</tree>
</field>
</group>
</page>
<page name="notes" string="Notes">
<group>
<field name="note" nolabel="1" />
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>
<!-- Search -->
<record id="grant_file_search" model="ir.ui.view">
<field name="name">Grant File Search</field>
<field name="model">grant.file</field>
<field name="arch" type="xml">
<search>
<field name="title"/>
<field name="partner_id"/>
<field name="partner_ids" string="All partners"
filter_domain="['|', ('partner_id', 'ilike', self), ('partner_ids', 'ilike', self)]"/>
<field name="responsible_id"/>
<field name="reply_deadline"/>
<field name="assessment_deadline"/>
<filter name="state_draft" string="Draft"
domain="[('state', '=', '1_draft')]" />
<filter name="state_sent" string="Sent"
domain="[('state', '=', '2_sent')]" />
<filter name="state_edited" string="Edited"
domain="[('state', '=', '3_edited')]" />
<filter name="state_grant_notification" string="Grant Notification"
domain="[('state', '=', '4_grant_notification')]"/>
<filter name="state_assessment_sent" string="Assessment Sent"
domain="[('state', '=', '5_assessment_sent')]" />
<filter name="state_first_paiement_received" string="First Paiement Received"
domain="[('state', '=', '6_first_paiement_received')]"/>
<filter name="state_finished" string="Finished"
domain="[('state', '=', '7_finished')]"/>
<filter name="state_refused" string="Refused"
domain="[('state', '=', '0_refused')]"/>
<separator />
<filter name="assessment_sent_1" string="Assessment sent"
domain="[('assessment_sent', '=', True)]"/>
<filter name="assessment_sent_0" string="Assessment not sent"
domain="[('assessment_sent', '=', False)]"/>
<filter name="group_state" string="State"
context="{'group_by': 'state'}"/>
<filter name="group_significance" string="Significance"
context="{'group_by': 'significance'}"/>
<filter name="group_partner" string="Main partner"
context="{'group_by': 'partner_id'}"/>
<filter name="group_responsible" string="Responsible"
context="{'group_by': 'responsible_id'}"/>
<filter name="group_reply_deadline_month" string="Reply deadline (month)"
context="{'group_by': 'reply_deadline'}"/>
<filter name="group_reply_deadline_week" string="Reply deadline (week)"
context="{'group_by': 'reply_deadline:week'}"/>
<filter name="group_assessment_deadline_month"
string="Assessment deadline (month)"
context="{'group_by': 'assessment_deadline'}"/>
<filter name="group_assessment_deadline_week"
string="Assessment deadline (week)"
context="{'group_by': 'assessment_deadline:week'}"/>
</search>
</field>
</record>
<!-- Kanban -->
<record id="grant_file_kanban" model="ir.ui.view">
<field name="name">Grant File Kanban</field>
<field name="model">grant.file</field>
<field name="arch" type="xml">
<kanban default_group_by="state"
class="o_kanban_small_column">
<field name="title"/>
<field name="partner_id"/>
<field name="partner_ids"/>
<field name="display_partner_ids"/>
<field name="responsible_id"/>
<field name="reply_deadline"/>
<field name="significance"/>
<field name="received_amount"/>
<field name="requested_amount"/>
<field name="notified_amount"/>
<field name="currency_id"/>
<field name="color"/>
<field name="doc_count"/>
<templates>
<t t-name="kanban-box">
<!-- Set the Kanban Card color: -->
<div t-attf-class="#{kanban_color(record.color.raw_value)}
oe_kanban_global_click">
<div class="o_dropdown_kanban dropdown">
<!-- Top-right drop down menu here... -->
<a class="dropdown-toggle btn" data-toggle="dropdown" href="#">
<span class="fa fa-bars fa-lg"/>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<!-- Edit and Delete actions, if available: -->
<t t-if="widget.editable">
<li><a type="edit">Edit</a></li>
</t>
<t t-if="widget.deletable">
<li><a type="delete">Delete</a></li>
</t>
<li>
<ul class="oe_kanban_colorpicker" data-field="color"/>
</li>
</ul>
</div>
<div class="oe_kanban_content">
<div>
<strong>
<a type="open"><field name="title" /></a>
</strong>
</div>
<ul>
<li t-if="record.partner_id.raw_value">
<field name="partner_id" />
<span t-if="record.partner_ids.raw_value.length &gt; 1"
style="text-size: smaller; opacity: 0.7;">
(<t t-esc="record.display_partner_ids.raw_value" />)
</span>
</li>
<li t-if="record.reply_deadline.raw_value">
<span style="color: grey;">Reply deadline :</span>
<field name="reply_deadline" />
</li>
<li>Requested : <field name="requested_amount" /></li>
<li t-if="record.notified_amount.raw_value"
t-attf-style="{{record.notified_amount.raw_value &lt; record.requested_amount.raw_value ? 'color: orange;' : 'color: green;'}}">
Notified : <field name="notified_amount" />
</li>
<li t-if="record.received_amount.raw_value"
t-attf-style="{{record.received_amount.raw_value &lt; record.notified_amount.raw_value ? 'color: blue;' : 'color: green;'}}">
Received : <field name="received_amount" />
</li>
<li t-if="record.doc_count.raw_value">
<field name="doc_count" />
<span style="font-style: italic;">document(s) attached</span>
</li>
</ul>
<div class="oe_kanban_footer">
<div class="oe_kanban_footer_left">
<!-- Left hand footer... -->
<field name="significance" widget="priority" />
</div>
<div>
<!-- Right hand footer... -->
<img t-att-title="record.responsible_id.value"
t-att-src="kanban_image('res.users', 'image_small', record.responsible_id.raw_value)"
width="24" height="24"
class="oe_kanban_avatar pull-right" />
</div>
</div>
</div> <!-- oe_kanban_content -->
<div class="oe_clear"/>
</div> <!-- kanban color -->
</t>
</templates>
</kanban>
</field>
</record>
</data>
</odoo>