Divyesh Makwana(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-wkf-improvements-mdi into
lp:~openerp-dev/openobject-addons/trunk-wkf-improvements.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-wkf-improvements-mdi/+merge/100556
Hello Sir,
I have done the following changes :
1. Cleanup the use of dicts.
2. Remove the automatic email send by the EDI.
3. Use of proper template based on an XML ID.
4. Remove the subtype equal to html.
Thanks,
Divyesh
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-wkf-improvements-mdi/+merge/100556
Your team OpenERP R&D Team is requested to review the proposed merge of
lp:~openerp-dev/openobject-addons/trunk-wkf-improvements-mdi into
lp:~openerp-dev/openobject-addons/trunk-wkf-improvements.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2012-04-02 05:34:27 +0000
+++ account/account_invoice.py 2012-04-03 06:09:21 +0000
@@ -388,11 +388,12 @@
def action_invoice_sent(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
- template_id = self.pool.get('email.template').search(cr, uid, [('model_id', '=', 'account.invoice')], context=context)[0]
+ template = mod_obj.get_object_reference(cr, uid, 'account', 'email_template_edi_invoice')
+ template_id = template and template[1] or False
res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
res_id = res and res[1] or False
- ctx = context.copy()
- ctx.update({'active_model': 'account.invoice', 'active_id': ids[0], 'mail.compose.template_id': template_id})
+ ctx = dict(context, active_model='account.invoice', active_id=ids[0])
+ ctx.update({'mail.compose.template_id': template_id})
return {
'view_type': 'form',
'view_mode': 'form',
=== modified file 'account/edi/invoice.py'
--- account/edi/invoice.py 2012-04-02 05:34:27 +0000
+++ account/edi/invoice.py 2012-04-03 06:09:21 +0000
@@ -79,9 +79,7 @@
invoice_objs = self.browse(cr, uid, ids, context=context)
edi_token = self.pool.get('edi.document').export_edi(cr, uid, invoice_objs, context = context)[0]
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
- edi_context = dict(context, edi_web_url_view=edi.EDI_VIEW_WEB_URL % (web_root_url, cr.dbname, edi_token))
- ctx = context.copy()
- ctx.update(edi_context)
+ ctx = dict(context, edi_web_url_view=edi.EDI_VIEW_WEB_URL % (web_root_url, cr.dbname, edi_token))
return super(account_invoice, self).action_invoice_sent(cr, uid, ids, context=ctx)
def edi_export(self, cr, uid, records, edi_struct=None, context=None):
=== modified file 'account/edi/invoice_action_data.xml'
--- account/edi/invoice_action_data.xml 2012-03-29 13:00:46 +0000
+++ account/edi/invoice_action_data.xml 2012-04-03 06:09:21 +0000
@@ -2,6 +2,7 @@
<openerp>
<data>
<!-- EDI Export + Send email Action -->
+ <!--
<record id="ir_actions_server_edi_invoice" model="ir.actions.server">
<field name="code">if (object.type in ('out_invoice', 'out_refund')) and not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='account.email_template_edi_invoice', context=context)</field>
<field eval="6" name="sequence"/>
@@ -11,6 +12,7 @@
<field name="condition">True</field>
<field name="name">Auto-email confirmed invoices</field>
</record>
+ -->
<!-- EDI related Email Templates menu -->
<record model="ir.actions.act_window" id="action_email_templates">
@@ -31,9 +33,11 @@
so users can freely customize/delete them -->
<data noupdate="1">
<!-- bind the mailing server action to invoice open activity -->
+ <!--
<record id="account.act_open" model="workflow.activity">
<field name="action_id" ref="ir_actions_server_edi_invoice"/>
</record>
+ -->
<!--Email template -->
<record id="email_template_edi_invoice" model="email.template">
=== modified file 'email_template/wizard/mail_compose_message.py'
--- email_template/wizard/mail_compose_message.py 2012-03-27 09:24:17 +0000
+++ email_template/wizard/mail_compose_message.py 2012-04-03 06:09:21 +0000
@@ -102,14 +102,12 @@
'res_id' : ids[0] if ids else False
}
att_ids.append(attachment_obj.create(cr, uid, data_attach))
- values['subtype'] = 'html'
values['attachment_ids'] = att_ids
else:
# restore defaults
values = self.default_get(cr, uid, self.fields_get_keys(cr, uid), context)
values.update(use_template=use_template, template_id=template_id)
- values['subtype'] = 'html'
return {'value': values}
=== modified file 'purchase/edi/purchase_order.py'
--- purchase/edi/purchase_order.py 2012-04-02 05:34:27 +0000
+++ purchase/edi/purchase_order.py 2012-04-03 06:09:21 +0000
@@ -69,9 +69,7 @@
purchase_objs = self.browse(cr, uid, ids, context=context)
edi_token = self.pool.get('edi.document').export_edi(cr, uid, purchase_objs, context = context)[0]
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
- edi_context = dict(context, edi_web_url_view=edi.EDI_VIEW_WEB_URL % (web_root_url, cr.dbname, edi_token))
- ctx = context.copy()
- ctx.update(edi_context)
+ ctx = dict(context, edi_web_url_view=edi.EDI_VIEW_WEB_URL % (web_root_url, cr.dbname, edi_token))
return super(purchase_order, self).wkf_send_rfq(cr, uid, ids, context=ctx)
def edi_export(self, cr, uid, records, edi_struct=None, context=None):
=== modified file 'purchase/edi/purchase_order_action_data.xml'
--- purchase/edi/purchase_order_action_data.xml 2012-03-29 13:00:46 +0000
+++ purchase/edi/purchase_order_action_data.xml 2012-04-03 06:09:21 +0000
@@ -2,6 +2,7 @@
<openerp>
<data>
<!--Export edi document -->
+ <!--
<record id="ir_actions_server_edi_purchase" model="ir.actions.server">
<field name="code">if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='purchase.email_template_edi_purchase', context=context)</field>
<field name="state">code</field>
@@ -10,6 +11,7 @@
<field name="condition">True</field>
<field name="name">Auto-email confirmed purchase orders</field>
</record>
+ -->
<!-- EDI related Email Templates menu -->
<record model="ir.actions.act_window" id="action_email_templates">
@@ -27,9 +29,11 @@
so users can freely customize/delete them -->
<data noupdate="1">
<!-- bind the mailing server action to purchase.order confirmed activity -->
+ <!--
<record id="purchase.act_confirmed" model="workflow.activity">
<field name="action_id" ref="ir_actions_server_edi_purchase"/>
</record>
+ -->
<!--Email template -->
<record id="email_template_edi_purchase" model="email.template">
@@ -151,4 +155,4 @@
]]></field>
</record>
</data>
-</openerp>
\ No newline at end of file
+</openerp>
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py 2012-04-02 05:34:27 +0000
+++ purchase/purchase.py 2012-04-03 06:09:21 +0000
@@ -327,13 +327,12 @@
def wkf_send_rfq(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
- template_id = self.pool.get('email.template').search(cr, uid, [('model_id', '=', 'purchase.order')], context=context)[0]
-
+ template = mod_obj.get_object_reference(cr, uid, 'purchase', 'email_template_edi_purchase')
+ template_id = template and template[1] or False
res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
res_id = res and res[1] or False
-
- ctx = context.copy()
- ctx.update({'active_model': 'purchase.order', 'active_id': ids[0], 'mail.compose.template_id': template_id})
+ ctx = dict(context, active_model='purchase.order', active_id=ids[0])
+ ctx.update({'mail.compose.template_id': template_id})
return {
'view_type': 'form',
'view_mode': 'form',
=== modified file 'sale/edi/sale_order.py'
--- sale/edi/sale_order.py 2012-04-02 05:34:27 +0000
+++ sale/edi/sale_order.py 2012-04-03 06:09:21 +0000
@@ -71,9 +71,7 @@
sale_objs = self.browse(cr, uid, ids, context=context)
edi_token = self.pool.get('edi.document').export_edi(cr, uid, sale_objs, context = context)[0]
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
- edi_context = dict(context, edi_web_url_view=edi.EDI_VIEW_WEB_URL % (web_root_url, cr.dbname, edi_token))
- ctx = context.copy()
- ctx.update(edi_context)
+ ctx = dict(context, edi_web_url_view=edi.EDI_VIEW_WEB_URL % (web_root_url, cr.dbname, edi_token))
return super(sale_order, self).action_quotation_sent(cr, uid, ids, context=ctx)
def edi_export(self, cr, uid, records, edi_struct=None, context=None):
@@ -226,4 +224,4 @@
edi_doc_list.append(edi_doc)
return edi_doc_list
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'sale/edi/sale_order_action_data.xml'
--- sale/edi/sale_order_action_data.xml 2012-04-02 05:34:27 +0000
+++ sale/edi/sale_order_action_data.xml 2012-04-03 06:09:21 +0000
@@ -2,6 +2,7 @@
<openerp>
<data>
<!-- EDI Export + Send email Action -->
+ <!--
<record id="ir_actions_server_edi_sale" model="ir.actions.server">
<field name="code">if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='sale.email_template_edi_sale', context=context)</field>
<field name="state">code</field>
@@ -10,6 +11,7 @@
<field name="condition">True</field>
<field name="name">Auto-email confirmed sale orders</field>
</record>
+ -->
<!-- EDI related Email Templates menu -->
<record model="ir.actions.act_window" id="action_email_templates">
@@ -29,9 +31,11 @@
so users can freely customize/delete them -->
<data noupdate="1">
<!-- bind the mailing server action to sale.order confirmed activity -->
+ <!--
<record id="sale.act_wait_ship" model="workflow.activity">
<field name="action_id" ref="ir_actions_server_edi_sale"/>
</record>
+ -->
<!--Email template -->
=== modified file 'sale/sale.py'
--- sale/sale.py 2012-04-02 05:34:27 +0000
+++ sale/sale.py 2012-04-03 06:09:21 +0000
@@ -730,11 +730,12 @@
def action_quotation_sent(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
- template_id = self.pool.get('email.template').search(cr, uid, [('model_id', '=', 'sale.order')], context=context)[0]
+ template = mod_obj.get_object_reference(cr, uid, 'sale', 'email_template_edi_sale')
+ template_id = template and template[1] or False
res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
res_id = res and res[1] or False
- ctx = context.copy()
- ctx.update({'active_model': 'sale.order', 'active_id': ids[0], 'mail.compose.template_id': template_id})
+ ctx = dict(context, active_model='sale.order', active_id=ids[0])
+ ctx.update({'mail.compose.template_id': template_id})
return {
'view_type': 'form',
'view_mode': 'form',
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp