diff --git a/addons/account/edi_invoice_action_data.xml b/addons/account/edi_invoice_action_data.xml index fb89e585195..22d3eb7dbdf 100644 --- a/addons/account/edi_invoice_action_data.xml +++ b/addons/account/edi_invoice_action_data.xml @@ -4,10 +4,10 @@ context.update({'edi_web_invoice_url_view': '%s/edi/view_edi?db=%s&token=%s' %(self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url'),cr.dbname, self.pool.get('ir.edi.document').export_edi(cr, uid, [object], context = context)[0])}) -if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail(cr, +if not object.partner_id.opt_out: self.pool.get('email.template').send_mail(cr, uid, self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'email_template_edi_invoice')[1], - [object.id], + object.id, context=context) code @@ -26,10 +26,14 @@ if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail( - ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' }) - ${object.address_invoice_id.email or ''} - - + Mail Template of Invoice For EDI Document + ${object.user_id.user_email or ''} + ${object.user_id.user_email or ''} + + ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' }) + ${object.address_invoice_id.email or ''} + + <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> <p> Hello ${object.address_invoice_id.name and ' ' or ''},</p> @@ -44,7 +48,7 @@ ${object.company_id.paypal_account and "<p>It is possible to pay with Payp <p> If you have any question, do not hesitate to reply directly to this e-mail.</p> <p> Thank you for choosing OpenERP!<br /> </p> <div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-image: url(http://www.openerp.com/sites/default/files/red_gradient_bg.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; "> <h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); "> <strong>${object.company_id.name}</strong></h3> </div> <div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); "> <div> Contact:<a href="mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a></div> <div> </div> </div> </div> <p> </p> - + Hello ${object.address_invoice_id.name and ' ' or ''}, You can click on the following link to preview, print and pay invoice: @@ -67,10 +71,7 @@ Thank you for choosing our service! ${object.company_id.name} Contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''} - mako - Mail Template of Invoice For EDI Document - account.invoice - ${object.user_id.user_email or ''} + diff --git a/addons/account/test/test_edi_invoice.yml b/addons/account/test/test_edi_invoice.yml index e01e6aaa712..d29fe96fc89 100644 --- a/addons/account/test/test_edi_invoice.yml +++ b/addons/account/test/test_edi_invoice.yml @@ -123,13 +123,12 @@ - !python {model: account.invoice}: | - invoice_old = self.browse(cr, uid, ref("customer_invoice_test")) - new_partner_id = self.pool.get('res.partner').name_search(cr, uid, invoice_old.company_id.name) + new_partner_id = self.pool.get('res.partner').name_search(cr, uid, "Thomson pvt. ltd.") assert new_partner_id, 'Partner is not created of Supplier' ids = self.search(cr, uid, [('partner_id','=',new_partner_id[0][0]),('reference','=',"SAJ/2011/002")]) assert ids, 'Invoice does not have created of party' invoice_new = self.browse(cr, uid, ids[0]) - assert invoice_new.reference == invoice_old.internal_number, "internal number is not stored in reference" + assert invoice_new.reference == "SAJ/2011/002", "internal number is not stored in reference" assert invoice_new.reference_type == 'none', "reference type is not set to 'None'" assert invoice_new.internal_number == False, "internal number is not reset" assert invoice_new.journal_id.id, "journal id is not selected" diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 3917b3f2ddb..1a8ba49594d 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -382,5 +382,6 @@ class email_template(osv.osv): if context.has_key('default_type'): del context['default_type'] attachment_ids.append(ir_attachment.create(cr, uid, attachment_data, context)) + return message_id # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/purchase/edi_purchase_order_data.xml b/addons/purchase/edi_purchase_order_data.xml index d8a87fec0c9..e99fe687b5d 100644 --- a/addons/purchase/edi_purchase_order_data.xml +++ b/addons/purchase/edi_purchase_order_data.xml @@ -3,11 +3,11 @@ - context.update({'edi_web_url_view': '%s/edi/view_edi?db=%s&token=%s' %(self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url'),cr.dbname, self.pool.get('ir.edi.document').export_edi(cr, uid, [object], context = context)[0])}) -if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail(cr, + context.update({'edi_web_purchase_url_view': '%s/edi/view_edi?db=%s&token=%s' %(self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url'),cr.dbname, self.pool.get('ir.edi.document').export_edi(cr, uid, [object], context = context)[0])}) +if not object.partner_id.opt_out: self.pool.get('email.template').send_mail(cr, uid, self.pool.get('ir.model.data').get_object_reference(cr, uid, 'purchase', 'email_template_edi_purchase')[1], - [object.id], + object.id, context=context) code @@ -19,23 +19,25 @@ if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail( - + - ${object.company_id.name} - Purchase Order ${object.name} - ${object.partner_address_id.email} - - True - + Mail Template of Purchase Order For EDI Document + ${object.validator.user_email or ''} + ${object.validator.user_email or ''} + ${object.company_id.name} - Purchase Order ${object.name} + ${object.partner_address_id.email} + + <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> <p> Hello ${object.partner_address_id.name and ' ' or ''},</p> <p> You can click on the following link to preview, print and pay invoice: <br/> - <a href="${object._context.get('edi_web_url_view')}">${object._context.get('edi_web_url_view')} </a> + <a href="${object._context.get('edi_web_purchase_url_view')}">${object._context.get('edi_web_purchase_url_view')} </a> </p> @@ -45,12 +47,12 @@ ${object.company_id.paypal_account and "<p>It is possible to pay with Payp <p> If you have any question, do not hesitate to reply directly to this e-mail.</p> <p> Thank you for choosing OpenERP!<br /> </p> <div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-image: url(http://www.openerp.com/sites/default/files/red_gradient_bg.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; "> <h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); "> <strong>${object.company_id.name}</strong></h3> </div> <div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); "> <div> Contact:<a href="mailto:${object.validator.user_email or ''}?subject=Order%20${object.name}">${object.validator.name}</a></div> <div> </div> </div> </div> <p> </p> - + Hello ${object.partner_address_id.name and ' ' or ''}, You can click on the following link to preview, print and pay invoice: - ${object._context.get('edi_web_url_view') or 'n/a'} + ${object._context.get('edi_web_purchase_url_view') or 'n/a'} Order Number: *${object.name}* Amount: *${object.amount_total}* @@ -67,10 +69,7 @@ Thank you for choosing our service! ${object.company_id.name} Contact: ${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''} - mako - Mail Template of Purchase Order For EDI Document - purchase.order - ${object.validator.user_email or ''} + diff --git a/addons/sale/edi_sale_order_data.xml b/addons/sale/edi_sale_order_data.xml index a9e25bd2562..0e9fa04b12e 100644 --- a/addons/sale/edi_sale_order_data.xml +++ b/addons/sale/edi_sale_order_data.xml @@ -3,11 +3,11 @@ - context.update({'edi_web_url_view': '%s/edi/view_edi?db=%s&token=%s' %(self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url'),cr.dbname, self.pool.get('ir.edi.document').export_edi(cr, uid, [object], context = context)[0])}) -if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail(cr, + context.update({'edi_web_sale_url_view': '%s/edi/view_edi?db=%s&token=%s' %(self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url'),cr.dbname, self.pool.get('ir.edi.document').export_edi(cr, uid, [object], context = context)[0])}) +if not object.partner_id.opt_out: self.pool.get('email.template').send_email(cr, uid, self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'email_template_edi_sale')[1], - [object.id], + object.id, context=context) code @@ -26,16 +26,18 @@ if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail( - ${object.company_id.name} - Sale Order ${object.name} - ${object.partner_invoice_id.email} - - True - + Mail Template of Sale Order For EDI Document + ${object.user_id.user_email or ''} + ${object.user_id.user_email or ''} + ${object.company_id.name} - Sale Order ${object.name} + ${object.partner_invoice_id.email} + + <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> <p> Hello ${object.partner_invoice_id.name and ' ' or ''},</p> <p> You can click on the following link to preview, print and pay invoice: <br/> - <a href="${object._context.get('edi_web_url_view')}">${object._context.get('edi_web_url_view')} </a> + <a href="${object._context.get('edi_web_sale_url_view')}">${object._context.get('edi_web_sale_url_view')} </a> </p> @@ -45,12 +47,12 @@ ${object.company_id.paypal_account and "<p>It is possible to pay with Payp <p> If you have any question, do not hesitate to reply directly to this e-mail.</p> <p> Thank you for choosing OpenERP!<br /> </p> <div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-image: url(http://www.openerp.com/sites/default/files/red_gradient_bg.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; "> <h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); "> <strong>${object.company_id.name}</strong></h3> </div> <div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); "> <div> Contact:<a href="mailto:${object.user_id.user_email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a></div> <div> </div> </div> </div> <p> </p> - + Hello ${object.partner_invoice_id.name and ' ' or ''}, You can click on the following link to preview, print and pay invoice: - ${object._context.get('edi_web_url_view') or 'n/a'} + ${object._context.get('edi_web_sale_url_view') or 'n/a'} Order Number: *${object.name}* Amount: *${object.amount_total}* @@ -67,10 +69,6 @@ Thank you for choosing our service! ${object.company_id.name} Contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''} - mako - Mail Template of Sale Order For EDI Document - sale.order - ${object.user_id.user_email or ''}