From 01d99c159bb774c8dccddd38c651eec8044825f5 Mon Sep 17 00:00:00 2001 From: Prashant Panchal Date: Mon, 24 Aug 2015 11:52:37 +0530 Subject: [PATCH 1/3] [REF] product_email_template: rename module files --- addons/product_email_template/__openerp__.py | 4 ++-- addons/product_email_template/data/product_demo.xml | 8 +++----- addons/product_email_template/models/__init__.py | 2 +- .../models/{invoice.py => account_invoice.py} | 0 .../{email_template_view.xml => mail_template_views.xml} | 0 .../views/{product_view.xml => product_views.xml} | 0 6 files changed, 6 insertions(+), 8 deletions(-) rename addons/product_email_template/models/{invoice.py => account_invoice.py} (100%) rename addons/product_email_template/views/{email_template_view.xml => mail_template_views.xml} (100%) rename addons/product_email_template/views/{product_view.xml => product_views.xml} (100%) diff --git a/addons/product_email_template/__openerp__.py b/addons/product_email_template/__openerp__.py index 676dcd9ce32..ad9de0b724c 100644 --- a/addons/product_email_template/__openerp__.py +++ b/addons/product_email_template/__openerp__.py @@ -15,8 +15,8 @@ For instance when invoicing a training, the training agenda and materials will a 'data/product_demo.xml', ], 'data': [ - 'views/product_view.xml', - 'views/email_template_view.xml', + 'views/product_views.xml', + 'views/mail_template_views.xml', ], 'installable': True, 'auto_install': False, diff --git a/addons/product_email_template/data/product_demo.xml b/addons/product_email_template/data/product_demo.xml index 565141b3ffd..205af922212 100644 --- a/addons/product_email_template/data/product_demo.xml +++ b/addons/product_email_template/data/product_demo.xml @@ -1,6 +1,5 @@ - - + Online Training Online Training @@ -626,7 +625,7 @@ - + ]]> @@ -642,5 +641,4 @@ - - + \ No newline at end of file diff --git a/addons/product_email_template/models/__init__.py b/addons/product_email_template/models/__init__.py index 2edb825574d..5067404a32c 100644 --- a/addons/product_email_template/models/__init__.py +++ b/addons/product_email_template/models/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- import product -import invoice +import account_invoice \ No newline at end of file diff --git a/addons/product_email_template/models/invoice.py b/addons/product_email_template/models/account_invoice.py similarity index 100% rename from addons/product_email_template/models/invoice.py rename to addons/product_email_template/models/account_invoice.py diff --git a/addons/product_email_template/views/email_template_view.xml b/addons/product_email_template/views/mail_template_views.xml similarity index 100% rename from addons/product_email_template/views/email_template_view.xml rename to addons/product_email_template/views/mail_template_views.xml diff --git a/addons/product_email_template/views/product_view.xml b/addons/product_email_template/views/product_views.xml similarity index 100% rename from addons/product_email_template/views/product_view.xml rename to addons/product_email_template/views/product_views.xml From 7f18dfc9edac895f6dde5d2e1a0b18281d0f6134 Mon Sep 17 00:00:00 2001 From: Prashant Panchal Date: Mon, 24 Aug 2015 17:00:39 +0530 Subject: [PATCH 2/3] [REF] product_email_template: migration to the new API --- addons/product_email_template/__openerp__.py | 4 +- .../data/product_demo.xml | 46 +++++++++---------- .../models/account_invoice.py | 20 ++++---- .../product_email_template/models/product.py | 15 +++--- .../views/mail_template_views.xml | 10 ++-- .../views/product_views.xml | 8 ++-- 6 files changed, 46 insertions(+), 57 deletions(-) diff --git a/addons/product_email_template/__openerp__.py b/addons/product_email_template/__openerp__.py index ad9de0b724c..a74b53c4384 100644 --- a/addons/product_email_template/__openerp__.py +++ b/addons/product_email_template/__openerp__.py @@ -17,7 +17,5 @@ For instance when invoicing a training, the training agenda and materials will a 'data': [ 'views/product_views.xml', 'views/mail_template_views.xml', - ], - 'installable': True, - 'auto_install': False, + ] } diff --git a/addons/product_email_template/data/product_demo.xml b/addons/product_email_template/data/product_demo.xml index 205af922212..a0eb8b2b2a6 100644 --- a/addons/product_email_template/data/product_demo.xml +++ b/addons/product_email_template/data/product_demo.xml @@ -22,7 +22,7 @@
  • New interactive learning experience
  • Lower training budget for the same quality courses
  • Better comfort to facilitate your learning process
  • -
  • Odoo Certification Exam included (Pre-Ordered, available as of November 1st, 2013)
  • +
  • Odoo Certification Exam included (Pre-Ordered, available as of November 1st, 2013)

  • @@ -65,35 +65,35 @@ Each day of the week is dedicated to specific applications in Odoo as per the following planning: @@ -625,7 +625,7 @@ - + ]]> diff --git a/addons/product_email_template/models/account_invoice.py b/addons/product_email_template/models/account_invoice.py index c93b3901fc0..82c0dfbbea0 100644 --- a/addons/product_email_template/models/account_invoice.py +++ b/addons/product_email_template/models/account_invoice.py @@ -1,26 +1,24 @@ # -*- coding: utf-8 -*- -from openerp.osv import osv +from odoo import api, models -class account_invoice(osv.Model): +class AccountInvoice(models.Model): _inherit = 'account.invoice' - def invoice_validate_send_email(self, cr, uid, ids, context=None): - Composer = self.pool['mail.compose.message'] - for invoice in self.browse(cr, uid, ids, context=context): + def invoice_validate_send_email(self): + for invoice in self.filtered(lambda x: x.type == 'out_invoice'): # send template only on customer invoice - if invoice.type != 'out_invoice': - continue # subscribe the partner to the invoice if invoice.partner_id not in invoice.message_partner_ids: - self.message_subscribe(cr, uid, [invoice.id], [invoice.partner_id.id], context=context) + invoice.message_subscribe([invoice.partner_id.id]) for line in invoice.invoice_line_ids: if line.product_id.email_template_id: invoice.message_post_with_template(line.product_id.email_template_id.id, composition_mode='comment') return True - def invoice_validate(self, cr, uid, ids, context=None): - res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=context) - self.invoice_validate_send_email(cr, uid, ids, context=context) + @api.multi + def invoice_validate(self): + res = super(AccountInvoice, self).invoice_validate() + self.invoice_validate_send_email() return res diff --git a/addons/product_email_template/models/product.py b/addons/product_email_template/models/product.py index bd45a1c3f39..83583c3a237 100644 --- a/addons/product_email_template/models/product.py +++ b/addons/product_email_template/models/product.py @@ -1,19 +1,16 @@ # -*- coding: utf-8 -*- -from openerp.osv import fields, osv +from odoo import fields, models -class product_template(osv.Model): +class ProductTemplate(models.Model): """ Product Template inheritance to add an optional email.template to a product.template. When validating an invoice, an email will be send to the customer based on this template. The customer will receive an email for each product linked to an email template. """ _inherit = "product.template" - _columns = { - 'email_template_id': fields.many2one( - 'mail.template', 'Product Email Template', - help='When validating an invoice, an email will be sent to the customer ' - 'based on this template. The customer will receive an email for each ' - 'product linked to an email template.'), - } + email_template_id = fields.Many2one('mail.template', string='Product Email Template', + help='When validating an invoice, an email will be sent to the customer ' + 'based on this template. The customer will receive an email for each ' + 'product linked to an email template.') diff --git a/addons/product_email_template/views/mail_template_views.xml b/addons/product_email_template/views/mail_template_views.xml index 3c45ff8aafe..60aa1a2d3b7 100644 --- a/addons/product_email_template/views/mail_template_views.xml +++ b/addons/product_email_template/views/mail_template_views.xml @@ -1,8 +1,7 @@ - - - - email.template.form.simplified + + + mail.template.form.simplified mail.template 100 @@ -19,5 +18,4 @@ - - + diff --git a/addons/product_email_template/views/product_views.xml b/addons/product_email_template/views/product_views.xml index 5d7f17ab6ff..2d01945d582 100644 --- a/addons/product_email_template/views/product_views.xml +++ b/addons/product_email_template/views/product_views.xml @@ -1,8 +1,7 @@ - - + - product.template.form.inherit + product.template.form.inherit.email.template product.template @@ -23,5 +22,4 @@ - - + From 11ef96094921d53ef488928b89ee1a88def08be3 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Jan 2016 14:02:08 +0530 Subject: [PATCH 3/3] [FIX] product_email_template: remove outdated demo data --- .../data/product_demo.xml | 56 ++++--------------- 1 file changed, 12 insertions(+), 44 deletions(-) diff --git a/addons/product_email_template/data/product_demo.xml b/addons/product_email_template/data/product_demo.xml index a0eb8b2b2a6..4e1a833a48c 100644 --- a/addons/product_email_template/data/product_demo.xml +++ b/addons/product_email_template/data/product_demo.xml @@ -7,13 +7,12 @@ - Online Training + Certification + Online Training
    These courses feature the same high quality course content found in our traditional classroom trainings, supplemented with modular sessions and cloud-based labs. Many of our online learning courses also include dozens of recorded webinars and live - sessions by our senior instructors. At the end of the training, you can pass the Odoo Certification exam in one of the 5000+ - Pearson VUE test centers worldwide. + sessions by our senior instructors.
    Your advantages @@ -22,7 +21,6 @@
  • New interactive learning experience
  • Lower training budget for the same quality courses
  • Better comfort to facilitate your learning process
  • -
  • Odoo Certification Exam included (Pre-Ordered, available as of November 1st, 2013)

  • @@ -65,57 +63,27 @@ Each day of the week is dedicated to specific applications in Odoo as per the following planning: -
    - - - - - - - - - - - - - - - - -
    EnglishEnglishSpanish
    EuropeUSA & CanadaUSA & Latin America
    RegisterRegisterRegister
    -

    Content of the Training