Browse Source

[IMP][9.0] contract: Add report + send by mail (#81)

pull/93/head
cubells 7 years ago
committed by Pedro M. Baeza
parent
commit
c677f03924
  1. 5
      contract/README.rst
  2. 5
      contract/__openerp__.py
  3. 58
      contract/data/contract_template.xml
  4. 168
      contract/i18n/es.po
  5. 101
      contract/i18n/es_ES.po
  6. 34
      contract/models/contract.py
  7. 11
      contract/report/contract_views.xml
  8. 74
      contract/report/report_contract.xml
  9. 4
      contract/tests/test_contract.py
  10. 5
      contract/views/contract.xml

5
contract/README.rst

@ -9,6 +9,8 @@ Contracts for recurrent invoicing
This module forward-port to v9 the contracts management with recurring
invoicing functions.
Also you can print and send by email contract report.
Configuration
=============
@ -39,6 +41,8 @@ To use this module, you need to:
click on *Create invoices* to force this action.
#. Click *Show recurring invoices* link to show all invoices created by the
contract.
#. Click on *Print > Contract* menu to print contract report.
#. Click on *Send by Email* button to send contract by email.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
@ -66,6 +70,7 @@ Contributors
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Carlos Dauden <carlos.dauden@tecnativa.com>
* Angel Moya <angel.moya@domatix.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
Maintainer
----------

5
contract/__openerp__.py

@ -5,7 +5,7 @@
{
'name': 'Contracts Management recurring',
'version': '9.0.1.1.0',
'version': '9.0.1.2.0',
'category': 'Contract Management',
'license': 'AGPL-3',
'author': "OpenERP SA,"
@ -15,7 +15,10 @@
'depends': ['base', 'account', 'analytic'],
'data': [
'security/ir.model.access.csv',
'report/report_contract.xml',
'report/contract_views.xml',
'data/contract_cron.xml',
'data/contract_template.xml',
'views/contract.xml',
'views/account_invoice_view.xml',
],

58
contract/data/contract_template.xml

@ -0,0 +1,58 @@
<?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 &lt;%s&gt;' % (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;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
&nbsp;&nbsp;Contract: <strong>${object.name}</strong><br />
&nbsp;&nbsp;Contract date start: ${object.date_start or ''}<br />
% if object.user_id:
&nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Contract%20${object.name}">${object.user_id.name}</a>
% endif
</p>
<br/>
<p>If you have any question, 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:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<p></p>
</div>
</div>
]]></field>
</record>
</odoo>

168
contract/i18n/es.po

@ -2,21 +2,105 @@
# This file contains the translation of the following modules:
# * contract
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: contract (9.0)\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-01 02:46+0000\n"
"PO-Revision-Date: 2017-04-28 09:21+0000\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-contract-9-0/language/es/)\n"
"POT-Creation-Date: 2017-08-02 17:47+0000\n"
"PO-Revision-Date: 2017-08-02 17:47+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: \n"
#. module: contract
#: model:mail.template,body_html:contract.email_contract_template
msgid "\n"
"<div style=\"font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
" <p>Hello ${object.partner_id.name or ''},</p>\n"
" <p>A new contract has been created: </p>\n"
"\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\n"
" &nbsp;&nbsp;<strong>REFERENCES</strong><br />\n"
" &nbsp;&nbsp;Contract: <strong>${object.name}</strong><br />\n"
" &nbsp;&nbsp;Contract date start: ${object.date_start or ''}<br />\n"
"\n"
" % if object.user_id:\n"
" &nbsp;&nbsp;Your contact: <a href=\"mailto:${object.user_id.email or ''}?subject=Contract%20${object.name}\">${object.user_id.name}</a>\n"
" % endif\n"
" </p>\n"
"\n"
" <br/>\n"
" <p>If you have any question, do not hesitate to contact us.</p>\n"
" <p>Thank you for choosing ${object.company_id.name or 'us'}!</p>\n"
" <br/>\n"
" <br/>\n"
" <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;\">\n"
" <h3 style=\"margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;\">\n"
" <strong style=\"text-transform:uppercase;\">${object.company_id.name}</strong></h3>\n"
" </div>\n"
" <div style=\"width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;\">\n"
" <span style=\"color: #222; margin-bottom: 5px; display: block; \">\n"
" ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe}\n"
" </span>\n"
" % if object.company_id.phone:\n"
" <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; \">\n"
" Phone:&nbsp; ${object.company_id.phone}\n"
" </div>\n"
" % endif\n"
" % if object.company_id.website:\n"
" <div>\n"
" Web :&nbsp;<a href=\"${object.company_id.website}\">${object.company_id.website}</a>\n"
" </div>\n"
" %endif\n"
" <p></p>\n"
" </div>\n"
"</div>\n"
" "
msgstr "\n"
"<div style=\"font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
" <p>Hola ${object.partner_id.name or ''},</p>\n"
" <p>Se ha creado un nuevo contrato: </p>\n"
"\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\n"
" &nbsp;&nbsp;<strong>REFERENCIAS</strong><br />\n"
" &nbsp;&nbsp;Contrato: <strong>${object.name}</strong><br />\n"
" &nbsp;&nbsp;Fecha de inicio del contrato: ${object.date_start or ''}<br />\n"
"\n"
" % if object.user_id:\n"
" &nbsp;&nbsp;Contacto: <a href=\"mailto:${object.user_id.email or ''}?subject=Contrato%20${object.name}\">${object.user_id.name}</a>\n"
" % endif\n"
" </p>\n"
"\n"
" <br/>\n"
" <p>Si tiene cualquier pregunta, no dude en contactarnos.</p>\n"
" <p>Gracias por elegir ${object.company_id.name or 'nos'}!</p>\n"
" <br/>\n"
" <br/>\n"
" <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;\">\n"
" <h3 style=\"margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;\">\n"
" <strong style=\"text-transform:uppercase;\">${object.company_id.name}</strong></h3>\n"
" </div>\n"
" <div style=\"width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;\">\n"
" <span style=\"color: #222; margin-bottom: 5px; display: block; \">\n"
" ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe}\n"
" </span>\n"
" % if object.company_id.phone:\n"
" <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; \">\n"
" Teléfono :&nbsp; ${object.company_id.phone}\n"
" </div>\n"
" % endif\n"
" % if object.company_id.website:\n"
" <div>\n"
" Web :&nbsp;<a href=\"${object.company_id.website}\">${object.company_id.website}</a>\n"
" </div>\n"
" %endif\n"
" <p></p>\n"
" </div>\n"
"</div>\n"
" "
#. module: contract
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form
@ -28,6 +112,41 @@ msgstr "<strong>#END#</strong>: Fecha fin del periodo facturado"
msgid "<strong>#START#</strong>: Start date of the invoiced period"
msgstr "<strong>#START#</strong>: Fecha inicio del periodo facturado"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Description</strong>"
msgstr "<strong>Descripción</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Invoice Lines</strong>"
msgstr "<strong>Lineas de factura</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Partner:</strong>"
msgstr "<strong>Empresa:</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Price</strong>"
msgstr "<strong>Precio</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Quantity</strong>"
msgstr "<strong>Cantidad</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Total</strong>"
msgstr "<strong>Total</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "<strong>Unit Price</strong>"
msgstr "<strong>Precio unidad</strong>"
#. module: contract
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form
msgid "Account Analytic Lines"
@ -49,6 +168,12 @@ msgstr "Pinche para crear un contrato nuevo. "
msgid "Contract"
msgstr "Contrato"
#. module: contract
#: code:addons/contract/models/contract.py:318
#, python-format
msgid "Compose Email"
msgstr "Componer correo electrónico"
#. module: contract
#: model:ir.actions.act_window,name:contract.action_account_analytic_overdue_all
#: model:ir.ui.menu,name:contract.menu_action_account_analytic_overdue_all
@ -71,6 +196,11 @@ msgstr "Creado por"
msgid "Created on"
msgstr "Creado en"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "Date Start:"
msgstr "Fecha de inicio:"
#. module: contract
#: model:ir.model.fields,field_description:contract.field_account_analytic_account_recurring_next_date
msgid "Date of Next Invoice"
@ -241,6 +371,21 @@ msgstr "Repetir cada"
msgid "Repeat every (Days/Week/Month/Year)"
msgstr "Repetir cada (días/semana/mes/año)"
#. module: contract
#: model:ir.model.fields,field_description:contract.field_account_analytic_account_user_id
msgid "Responsible"
msgstr "Responsable"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "Responsible:"
msgstr "Responsable:"
#. module: contract
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form
msgid "Send by Email"
msgstr "Enviar por correo electrónico"
#. module: contract
#: model:ir.model.fields,help:contract.field_account_analytic_account_recurring_rule_type
msgid "Specify Interval for automatic invoice generation."
@ -266,6 +411,11 @@ msgstr "Precio unidad"
msgid "Unit of Measure"
msgstr "Unidad de medida"
#. module: contract
#: model:ir.ui.view,arch_db:contract.report_contract_document
msgid "VAT:"
msgstr "CIF/NIF:"
#. module: contract
#: selection:account.analytic.account,recurring_rule_type:0
msgid "Week(s)"

101
contract/i18n/es_ES.po

@ -2,20 +2,105 @@
# This file contains the translation of the following modules:
# * contract
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: contract (9.0)\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-01 02:46+0000\n"
"PO-Revision-Date: 2017-04-25 10:42+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Spanish (Spain) (http://www.transifex.com/oca/OCA-contract-9-0/language/es_ES/)\n"
"POT-Creation-Date: 2017-08-02 17:47+0000\n"
"PO-Revision-Date: 2017-08-02 17:47+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_ES\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: \n"
#. module: contract
#: model:mail.template,body_html:contract.email_contract_template
msgid "\n"
"<div style=\"font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
" <p>Hello ${object.partner_id.name or ''},</p>\n"
" <p>A new contract has been created: </p>\n"
"\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\n"
" &nbsp;&nbsp;<strong>REFERENCES</strong><br />\n"
" &nbsp;&nbsp;Contract: <strong>${object.name}</strong><br />\n"
" &nbsp;&nbsp;Contract date start: ${object.date_start or ''}<br />\n"
"\n"
" % if object.user_id:\n"
" &nbsp;&nbsp;Your contact: <a href=\"mailto:${object.user_id.email or ''}?subject=Contract%20${object.name}\">${object.user_id.name}</a>\n"
" % endif\n"
" </p>\n"
"\n"
" <br/>\n"
" <p>If you have any question, do not hesitate to contact us.</p>\n"
" <p>Thank you for choosing ${object.company_id.name or 'us'}!</p>\n"
" <br/>\n"
" <br/>\n"
" <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;\">\n"
" <h3 style=\"margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;\">\n"
" <strong style=\"text-transform:uppercase;\">${object.company_id.name}</strong></h3>\n"
" </div>\n"
" <div style=\"width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;\">\n"
" <span style=\"color: #222; margin-bottom: 5px; display: block; \">\n"
" ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe}\n"
" </span>\n"
" % if object.company_id.phone:\n"
" <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; \">\n"
" Phone:&nbsp; ${object.company_id.phone}\n"
" </div>\n"
" % endif\n"
" % if object.company_id.website:\n"
" <div>\n"
" Web :&nbsp;<a href=\"${object.company_id.website}\">${object.company_id.website}</a>\n"
" </div>\n"
" %endif\n"
" <p></p>\n"
" </div>\n"
"</div>\n"
" "
msgstr "\n"
"<div style=\"font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; \">\n"
" <p>Hola ${object.partner_id.name or ''},</p>\n"
" <p>Se ha creado un nuevo contrato: </p>\n"
"\n"
" <p style=\"border-left: 1px solid #8e0000; margin-left: 30px;\">\n"
" &nbsp;&nbsp;<strong>REFERENCIAS</strong><br />\n"
" &nbsp;&nbsp;Contrato: <strong>${object.name}</strong><br />\n"
" &nbsp;&nbsp;Fecha de inicio del contrato: ${object.date_start or ''}<br />\n"
"\n"
" % if object.user_id:\n"
" &nbsp;&nbsp;Contacto: <a href=\"mailto:${object.user_id.email or ''}?subject=Contrato%20${object.name}\">${object.user_id.name}</a>\n"
" % endif\n"
" </p>\n"
"\n"
" <br/>\n"
" <p>Si tiene cualquier pregunta, no dude en contactarnos.</p>\n"
" <p>Gracias por elegir ${object.company_id.name or 'nos'}!</p>\n"
" <br/>\n"
" <br/>\n"
" <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;\">\n"
" <h3 style=\"margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;\">\n"
" <strong style=\"text-transform:uppercase;\">${object.company_id.name}</strong></h3>\n"
" </div>\n"
" <div style=\"width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;\">\n"
" <span style=\"color: #222; margin-bottom: 5px; display: block; \">\n"
" ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe}\n"
" </span>\n"
" % if object.company_id.phone:\n"
" <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; \">\n"
" Teléfono :&nbsp; ${object.company_id.phone}\n"
" </div>\n"
" % endif\n"
" % if object.company_id.website:\n"
" <div>\n"
" Web :&nbsp;<a href=\"${object.company_id.website}\">${object.company_id.website}</a>\n"
" </div>\n"
" %endif\n"
" <p></p>\n"
" </div>\n"
"</div>\n"
" "
#. module: contract
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form

34
contract/models/contract.py

@ -144,6 +144,12 @@ class AccountAnalyticAccount(models.Model):
string='Journal',
default=_default_journal,
domain="[('type', '=', 'sale'),('company_id', '=', company_id)]")
user_id = fields.Many2one(
comodel_name='res.users',
string='Responsible',
index=True,
default=lambda self: self.env.user,
)
@api.onchange('partner_id')
def _onchange_partner_id(self):
@ -291,3 +297,31 @@ class AccountAnalyticAccount(models.Model):
('account_type', '=', 'normal'),
('recurring_invoices', '=', True)])
return contracts.recurring_create_invoice()
@api.multi
def action_contract_send(self):
self.ensure_one()
template = self.env.ref(
'contract.email_contract_template',
False,
)
compose_form = self.env.ref('mail.email_compose_message_wizard_form',
False)
ctx = dict(
default_model='account.analytic.account',
default_res_id=self.id,
default_use_template=bool(template),
default_template_id=template and template.id or False,
default_composition_mode='comment',
)
return {
'name': _('Compose Email'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(compose_form.id, 'form')],
'view_id': compose_form.id,
'target': 'new',
'context': ctx,
}

11
contract/report/contract_views.xml

@ -0,0 +1,11 @@
<?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"/>
</odoo>

74
contract/report/report_contract.xml

@ -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>Invoice Lines</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-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-field-options='{"widget": "monetary", "display_currency": "res_company.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-esc-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
</tr>
</table>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
</odoo>

4
contract/tests/test_contract.py

@ -134,3 +134,7 @@ class TestContract(SavepointCase):
journal.write({'type': 'general'})
with self.assertRaises(ValidationError):
contract_no_journal.recurring_create_invoice()
def test_send_mail_contract(self):
result = self.contract.action_contract_send()
self.assertEqual(result['name'], 'Compose Email')

5
contract/views/contract.xml

@ -19,6 +19,11 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field eval="40" name="priority"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']/.." position="before">
<header>
<button name="action_contract_send" type="object" string="Send by Email" groups="base.group_user"/>
</header>
</xpath>
<notebook position="before">
<separator string="Recurring Invoices" attrs="{'invisible': [('recurring_invoices','!=',True)]}"/>
<div>

Loading…
Cancel
Save