[IMP] contract: Portal

This commit is contained in:
Víctor Martínez
2020-12-01 09:21:40 +01:00
parent f7863ae38d
commit 305ca3f540
23 changed files with 742 additions and 284 deletions

View File

@@ -39,6 +39,9 @@
string="Cancel Contract Termination"
attrs="{'invisible': [('is_terminated','=',False)]}"
groups="contract.can_terminate_contract"/>
<button type="object"
string="Preview"
name="action_preview"/>
</header>
<sheet string="Contract">
<div class="oe_button_box" name="button_box">

View File

@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 Tecnativa - Víctor Martínez
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="portal_my_home_menu_contract" name="Portal layout : Contract menu entries" inherit_id="portal.portal_breadcrumbs" priority="35">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'Contracts'" t-attf-class="breadcrumb-item #{'active ' if not contract else ''}">
<a t-if="contract" t-attf-href="/my/contracts?{{ keep_query() }}">Contracts</a>
<t t-else="">Contracts</t>
</li>
<li t-if="contract" class="breadcrumb-item active">
<t t-esc="contract.name"/>
</li>
</xpath>
</template>
<template id="portal_my_home_contract" name="Portal My Home : Contract entries" inherit_id="portal.portal_my_home" priority="30">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<t t-call="portal.portal_docs_entry" t-if="contract_count">
<t t-set="title">Contracts</t>
<t t-set="url" t-value="'/my/contracts'"/>
<t t-set="count" t-value="contract_count"/>
</t>
</xpath>
</template>
<template id="portal_my_contracts" name="My Contracts">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True"/>
<t t-call="portal.portal_searchbar">
<t t-set="title">Contracts</t>
</t>
<t t-if="contracts" t-call="portal.portal_table">
<thead>
<tr class="active">
<th>Contract #</th>
<th class='d-none d-md-table-cell'>Date</th>
<th class='d-none d-md-table-cell'>Date end</th>
<th class='text-right'>Reference</th>
</tr>
</thead>
<tbody>
<t t-foreach="contracts" t-as="contract">
<tr>
<td>
<a
t-att-href="contract.get_portal_url()"
t-attf-class="tr_contract_link"
t-att-title="contract.name"
>
<t t-esc="contract.name"/>
</a>
</td>
<td class="d-none d-md-table-cell"><span t-field="contract.recurring_next_date"/></td>
<td class="d-none d-md-table-cell"><span t-field="contract.date_end"/></td>
<td class='text-right'><span t-field="contract.code"/></td>
</tr>
</t>
</tbody>
</t>
</t>
</template>
<template id="portal_contract_page" name="My Contract">
<t t-call="portal.portal_layout">
<t t-set="o_portal_fullwidth_alert">
<t t-call="portal.portal_back_in_edit_mode">
<t t-set="backend_url" t-value="'/web#return_label=Website&amp;model=contract.contract&amp;id=%s&amp;view_type=form' % (contract.id)"/>
</t>
</t>
<t t-call="portal.portal_record_layout">
<t t-set="card_header">
<h5 class="mb-0">
<span>
Contract Order - <span t-field="contract.name"/>
</span>
</h5>
</t>
<t t-set="card_body">
<div id="general_information">
<div class="row mt4">
<div t-if="contract.partner_id" class="col-12 col-md-6 mb-4 mb-md-0">
<h6><strong>Customer:</strong></h6>
<div class="row">
<div class="col flex-grow-0 pr-3">
<img t-if="contract.partner_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(contract.partner_id.image)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-sm-0">
<address t-field="contract.partner_id" t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'/>
</div>
</div>
</div>
<div t-if="contract.user_id" class="col-12 col-md-6">
<h6><strong>Responsible:</strong></h6>
<div class="row">
<div class="col flex-grow-0 pr-3">
<img t-if="contract.user_id.image" class="rounded-circle mt-1 o_portal_contact_img" t-att-src="image_data_uri(contract.user_id.image)" alt="Contact"/>
<img t-else="" class="rounded-circle mt-1 o_portal_contact_img" src="/web/static/src/img/user_menu_avatar.png" alt="Contact"/>
</div>
<div class="col pl-sm-0">
<address t-field="contract.user_id" t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'/>
</div>
</div>
</div>
</div>
<div class="row mt32" id="product_information">
<div class="col-12 col-md-6 mb-4 mb-md-0">
<div t-if="contract.code" class="row mb-2 mb-sm-1">
<div class="col-12 col-sm-4">
<strong>Reference</strong>
</div>
<div class="col-12 col-sm-8">
<span t-field="contract.code"/>
</div>
</div>
<div t-if="contract.recurring_next_date" class="row mb-2 mb-sm-1">
<div class="col-12 col-sm-4">
<strong>Date of Next Invoice</strong>
</div>
<div class="col-12 col-sm-8">
<span t-field="contract.recurring_next_date" t-options='{"widget": "date"}'/>
</div>
</div>
<div t-if="contract.date_end" class="row mb-2 mb-sm-1">
<div class="col-12 col-sm-4">
<strong>Date end</strong>
</div>
<div class="col-12 col-sm-8">
<span t-field="contract.date_end" t-options='{"widget": "date"}'/>
</div>
</div>
</div>
</div>
<div id="item_details">
<table class="table table-sm" id="sales_order_table">
<thead class="bg-100">
<tr>
<th class="text-left">Description</th>
<th class="text-right">Recurrence</th>
<th class="text-right">Date of next invoice</th>
<th class="text-right">Last date invoice</th>
</tr>
</thead>
<tbody class="contract_tbody">
<t t-foreach="contract.contract_line_ids" t-as="line">
<tr>
<td id="line_name"><span t-field="line.name"/></td>
<td class="text-right">
<span t-field="line.recurring_interval"/>
<t t-if="line.recurring_rule_type=='daily'">Day(s)</t>
<t t-if="line.recurring_rule_type=='weekly'">Week(s)</t>
<t t-if="line.recurring_rule_type=='monthly'">Month(s)</t>
<t t-if="line.recurring_rule_type=='monthlylastday'">Month(s) last day</t>
<t t-if="line.recurring_rule_type=='quarterly'">Quarter(s)</t>
<t t-if="line.recurring_rule_type=='semesterly'">Semester(s)</t>
<t t-if="line.recurring_rule_type=='yearly'">Year(s)</t>
</td>
<td class="text-right"><span t-field="line.recurring_next_date"/></td>
<td class="text-right"><span t-field="line.last_date_invoiced"/></td>
</tr>
</t>
</tbody>
</table>
</div>
</div>
</t>
</t>
<!-- chatter -->
<div id="contract_communication" class="mt-4">
<h2>Communication</h2>
<t t-call="portal.message_thread">
<t t-set="object" t-value="contract"/>
<t t-set="token" t-value="contract.access_token"/>
<t t-set="pid" t-value="pid"/>
<t t-set="hash" t-value="hash"/>
</t>
</div>
</t>
</template>
</odoo>