openerp local commit
authorAntony Lesuisse <al@openerp.com>
Tue, 14 Sep 2010 13:36:35 +0000 (13:36 +0000)
committerAntony Lesuisse <al@openerp.com>
Tue, 14 Sep 2010 13:36:35 +0000 (13:36 +0000)
bzr revid: al@openerp.com-20100914133635-9yuqmkxqdkmde2ql

addons/account/report/account_aged_partner_balance.rml
addons/account/report/invoice.rml
addons/account/wizard/account_report_aged_partner_balance.py
addons/base_action_rule/base_action_rule.py
addons/base_action_rule/base_action_rule_view.xml
addons/crm/report/crm_lead_report.py
addons/crm/wizard/crm_forward_to_partner.py
addons/document/document.py
addons/email_template/security/email_template_security.xml
addons/mrp/mrp_view.xml
addons/sale/report/sale_order.rml

index bd52f9b..5a74e46 100644 (file)
           <para style="P2">Partners</para>
         </td>
         <td>
-          <para style="P8">[[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]] [[ formatLang(data['form']['date1'],date=True) ]]</para>
+          <para style="P8">[[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not Due' ]] </para>
         </td>
         <td>
           <para style="P8">[[ data['form']['4']['name'] ]]</para>
index f051988..5934294 100644 (file)
           <para style="terp_default_8">
             <font color="white"> </font>
           </para>
-          <para style="terp_default_8">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
-          <para style="terp_default_8">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
           <para style="terp_default_8">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
         </td>
       </tr>
index 29867f0..0431baf 100644 (file)
@@ -75,9 +75,9 @@ class account_aged_trial_balance(osv.osv_memory):
             for i in range(5)[::-1]:
                 stop = start - RelativeDateTime(days=period_length)
                 res[str(i)] = {
-                    'name' : str((5-(i+1)) * period_length) + '-' + str((5-i) * period_length),
+                    'name' : (i!=0 and (str((5-(i+1)) * period_length) + '-' + str((5-i) * period_length)) or ('+'+str(4 * period_length))),
                     'stop': start.strftime('%Y-%m-%d'),
-                    'start' : stop.strftime('%Y-%m-%d'),
+                    'start' : (i!=0 and stop.strftime('%Y-%m-%d') or time.strftime('01-01-1900')),
                     }
                 start = stop - RelativeDateTime(days=1)
         else:
@@ -99,4 +99,4 @@ class account_aged_trial_balance(osv.osv_memory):
 
 account_aged_trial_balance()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
index ff6321e..b4cd4f8 100644 (file)
@@ -113,6 +113,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
         'filter_id':fields.many2one('ir.filters', 'Filter', required=False), 
         'act_email_from' : fields.char('Email From', size=64, required=False,
                 help="Use a python expression to specify the right field on which one than we will use for the 'From' field of the header"),
+        'act_email_to' : fields.char('Email To', size=64, required=False,
+                help="Use a python expression to specify the right field on which one than we will use for the 'To' field of the header"),
     }
 
     _defaults = {
@@ -356,13 +358,22 @@ the rule to mark CC(mail to any other person defined in actions)."),
             emails += (action.act_email_cc or '').split(',')
         if action.act_mail_to_email:
             emails += (action.act_mail_to_email or '').split(',')
+        import pdb
+        #pdb.set_trace()
+
+        locals_for_emails = {
+            'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context),
+            'obj' : obj,
+        }
+
+        if action.act_email_to:
+            emails.append(safe_eval(action.act_email_to, {}, locals_for_emails))
+
         emails = filter(None, emails)
+
         if len(emails) and action.act_mail_body:
             emails = list(set(emails))
-            email_from = safe_eval(action.act_email_from, {}, {
-                'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context),
-                'obj' : obj,
-            })
+            email_from = safe_eval(action.act_email_from, {}, locals_for_emails)
             self.email_send(cr, uid, obj, emails, action.act_mail_body, emailfrom=email_from)
         return True
 
index 526fe55..76620f2 100644 (file)
@@ -65,6 +65,7 @@
                                 </group>
                                    <separator colspan="4" string="Email Information"/>
                                 <field name="act_email_from" />
+                                <field name="act_email_to" />
                                    <field name="act_mail_to_user"/>
                                    <field colspan="4" name="act_mail_to_email"/>
                                    <field name="act_mail_to_watchers"/>
index 4f6f39e..09a8051 100644 (file)
@@ -127,9 +127,9 @@ class crm_lead_report(osv.osv):
             CREATE OR REPLACE VIEW crm_lead_report AS (
                 SELECT
                     id,
-                    to_char(c.create_date, 'YYYY') as name,
-                    to_char(c.create_date, 'MM') as month,
-                    to_char(c.create_date, 'YYYY-MM-DD') as day,
+                    to_char(c.date_deadline, 'YYYY') as name,
+                    to_char(c.date_deadline, 'MM') as month,
+                    to_char(c.date_deadline, 'YYYY-MM-DD') as day,
                     to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
                     to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
                     to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
@@ -145,7 +145,7 @@ class crm_lead_report(osv.osv):
                     c.partner_id,
                     c.country_id,
                     c.planned_revenue,
-                    c.planned_revenue*(c.probability/100) as probable_revenue, 
+                    c.planned_revenue*(c.probability/100) as probable_revenue,
                     1 as nbr,
                     0 as avg_answers,
                     0.0 as perc_done,
index aaa26c4..8f2d778 100644 (file)
@@ -27,6 +27,18 @@ from osv import osv, fields
 import tools
 from tools.translate import _
 
+FWD_TEMPLATE="""Hello,
+
+OpenERP Leads are now forwarded to our trusted partners, through the CRM, we hope that they provide you with interesting projects, we know that they have shown keen interest in our software.
+Below is an interesting lead for you.
+
+Please let us know about the advancements of this lead or if you are not able to answer to its requests by replying to this email. This way, we can keep track of closed leads or forward them to other partners.
+Don't forget to propose our maintenance at the beginning of your implementation projects, together with your services quotation. The maintenance provides unlimited bugfixing that will avoid you waste time on bugs detected during the implementation. It also provides free migration services for the current stable version at the time of signature; otherwise if we released a new version during your implementation, the customer would not always be able to easily migrate to newer versions.
+
+Kind regards, OpenERP Team
+
+"""
+
 class crm_lead_forward_to_partner(osv.osv_memory):
     """Forwards lead history"""
     _name = 'crm.lead.forward.to.partner'
@@ -110,7 +122,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
         res_id = context.get('active_id')
         msg_val = self._get_case_history(cr, uid, history_type, res_id, context=context)
         if msg_val:
-            res = {'value': {'body' : '\n\n' + msg_val}}
+            res = {'value': {'body' : FWD_TEMPLATE + '\n\n' + msg_val}}
         return res
 
     def _get_case_history(self, cr, uid, history_type, res_id, context=None):
@@ -268,7 +280,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
         body = self._get_case_history(cr, uid, defaults.get('history', 'latest'), lead.id, context=context)
         defaults.update({
             'subject' : '%s: %s' % (_('Fwd'), lead.name),
-            'body' : body,
+            'body' : FWD_TEMPLATE + '\n\n' + body,
         })
         return defaults
 
index 46cf6d1..f60531f 100644 (file)
@@ -144,6 +144,7 @@ class document_file(osv.osv):
         return super(document_file, self).copy(cr, uid, id, default, context)
 
     def write(self, cr, uid, ids, vals, context=None):
+        result = False
         if not isinstance(ids, list):
             ids = [ids]
         res = self.search(cr, uid, [('id', 'in', ids)])
index 7e6c1f4..9fcf47d 100755 (executable)
@@ -1,10 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data noupdate="0">
-
         <record id="base.res_groups_email_template_admin" model="res.groups">
             <field name="name">Marketing / User</field>
         </record>
-
     </data>
 </openerp>
index 4504de8..402d352 100644 (file)
@@ -6,7 +6,7 @@
             groups="group_mrp_user,group_mrp_manager,base.group_system" sequence="8"/>
             <menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
         <menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
-        <menuitem id="menu_mrp_manufacturing" name="Manufacturing" parent="base.menu_mrp_root" sequence="1"/>
+        <menuitem id="menu_mrp_manufacturing" name="Manufacturing" sequence="1"/> <!-- FIXME parent="base.menu_mrp_root" sequence="1"/>-->
 
         <menuitem name="Master Data"
                   id="menu_mrp_bom"
index 5f535a0..83cf110 100644 (file)
       <tr>
         <td>
           <para style="terp_default_Bold_9">Shipping address :</para>
-          <para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
-          <para style="terp_default_9">[[ o.partner_shipping_id.title or '' ]] [[ o.partner_shipping_id.name ]]</para>
+          <para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="terp_default_9">[[ o.partner_shipping_id.title.name or '' ]] [[ o.partner_shipping_id.name ]]</para>
           <para style="terp_default_9">[[ o.partner_shipping_id.street ]]</para>
           <para style="terp_default_9">[[ o.partner_shipping_id.street2 or '' ]]</para>
           <para style="terp_default_9">[[ o.partner_shipping_id.zip or '' ]] [[ o.partner_shipping_id.city or '' ]]</para>
             <font color="white"> </font>
           </para>
           <para style="terp_default_Bold_9">Invoice address :</para>
-          <para style="terp_default_9">[[ o.partner_invoice_id.title or '' ]] [[ o.partner_invoice_id.name or '' ]]</para>
+          <para style="terp_default_9">[[ o.partner_invoice_id.title.name or '' ]] [[ o.partner_invoice_id.name or '' ]]</para>
           <para style="terp_default_9">[[ o.partner_invoice_id.street ]] [[ o.partner_invoice_id.street2 and (', %s' % o.partner_invoice_id.street2 or '') ]]</para>
           <para style="terp_default_9">[[ o.partner_invoice_id.zip or '' ]] [[ o.partner_invoice_id.city or '' ]]</para>
           <para style="terp_default_9">[[ o.partner_invoice_id.state_id and o.partner_invoice_id.state_id.name or '' ]][[ o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '' ]]</para>
           </para>
         </td>
         <td>
-          <para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
-          <para style="terp_default_9">[[ o.partner_order_id.title or '' ]] [[ o.partner_order_id.name ]]</para>
+          <para style="terp_default_9">[[ o.partner_id.title.name or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="terp_default_9">[[ o.partner_order_id.title.name or '' ]] [[ o.partner_order_id.name ]]</para>
           <para style="terp_default_9">[[ o.partner_order_id.street ]]</para>
           <para style="terp_default_9">[[ o.partner_order_id.street2 or '' ]]</para>
           <para style="terp_default_9">[[ o.partner_order_id.zip or '' ]] [[ o.partner_order_id.city or '' ]]</para>