Browse Source

[IMP] Menu and report

pull/194/head
Maxime Chambreuil 6 years ago
parent
commit
b89e68712c
  1. 1
      agreement/__manifest__.py
  2. 23
      agreement/models/__init__.py
  3. 8
      agreement/models/res_config_settings.py
  4. 92
      agreement/views/agreement.xml
  5. 16
      agreement/views/menu.xml
  6. 11
      agreement/views/reports.xml
  7. 28
      agreement/views/res_config_settings.xml

1
agreement/__manifest__.py

@ -22,6 +22,7 @@
"data/module_category.xml", "data/module_category.xml",
"security/res_groups.xml", "security/res_groups.xml",
"security/ir.model.access.csv", "security/ir.model.access.csv",
'views/res_config_settings.xml',
"views/reports.xml", "views/reports.xml",
"views/agreement.xml", "views/agreement.xml",
"views/agreement_clause.xml", "views/agreement_clause.xml",

23
agreement/models/__init__.py

@ -1,12 +1,15 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import partner_agreement
from . import agreement_clause
from . import agreement_section
from . import agreement_stage
from . import agreement_type
from . import agreement_subtype
from . import res_partner
from . import product_template
from . import agreement_renewaltype
from . import agreement_increasetype
from . import (
res_config_settings,
agreement,
agreement_clause,
agreement_section,
agreement_stage,
agreement_type,
agreement_subtype,
res_partner,
product_template,
agreement_renewaltype,
agreement_increasetype,
)

8
agreement/models/res_config_settings.py

@ -0,0 +1,8 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

92
agreement/views/agreement.xml

@ -27,7 +27,7 @@
<header> <header>
<button string="New Version" type="object" name="create_new_version" class="oe_highlight" attrs="{'invisible': [('state', '=', 'active')]}"/> <button string="New Version" type="object" name="create_new_version" class="oe_highlight" attrs="{'invisible': [('state', '=', 'active')]}"/>
<button string="New Agreement" type="object" name="create_new_agreement" class="oe_highlight" attrs="{'invisible': [('is_template', '=', False)]}"/> <button string="New Agreement" type="object" name="create_new_agreement" class="oe_highlight" attrs="{'invisible': [('is_template', '=', False)]}"/>
<field name="state" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}"/>
<field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}"/>
</header> </header>
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
@ -37,36 +37,43 @@
</h1> </h1>
</div> </div>
<group string="General" colspan="2" col="4"> <group string="General" colspan="2" col="4">
<field name="contract_id" string="Internal ID"/>
<field name="stage_id" widget="selection" requried="True"/>
<field name="parent_agreement_id" domain="[('customer_id', '=', customer_id)]"/>
<field name="agreement_type_id" widget="selection" requried="True"/>
<field name="assigned_user_id" attrs="{'invisible': [('is_template', '=', True)], 'readonly':[('is_template', '=', True)]}"/>
<field name="agreement_subtype_id" widget="selection" domain="[('agreement_type_id', '=', agreement_type_id)]"/>
<field name="contract_id"
string="Internal ID"/>
<field name="parent_agreement_id"
domain="[('customer_id', '=', customer_id)]"/>
<field name="agreement_type_id"
widget="selection"
required="True"/>
<field name="assigned_user_id"
attrs="{'invisible': [('is_template', '=', True)], 'readonly':[('is_template', '=', True)]}"/>
<field name="agreement_subtype_id"
widget="selection"
domain="[('agreement_type_id', '=', agreement_type_id)]"/>
<field name="active" invisible="1"/> <field name="active" invisible="1"/>
<field name="state" invisible="1"/>
</group> </group>
<group> <group>
<field name="description" string="Description" requried="True"/>
<field name="description"
string="Description"
required="True"/>
</group> </group>
<group name="customer_vendor_information"> <group name="customer_vendor_information">
<group name="customer_left" string="Customer Information">
<group name="customer_left"
string="Customer Information">
<div class="o_address_format"> <div class="o_address_format">
<field name="customer_id" domain="[('customer', '=', True)]"/>
<field name="customer_street" placeholder="Street..." class="o_address_street" readonly="1"/>
<field name="customer_street2" placeholder="Street 2..." class="o_address_street" readonly="1"/>
<field name="customer_city" placeholder="City" class="o_address_city" readonly="1"/>
<field name="customer_state_id" class="o_address_state" placeholder="State" options="{&quot;no_open&quot;: True}" readonly="1"/>
<field name="customer_zip" placeholder="ZIP" class="o_address_zip" readonly="1"/>
<field name="customer_id"
domain="[('customer', '=', True)]"
context="{'show_address': 1}"
options="{&quot;always_reload&quot;: True}"/>
</div> </div>
</group> </group>
<group name="vendor_right" string="Vendor Information">
<group name="vendor_right"
string="Vendor Information">
<div class="o_address_format"> <div class="o_address_format">
<field name="vendor_id" domain="[('supplier', '=', True)]"/>
<field name="vendor_street" placeholder="Street..." class="o_address_street" readonly="1"/>
<field name="vendor_street2" placeholder="Street 2..." class="o_address_street" readonly="1"/>
<field name="vendor_city" placeholder="City" class="o_address_city" readonly="1"/>
<field name="vendor_state_id" class="o_address_state" placeholder="State" options="{&quot;no_open&quot;: True}" readonly="1"/>
<field name="vendor_zip" placeholder="ZIP" class="o_address_zip" readonly="1"/>
<field name="vendor_id"
domain="[('supplier', '=', True)]"
context="{'show_address': 1}"
options="{&quot;always_reload&quot;: True}"/>
</div> </div>
</group> </group>
<group name="contact_left" string="Primary Contact"> <group name="contact_left" string="Primary Contact">
@ -82,8 +89,8 @@
</group> </group>
<group name="term_information"> <group name="term_information">
<group name="termdates_left" string="Term Dates"> <group name="termdates_left" string="Term Dates">
<field name="start_date" requried="True" attrs="{'required': [('is_template', '=', False)], 'readonly':[('is_template', '=', True)]}"/>
<field name="end_date" requried="True" attrs="{'required': [('is_template', '=', False)], 'readonly':[('is_template', '=', True)]}"/>
<field name="start_date" required="True" attrs="{'required': [('is_template', '=', False)], 'readonly':[('is_template', '=', True)]}"/>
<field name="end_date" required="True" attrs="{'required': [('is_template', '=', False)], 'readonly':[('is_template', '=', True)]}"/>
<field name="expiration_notice"/> <field name="expiration_notice"/>
<field name="change_notice"/> <field name="change_notice"/>
<field name="notification_address_id" domain="['|',('parent_id','=',customer_id),('parent_id','=',vendor_id)]"/> <field name="notification_address_id" domain="['|',('parent_id','=',customer_id),('parent_id','=',vendor_id)]"/>
@ -102,19 +109,11 @@
<field name="special_terms"/> <field name="special_terms"/>
</group> </group>
<notebook> <notebook>
<page name="contract_document" string="Contract Document">
<page name="structure" string="Structure">
<div> <div>
<button name="%(partner_agreement_contract_document_preview)d" string="Preview" type="action" class="oe_highlight"/> <button name="%(partner_agreement_contract_document_preview)d" string="Preview" type="action" class="oe_highlight"/>
<button name="%(partner_agreement_contract_document)d" string="Print" type="action" class="oe_highlight"/> <button name="%(partner_agreement_contract_document)d" string="Print" type="action" class="oe_highlight"/>
</div> </div>
<group colspan="2" col="4">
<field name="customer_signed_date"/>
<field name="company_signed_date"/>
<field name="customer_signed_user_id" domain="[('parent_id', '=', customer_id)]"/>
<field name="company_signed_user_id"/>
<field name="signed_contract" filename="signed_contract_filename"/>
<field name="signed_contract_filename" invisible="1"/>
</group>
<group colspan="2" col="2" default_order='section_sequence'> <group colspan="2" col="2" default_order='section_sequence'>
<field name="sections_ids" string="Contract Sections" context="{'default_agreement': active_id}"> <field name="sections_ids" string="Contract Sections" context="{'default_agreement': active_id}">
<tree default_order='section_sequence'> <tree default_order='section_sequence'>
@ -133,6 +132,16 @@
</field> </field>
</group> </group>
</page> </page>
<page name="signature" string="Signatures">
<group colspan="2" col="4">
<field name="customer_signed_date"/>
<field name="company_signed_date"/>
<field name="customer_signed_user_id" domain="[('parent_id', '=', customer_id)]"/>
<field name="company_signed_user_id"/>
<field name="signed_contract" filename="signed_contract_filename"/>
<field name="signed_contract_filename" invisible="1"/>
</group>
</page>
<page name="products" string="MRC and NRC Products"> <page name="products" string="MRC and NRC Products">
<group string="Financial Details" colspan="2" col="4"> <group string="Financial Details" colspan="2" col="4">
<field name="total_company_mrc"/> <field name="total_company_mrc"/>
@ -168,7 +177,7 @@
</field> </field>
</page> </page>
<page colspan="2" col="4" name="peformance" string="Performance"> <page colspan="2" col="4" name="peformance" string="Performance">
<p>This section is a place where finincial records will show the current performance of this agreement. </p>
<p>This section is a place where financial records will show the current performance of this agreement.</p>
<p>Perhaps include invoices with total vs costs? </p> <p>Perhaps include invoices with total vs costs? </p>
</page> </page>
</notebook> </notebook>
@ -281,17 +290,24 @@
</record> </record>
<!-- actions opening views on models --> <!-- actions opening views on models -->
<record model="ir.actions.act_window" id="partner_agreement_agreement">
<record model="ir.actions.act_window" id="agreement_dashboard_agreement">
<field name="name">Agreements</field> <field name="name">Agreements</field>
<field name="res_model">agreement</field> <field name="res_model">agreement</field>
<field name="context">{"search_default_filter_non_template":1}</field>
<field name="domain">[('is_template', '=', False)]</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
</record> </record>
<record model="ir.actions.act_window" id="partner_agreement_agreement_templates">
<record model="ir.actions.act_window" id="agreement_operations_agreement">
<field name="name">Agreements</field> <field name="name">Agreements</field>
<field name="res_model">agreement</field> <field name="res_model">agreement</field>
<field name="context">{"search_default_filter_templates":1}</field>
<field name="domain">[('is_template', '=', False)]</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="partner_agreement_agreement_templates">
<field name="name">Templates</field>
<field name="res_model">agreement</field>
<field name="domain">[('is_template', '=', True)]</field>
<field name="view_mode">tree,kanban,form</field> <field name="view_mode">tree,kanban,form</field>
</record> </record>

16
agreement/views/menu.xml

@ -15,6 +15,12 @@
id="agreement_dashboard" id="agreement_dashboard"
parent="agreement_root" parent="agreement_root"
sequence="10"/> sequence="10"/>
<menuitem
name="Agreements"
id="dashboard_agreements"
parent="agreement_dashboard"
sequence="10"
action="agreement_dashboard_agreement"/>
<!-- Operations --> <!-- Operations -->
<menuitem <menuitem
@ -24,10 +30,10 @@
sequence="20"/> sequence="20"/>
<menuitem <menuitem
name="Agreements" name="Agreements"
id="agreements"
id="operations_agreements"
parent="agreement_operations" parent="agreement_operations"
sequence="10" sequence="10"
action="partner_agreement_agreement"/>
action="agreement_operations_agreement"/>
<!-- Master Data --> <!-- Master Data -->
<menuitem <menuitem
@ -68,6 +74,12 @@
sequence="50" sequence="50"
parent="agreement_root" parent="agreement_root"
groups="agreement.group_agreement_manager"/> groups="agreement.group_agreement_manager"/>
<menuitem
name="Settings"
id="agreement_settings"
sequence="10"
parent="agreement_configuration"
action="agreement.action_agreement_config"/>
<menuitem <menuitem
name="Templates" name="Templates"
id="template" id="template"

11
agreement/views/reports.xml

@ -23,17 +23,20 @@
<t t-foreach="docs" t-as="doc"> <t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout"> <t t-call="web.external_layout">
<div class="page"> <div class="page">
<h3>!!! THIS IS JUST AN EXAMPLE REPORT TO SHOW HOW SECTIONS/CLAUSES CAN LOOK. MORE WORK IS NEEDED FOR FORMATTING</h3>
<h1 t-field="doc.name"/>
<h2>Parties</h2>
<h3>Company Information</h3>
<h3>Customer Information</h3>
<table class="table table-condensed"> <table class="table table-condensed">
<tbody class="section_tbody"> <tbody class="section_tbody">
<tr t-foreach="doc.sections_ids" t-as="s"> <tr t-foreach="doc.sections_ids" t-as="s">
<h3 t-field="s.name"/>
<h2 t-field="s.name"/>
<span t-field="s.content"/> <span t-field="s.content"/>
<table class="table table-condensed"> <table class="table table-condensed">
<tbody class="clause_tbody"> <tbody class="clause_tbody">
<tr t-foreach="s.clauses_ids" t-as="c"> <tr t-foreach="s.clauses_ids" t-as="c">
<h4 style="padding:20px" t-field="c.name"/>
<h5 style="padding:20px" t-field="c.content"/>
<h3 style="padding:20px" t-field="c.name"/>
<h4 style="padding:20px" t-field="c.content"/>
</tr> </tr>
</tbody> </tbody>
</table> </table>

28
agreement/views/res_config_settings.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.agreement</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="40"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block"
data-string="Agreements"
string="Agreements"
data-key="agreement"
groups="agreement.group_agreement_manager">
</div>
</xpath>
</field>
</record>
<act_window id="action_agreement_config"
name="Settings"
res_model="res.config.settings"
view_mode="form"
target="inline"
context="{'module': 'agreement'}"/>
</odoo>
Loading…
Cancel
Save