diff --git a/res_users_signature/README.rst b/res_users_signature/README.rst index 91fe7d3050..7ded1d3a18 100644 --- a/res_users_signature/README.rst +++ b/res_users_signature/README.rst @@ -1,31 +1,40 @@ -Allows create signature templates for users. For example, +=================================== + Signature templates for user email +=================================== - --- +Add templated signature for users -

${user.name}, ${user.function} of ${user.partner_id.company_id.name}

+Credits +======= -

${user.phone}, +Contributors +------------ +* `Ivan Yelizariev `__ +* `Anvar Kildebekov `__ - % if user.mobile +Sponsors +-------- +* `IT-Projects LLC `__ - ${user.mobile}, +Maintainers +----------- +* `IT-Projects LLC `__ - % endif + To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store `__. - ${user.email}

+ Thank you for understanding! -

+ `IT-Projects Team `__ -Will be converted to +Further information +=================== - --- +Demo: http://runbot.it-projects.info/demo/12.0/misc-addons -

Bob, sale manager of You Company

+HTML Description: https://apps.odoo.com/apps/modules/12.0/res_users_signature/ -

+123456789, sales@example.com

+Usage instructions: ``_ -

+Changelog: ``_ -Tested on 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d - -Further information and discussion: https://yelizariev.github.io/odoo/module/2015/03/17/email-signature-template.html +Tested on Odoo 12.0 32c2666d189047db66eb7b1392ea34b086fd341e diff --git a/res_users_signature/__init__.py b/res_users_signature/__init__.py index a18968a084..35038d03a6 100644 --- a/res_users_signature/__init__.py +++ b/res_users_signature/__init__.py @@ -1 +1,2 @@ -from . import res_users_signature_models +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +from . import models diff --git a/res_users_signature/__manifest__.py b/res_users_signature/__manifest__.py index 5354139354..13269c57d5 100644 --- a/res_users_signature/__manifest__.py +++ b/res_users_signature/__manifest__.py @@ -1,15 +1,19 @@ { 'name': 'Signature templates for user emails', - 'version': '1.0.0', + 'version': '12.0.1.0.0', 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', 'category': 'Social Network', + "images": ["images/main.jpg"], 'website': 'https://yelizariev.github.io', 'depends': ['base'], 'data': [ - 'res_users_signature_views.xml', + 'views/res_users_signature_views.xml', 'security/res_users_signature_security.xml', 'security/ir.model.access.csv', ], - 'installable': False + 'python': [ + 'html2text', + ], + 'installable': True } diff --git a/res_users_signature/doc/changelog.rst b/res_users_signature/doc/changelog.rst new file mode 100644 index 0000000000..5583eb326a --- /dev/null +++ b/res_users_signature/doc/changelog.rst @@ -0,0 +1,4 @@ +`1.0.0` +------- + +- **Init version** diff --git a/res_users_signature/doc/index.rst b/res_users_signature/doc/index.rst new file mode 100644 index 0000000000..50de992743 --- /dev/null +++ b/res_users_signature/doc/index.rst @@ -0,0 +1,44 @@ +=================================== +Signature templates for user emails +=================================== + +Installation +============ + +* `Install `__ this module in a usual way + +Usage +===== + +* Open menu ``[[ {Menu} ]]>> {Submenu} >> {Subsubmenu}`` +* Click ``[{Button Name}]`` + +Allows create signature templates for users. For example, + + --- + +

${user.name}, ${user.function} of ${user.partner_id.company_id.name}

+ +

${user.phone}, + + % if user.mobile + + ${user.mobile}, + + % endif + + ${user.email}

+ +

+ +Will be converted to + + --- + +

Bob, sale manager of You Company

+ +

+123456789, sales@example.com

+ +

+ +* RESULT: {what user gets, how the modules changes default behaviour} diff --git a/res_users_signature/images/main.png b/res_users_signature/images/main.png new file mode 100644 index 0000000000..1bf3d839f5 Binary files /dev/null and b/res_users_signature/images/main.png differ diff --git a/res_users_signature/models/__init__.py b/res_users_signature/models/__init__.py new file mode 100644 index 0000000000..a18968a084 --- /dev/null +++ b/res_users_signature/models/__init__.py @@ -0,0 +1 @@ +from . import res_users_signature_models diff --git a/res_users_signature/res_users_signature_models.py b/res_users_signature/models/res_users_signature_models.py similarity index 90% rename from res_users_signature/res_users_signature_models.py rename to res_users_signature/models/res_users_signature_models.py index 71a9af4c6c..b73992cd4c 100644 --- a/res_users_signature/res_users_signature_models.py +++ b/res_users_signature/models/res_users_signature_models.py @@ -1,36 +1,32 @@ -from openerp import fields as old_fields -from openerp import api, models, fields, tools +from odoo import api, models, fields, tools try: - from openerp.addons.email_template.email_template import mako_template_env + from odoo.addons.mail.models.mail_template import mako_template_env except ImportError: - try: - from openerp.addons.mail.mail_template import mako_template_env - except ImportError: - pass + pass -from openerp.loglevels import ustr +from odoo.loglevels import ustr from email.mime.text import MIMEText from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email.utils import COMMASPACE from email.utils import formatdate from email.utils import make_msgid -from email import Encoders -from openerp.tools import html2text +from email import encoders +import html2text import re import base64 -from openerp.addons.base.models.ir_mail_server import encode_rfc2822_address_header, encode_header, encode_header_param +from odoo.addons.base.models.ir_mail_server import encode_rfc2822_address_header, encode_header, encode_header_param class ResUsers(models.Model): _inherit = 'res.users' signature_id = fields.Many2one('res.users.signature', string='Signature template', help='Keep empty to edit signature manually') - - 'signature': old_fields.Html('Signature', sanitize=False) - + _columns = { + 'signature': fields.Html('Signature', sanitize=False) + } @api.one @api.onchange('signature_id') @@ -53,6 +49,7 @@ def write(self, vals): class ResUsersSignature(models.Model): _name = 'res.users.signature' + _description = 'Users signatures' name = fields.Char('Name') comment = fields.Text('Internal note') @@ -112,7 +109,7 @@ class IrMailServer(models.Model): def build_email(self, email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attachments=None, message_id=None, references=None, object_id=False, subtype='plain', headers=None, body_alternative=None, subtype_alternative='plain'): - """ copy-pasted from openerp/addons/base/models/ir_mail_server.py::build_email """ + """ copy-pasted from odoo/addons/base/models/ir_mail_server.py::build_email """ ftemplate = '__image-%s__' fcounter = 0 @@ -184,7 +181,7 @@ def build_email(self, email_from, email_to, subject, body, email_cc=None, email_ msg['Bcc'] = encode_rfc2822_address_header(COMMASPACE.join(email_bcc)) msg['Date'] = formatdate() # Custom headers may override normal headers or provide additional ones - for key, value in headers.iteritems(): + for key, value in headers.items(): msg[ustr(key).encode('utf-8')] = encode_header(value) if subtype == 'html' and not body_alternative and html2text: @@ -212,11 +209,11 @@ def build_email(self, email_from, email_to, subject, body, email_cc=None, email_ # The default RFC2231 encoding of Message.add_header() works in Thunderbird but not GMail # so we fix it by using RFC2047 encoding for the filename instead. - part.set_param('name', filename_rfc2047) + part.sudo().set_param('name', filename_rfc2047) part.add_header('Content-Disposition', 'attachment', filename=filename_rfc2047) part.add_header('Content-ID', '<%s>' % filename_rfc2047) # NEW STUFF part.set_payload(fcontent) - Encoders.encode_base64(part) + encoders.encode_base64(part) msg.attach(part) return msg diff --git a/res_users_signature/security/res_users_signature_security.xml b/res_users_signature/security/res_users_signature_security.xml index 3f188cb688..aa85d8c883 100644 --- a/res_users_signature/security/res_users_signature_security.xml +++ b/res_users_signature/security/res_users_signature_security.xml @@ -1,10 +1,8 @@ - - - - Signature administrator - the user will have access to edit signatures - - - - + + + Signature administrator + the user will have access to edit signatures + + + diff --git a/res_users_signature/static/description/index.html b/res_users_signature/static/description/index.html new file mode 100644 index 0000000000..134cea1ad8 --- /dev/null +++ b/res_users_signature/static/description/index.html @@ -0,0 +1,52 @@ +
+
+
+

Need our service?

+

Contact us by email or fill out request form

+ +
+
+
+
+ Tested on Odoo
12.0 community +
+ +
+
+
+
diff --git a/res_users_signature/res_users_signature_views.xml b/res_users_signature/views/res_users_signature_views.xml similarity index 88% rename from res_users_signature/res_users_signature_views.xml rename to res_users_signature/views/res_users_signature_views.xml index 49988c6630..791daa196d 100644 --- a/res_users_signature/res_users_signature_views.xml +++ b/res_users_signature/views/res_users_signature_views.xml @@ -1,6 +1,5 @@ - - + res.users.form @@ -58,7 +57,7 @@ - + + + Update signatures + + + code + + self.action_update_signature(cr, uid, context['active_ids'], context=context) + + Signatures @@ -86,5 +95,4 @@ - - + diff --git a/res_users_signature_hr/README.rst b/res_users_signature_hr/README.rst index 045bf1b587..089008d7e4 100644 --- a/res_users_signature_hr/README.rst +++ b/res_users_signature_hr/README.rst @@ -1,4 +1,5 @@ -Signature templates for user emails (HR) +======================================== + Signature templates for user email (HR) ======================================== Connector for modules: @@ -6,3 +7,37 @@ Connector for modules: * Signature templates for user emails * HR +Credits +======= + +Contributors +------------ +* `Ivan Yelizariev `__ +* `Anvar Kildebekov `__ + +Sponsors +-------- +* `IT-Projects LLC `__ + +Maintainers +----------- +* `IT-Projects LLC `__ + + To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store `__. + + Thank you for understanding! + + `IT-Projects Team `__ + +Further information +=================== + +Demo: http://runbot.it-projects.info/demo/12.0/pos-addons + +HTML Description: https://apps.odoo.com/apps/modules/12.0/pos_menu/ + +Usage instructions: ``_ + +Changelog: ``_ + +Tested on 12.0 32c2666d189047db66eb7b1392ea34b086fd341e diff --git a/res_users_signature_hr/__manifest__.py b/res_users_signature_hr/__manifest__.py index 79e6d16883..422d88ebd7 100644 --- a/res_users_signature_hr/__manifest__.py +++ b/res_users_signature_hr/__manifest__.py @@ -1,14 +1,14 @@ { 'name': "Signature templates for user emails (HR)", - 'version': '1.0.0', + 'version': '12.0.1.0.0', 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', 'category': 'Custom', 'website': 'https://yelizariev.github.io', 'depends': ['res_users_signature', 'hr'], 'data': [ - 'views.xml', + 'views/res_users_signature_hr_views.xml', ], - 'installable': False, + 'installable': True, 'auto_install': True, } diff --git a/res_users_signature_hr/doc/changelog.rst b/res_users_signature_hr/doc/changelog.rst new file mode 100644 index 0000000000..5583eb326a --- /dev/null +++ b/res_users_signature_hr/doc/changelog.rst @@ -0,0 +1,4 @@ +`1.0.0` +------- + +- **Init version** diff --git a/res_users_signature_hr/doc/index.rst b/res_users_signature_hr/doc/index.rst new file mode 100644 index 0000000000..75f9a10be0 --- /dev/null +++ b/res_users_signature_hr/doc/index.rst @@ -0,0 +1,45 @@ +======================================== +Signature templates for user emails (HR) +======================================== + +Installation +============ + +* `Install `__ this module in a usual way + +Usage +===== + +* Open signatures ``[[Settings]]>> Users and Companies >> Signatures`` +* Click ``[Create]`` +* Fill the fields + +Template example: + + --- + +

${user.name}, ${user.function} of ${user.partner_id.company_id.name}

+ +

${user.phone}, + + % if user.mobile + + ${user.mobile}, + + % endif + + ${user.email}

+ +

+ +Will be converted to + + --- + +

Bob, sale manager of You Company

+ +

+123456789, sales@example.com

+ +

+ +* RESULT: {what user gets, how the modules changes default behaviour} diff --git a/res_users_signature_hr/models.py b/res_users_signature_hr/models/res_users_signature_models.py similarity index 82% rename from res_users_signature_hr/models.py rename to res_users_signature_hr/models/res_users_signature_models.py index a9382067fe..b571f68c96 100644 --- a/res_users_signature_hr/models.py +++ b/res_users_signature_hr/models/res_users_signature_models.py @@ -1,5 +1,5 @@ -from openerp import api -from openerp import models +from odoo import api +from odoo import models class HrEmployee(models.Model): diff --git a/res_users_signature_hr/views.xml b/res_users_signature_hr/views/res_users_signature_hr_views.xml similarity index 53% rename from res_users_signature_hr/views.xml rename to res_users_signature_hr/views/res_users_signature_hr_views.xml index 379a8683a4..6fa84137e4 100644 --- a/res_users_signature_hr/views.xml +++ b/res_users_signature_hr/views/res_users_signature_hr_views.xml @@ -1,3 +1,3 @@ - - + +