Browse Source
[IMP][10.0] contract: Add report + send by mail (#86)
[IMP][10.0] contract: Add report + send by mail (#86)
* [IMP][9.0] contract: Add report + send by mail * Update translation and rename contract report * Changes requested and translation updatedpull/121/head
cubells
7 years ago
committed by
Pedro M. Baeza
9 changed files with 366 additions and 4 deletions
-
8contract/README.rst
-
5contract/__manifest__.py
-
64contract/data/mail_template.xml
-
165contract/i18n/es.po
-
33contract/models/account_analytic_account.py
-
12contract/report/contract_views.xml
-
74contract/report/report_contract.xml
-
4contract/tests/test_contract.py
-
5contract/views/account_analytic_account_view.xml
@ -0,0 +1,64 @@ |
|||
<?xml version="1.0" ?> |
|||
<odoo noupdate="1"> |
|||
|
|||
<record id="email_contract_template" model="mail.template"> |
|||
<field name="name">Email Contract Template</field> |
|||
<field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> |
|||
<field name="subject">${object.company_id.name} Contract (Ref ${object.name or 'n/a'})</field> |
|||
<field name="partner_to">${object.partner_id.id}</field> |
|||
<field name="model_id" ref="contract.model_account_analytic_account"/> |
|||
<field name="auto_delete" eval="True"/> |
|||
<field name="report_template" ref="contract.report_contract"/> |
|||
<field name="report_name">Contract</field> |
|||
<field name="lang">${object.partner_id.lang}</field> |
|||
<field name="body_html"><![CDATA[ |
|||
<div style="font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> |
|||
<p>Hello ${object.partner_id.name or ''},</p> |
|||
<p>A new contract has been created: </p> |
|||
|
|||
<p style="border-left: 1px solid #8e0000; margin-left: 30px;"> |
|||
<strong>REFERENCES</strong><br /> |
|||
Contract: <strong>${object.name}</strong><br /> |
|||
% if object.date_start: |
|||
Contract Date Start: ${object.date_start or ''}<br /> |
|||
% endif |
|||
|
|||
% if object.user_id: |
|||
% if object.user_id.email: |
|||
Your Contact: <a href="mailto:${object.user_id.email or ''}?subject=Contract%20${object.name}">${object.user_id.name}</a> |
|||
% else: |
|||
Your Contact: ${object.user_id.name} |
|||
% endif |
|||
% endif |
|||
</p> |
|||
|
|||
<br/> |
|||
<p>If you have any questions, do not hesitate to contact us.</p> |
|||
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p> |
|||
<br/> |
|||
<br/> |
|||
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> |
|||
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> |
|||
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> |
|||
</div> |
|||
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> |
|||
<span style="color: #222; margin-bottom: 5px; display: block; "> |
|||
${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} |
|||
</span> |
|||
% if object.company_id.phone: |
|||
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> |
|||
Phone: ${object.company_id.phone} |
|||
</div> |
|||
% endif |
|||
% if object.company_id.website: |
|||
<div> |
|||
Web: <a href="${object.company_id.website}">${object.company_id.website}</a> |
|||
</div> |
|||
%endif |
|||
<p></p> |
|||
</div> |
|||
</div> |
|||
]]></field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<report |
|||
id="report_contract" |
|||
model="account.analytic.account" |
|||
string="Contract" |
|||
report_type="qweb-pdf" |
|||
name="contract.report_contract_document" |
|||
file="contract.report_contract"/> |
|||
|
|||
</odoo> |
@ -0,0 +1,74 @@ |
|||
<?xml version="1.0" ?> |
|||
<odoo> |
|||
|
|||
<template id="report_contract_document"> |
|||
<t t-call="report.html_container"> |
|||
<t t-foreach="docs" t-as="o"> |
|||
<t t-call="report.external_layout"> |
|||
<div class="page"> |
|||
<div class="oe_structure"/> |
|||
<div class="row" id="partner_info"> |
|||
<div class="col-xs-5 col-xs-offset-7"> |
|||
<p id="partner_info"><strong>Partner:</strong></p> |
|||
<div t-field="o.partner_id" t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "mobile", "fax", "email"], "no_marker": true, "phone_icons": true}'/> |
|||
<p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> |
|||
</div> |
|||
</div> |
|||
<div class="row" id="header_info"> |
|||
<div class="col-xs-3"> |
|||
<strong>Date Start: </strong><p t-field="o.date_start"/> |
|||
<strong>Responsible: </strong><p t-field="o.user_id"/> |
|||
<strong>Contract: </strong><p t-field="o.code"/> |
|||
</div> |
|||
</div> |
|||
<div class="row" id="invoice_info"> |
|||
<t t-set="total" t-value="0"/> |
|||
<div class="col-xs-12"> |
|||
<t t-set="total" t-value="0"/> |
|||
<p id="services_info"><strong>Recurring Items</strong></p> |
|||
<table class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th><strong>Description</strong></th> |
|||
<th class="text-right"><strong>Quantity</strong></th> |
|||
<th class="text-right"><strong>Unit Price</strong></th> |
|||
<th class="text-right"><strong>Price</strong></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr t-foreach="o.recurring_invoice_line_ids" t-as="l"> |
|||
<td> |
|||
<span t-field="l.name"/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="l.quantity"/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="l.price_unit" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="l.price_subtotal" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> |
|||
</td> |
|||
<t t-set="total" t-value="total + l.price_subtotal"/> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="col-xs-4 pull-right"> |
|||
<table class="table table-condensed"> |
|||
<tr class="border-black"> |
|||
<td><strong>Total</strong></td> |
|||
<td class="text-right"> |
|||
<span t-esc="total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue