Browse Source

[MRG] [imp] add mail thread with report attached to hours block

pull/2/head
unknown 11 years ago
committed by Yannick Vaucher
parent
commit
07496295bb
  1. 1
      analytic_hours_block/__openerp__.py
  2. 41
      analytic_hours_block/hours_block.py
  3. 24
      analytic_hours_block/hours_block_data.xml
  4. 7
      analytic_hours_block/hours_block_view.xml
  5. 460
      analytic_hours_block/i18n/analytic_hours_block.pot

1
analytic_hours_block/__openerp__.py

@ -44,6 +44,7 @@ you can track and follow how much has been used.
],
"data": [
"hours_block_view.xml",
"hours_block_data.xml",
"hours_block_menu.xml",
"report.xml",
"security/hours_block_security.xml",

41
analytic_hours_block/hours_block.py

@ -24,6 +24,7 @@ from openerp.osv import orm, fields
class AccountHoursBlock(orm.Model):
_name = "account.hours.block"
_inherit = ['mail.thread']
def _get_last_action(self, cr, uid, ids, name, arg, context=None):
""" Return the last analytic line date for an invoice"""
@ -163,6 +164,46 @@ class AccountHoursBlock(orm.Model):
block_ids.update([inv.id for inv in invoice.account_hours_block_ids])
return list(block_ids)
def action_send_block(self, cr, uid, ids, context=None):
"""Open a form to send by email. Return an action dict."""
assert len(ids) == 1, '''\
This option should only be used for a single ID at a time.'''
ir_model_data = self.pool.get('ir.model.data')
try:
template_id = ir_model_data.get_object_reference(
cr, uid, 'analytic_hours_block', 'email_template_hours_block'
)[1]
except ValueError:
template_id = False
try:
compose_form_id = ir_model_data.get_object_reference(
cr, uid, 'mail', 'email_compose_message_wizard_form'
)[1]
except ValueError:
compose_form_id = False
ctx = {
'default_model': self._name,
'default_res_id': ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
}
return {
'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,
}
_recompute_triggers = {
'account.hours.block': (lambda self, cr, uid, ids, c=None:
ids, ['invoice_id', 'type'], 10),

24
analytic_hours_block/hours_block_data.xml

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<openerp>
<!-- Mail template are declared in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<record id="email_template_hours_block" model="email.template">
<field name="name">Hours Block - Send by Email</field>
<field name="email_from">${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe}</field>
<field name="subject">${object.company_id.name} Hours Block (Ref ${object.number or 'n/a'})</field>
<field name="email_recipients">${object.partner_id.id}</field>
<field name="model_id" ref="analytic_hours_block.model_account_hours_block"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="block_hours_report"/>
<field name="report_name">Hours_Block_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html"><![CDATA[
<p>Hello ${object.partner_id.name},</p>
<p>Please find attached your Hours Block Report.</p>
<p>Best regards.</p>
]]></field>
</record>
</data>
</openerp>

7
analytic_hours_block/hours_block_view.xml

@ -41,6 +41,9 @@
<field name="model">account.hours.block</field>
<field name="arch" type="xml">
<form string="Hours Blocks" version="7.0">
<header>
<button name="action_send_block" type="object" string="Send by Email" class="oe_highlight"/>
</header>
<sheet>
<h1>
<field name="invoice_id" placeholder="Choose an invoice..."/>
@ -79,6 +82,10 @@
<field name="state"/>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>

460
analytic_hours_block/i18n/analytic_hours_block.pot

@ -0,0 +1,460 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * analytic_hours_block
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-08 12:49+0000\n"
"PO-Revision-Date: 2014-01-08 12:49+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"
"Plural-Forms: \n"
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Maintenance And Support Summary"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Invoice Date:"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Group By..."
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Bought"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,close_date:0
msgid "Closed Date"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,message_unread:0
msgid "Unread Messages"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,company_id:0
msgid "Company"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,date_invoice:0
msgid "Invoice Date"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,residual:0
msgid "Residual"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,amount_hours_block:0
msgid "Amount bought by the customer. This amount is expressed in the base Unit of Measure (factor=1.0)"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Based on:"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,message_ids:0
msgid "Messages"
msgstr ""
#. module: analytic_hours_block
#: selection:account.hours.block,type:0
msgid "Amount"
msgstr ""
#. module: analytic_hours_block
#: selection:account.hours.block,state:0
msgid "Cancelled"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,message_unread:0
msgid "If checked new messages require your attention."
msgstr ""
#. module: analytic_hours_block
#: model:email.template,body_html:analytic_hours_block.email_template_hours_block
msgid "\n"
" Here is your Hours Block Report\n"
" "
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Hours Quantity / Amount"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Remaining hours:"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Quantity of hours bought:"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,message_summary:0
msgid "Holds the Chatter summary (number of messages, ...). This summary is directly in html format in order to be inserted in kanban views."
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Quantity of hours bought"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
#: field:account.hours.block,partner_id:0
msgid "Partner"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Quantity of hours difference"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,period_id:0
msgid "Period"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,state:0
msgid "State"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,message_follower_ids:0
msgid "Followers"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Send by Email"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "All Running Hours Block"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,last_action_date:0
msgid "Last action date"
msgstr ""
#. module: analytic_hours_block
#: selection:account.hours.block,type:0
msgid "Hours"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Description:"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,type:0
msgid "The block is based on the quantity of hours or on the amount."
msgstr ""
#. module: analytic_hours_block
#: model:email.template,report_name:analytic_hours_block.email_template_hours_block
msgid "Hours_Block_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Remaining amount:"
msgstr ""
#. module: analytic_hours_block
#: model:ir.model,name:analytic_hours_block.model_account_hours_block
msgid "account.hours.block"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,amount_hours_block:0
msgid "Quantity / Amount bought"
msgstr ""
#. module: analytic_hours_block
#: model:ir.actions.report.xml,name:analytic_hours_block.block_hours_report
msgid "Block Hours State"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Choose an invoice..."
msgstr ""
#. module: analytic_hours_block
#: selection:account.hours.block,state:0
msgid "Open"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "My invoices"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Draft Hours Blocks"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,currency_id:0
msgid "Currency"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
#: field:account.hours.block,user_id:0
msgid "Salesman"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Quantity of hours used"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
#: selection:account.hours.block,state:0
msgid "Draft"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
#: model:ir.actions.act_window,name:analytic_hours_block.action_all_block_hour
msgid "Hours Blocks"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,type:0
msgid "Type of Block"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Used"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Total Amount"
msgstr ""
#. module: analytic_hours_block
#: selection:account.hours.block,state:0
msgid "Paid"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Page"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,message_is_follower:0
msgid "Is a Follower"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Date"
msgstr ""
#. module: analytic_hours_block
#: field:account.invoice,account_hours_block_ids:0
#: model:ir.actions.act_window,name:analytic_hours_block.act_hours_block_from_invoice
#: model:ir.ui.menu,name:analytic_hours_block.action_all_block_hour_account
msgid "Hours Block"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,last_action_date:0
msgid "Date of the last analytic line linked to the invoice related to this block hours."
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Report Date:"
msgstr ""
#. module: analytic_hours_block
#: model:email.template,subject:analytic_hours_block.email_template_hours_block
msgid "${object.company_id.name} Hours Block (Ref ${object.number or 'n/a'})"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Invoice's related information"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Search Invoice"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Quantity"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,amount_hours_block_delta:0
msgid "Difference between bought and used. This amount is expressed in the base Unit of Measure (factor=1.0)"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "0.6cm 27.9cm 20.3cm 27.9cm"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Residual Amount"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Overdue Hours Block"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Amount used:"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,number:0
msgid "Number"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
#: field:account.hours.block,invoice_id:0
#: model:ir.actions.act_window,name:analytic_hours_block.act_invoice_from_hours_block
#: model:ir.model,name:analytic_hours_block.model_account_invoice
msgid "Invoice"
msgstr ""
#. module: analytic_hours_block
#: selection:account.hours.block,state:0
msgid "Pro-forma"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Responsible"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
#: field:account.hours.block,name:0
msgid "Description"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Amount bought:"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,amount_hours_block_done:0
msgid "Amount done by the staff. This amount is expressed in the base Unit of Measure (factor=1.0)"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Quantity of hours used:"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Invoicing"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,amount_hours_block_done:0
msgid "Quantity / Amount used"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,journal_id:0
msgid "Journal"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Running"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
#: field:account.hours.block,amount_hours_block_delta:0
msgid "Difference"
msgstr ""
#. module: analytic_hours_block
#: model:ir.actions.act_window,name:analytic_hours_block.act_block_hour_from_partner
msgid "All blocks hours"
msgstr ""
#. module: analytic_hours_block
#: report:account.hours.block:0
msgid "Deduced"
msgstr ""
#. module: analytic_hours_block
#: model:ir.actions.act_window,name:analytic_hours_block.act_analytic_lines_from_hours_block
msgid "Analytic Lines"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Invoice State"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,message_summary:0
msgid "Summary"
msgstr ""
#. module: analytic_hours_block
#: help:account.hours.block,message_ids:0
msgid "Messages and communication history"
msgstr ""
#. module: analytic_hours_block
#: view:account.hours.block:0
msgid "Overdue"
msgstr ""
#. module: analytic_hours_block
#: field:account.hours.block,amount_total:0
msgid "Total"
msgstr ""
Loading…
Cancel
Save