From 62331457d0749e2b129a7102a8b0b9f21e9244af Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Fri, 30 Sep 2022 13:31:00 +0200 Subject: [PATCH 1/9] [IMP] sale_brand: add terms and conditions Add the possibility to add seperate sales conditions per brand --- sale_brand/__manifest__.py | 6 +++- sale_brand/models/__init__.py | 1 + sale_brand/models/res_brand.py | 39 ++++++++++++++++++++ sale_brand/models/sale_order.py | 17 +++++++-- sale_brand/tests/test_sale_order.py | 55 +++++++++++++++++++++++++++++ sale_brand/views/res_brand.xml | 33 +++++++++++++++++ 6 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 sale_brand/models/res_brand.py create mode 100644 sale_brand/views/res_brand.xml diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 029d4e653..4dfbe24c9 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -10,7 +10,11 @@ "author": "Open Source Integrators, Odoo Community Association (OCA)", "license": "AGPL-3", "depends": ["sale", "brand", "account_brand", "analytic_brand"], - "data": ["views/sale_views.xml", "views/crm_team_views.xml"], + "data": [ + "views/sale_views.xml", + "views/crm_team_views.xml", + "views/res_brand.xml", + ], "installable": True, "development_status": "Beta", "maintainers": ["osi-scampbell", "sbejaoui"], diff --git a/sale_brand/models/__init__.py b/sale_brand/models/__init__.py index 326207d35..c88cab6c2 100644 --- a/sale_brand/models/__init__.py +++ b/sale_brand/models/__init__.py @@ -1,2 +1,3 @@ from . import sale_order from . import crm_team +from . import res_brand diff --git a/sale_brand/models/res_brand.py b/sale_brand/models/res_brand.py new file mode 100644 index 000000000..497d2b029 --- /dev/null +++ b/sale_brand/models/res_brand.py @@ -0,0 +1,39 @@ +# Copyright 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import re + +from odoo import api, fields, models + + +class ResBrand(models.Model): + _inherit = "res.brand" + + invoice_terms = fields.Html(string="Default Terms and Conditions", translate=True) + terms_type = fields.Selection( + [("plain", "Add a Note"), ("html", "Add a link to a Web Page")], + string="Terms & Conditions format", + default="plain", + ) + terms_page = fields.Char( + help="page on the brands site where the terms can be found", + translate=True, + default="/terms", + ) + terms_url = fields.Char(string="Preview terms", compute="_compute_terms_url") + + @api.onchange("website", "terms_page") + def _compute_terms_url(self): + link_tags = re.compile( + r"""(?)""" + ) + for brand in self: + idx = 0 + final = "" + text = brand.website + brand.terms_page + for item in re.finditer(link_tags, text): + final += text[idx : item.start()] + final += item.group(0) + idx = item.end() + final += text[idx:] + brand.terms_url = final diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index b56d03cb6..fcec4a212 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -1,7 +1,7 @@ -# Copyright (C) 2019 Open Source Integrators +# Copyright (C) 2019 Open Source Integrators, 2022 Snakebyte # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import _, api, fields, models class SaleOrder(models.Model): @@ -28,6 +28,7 @@ def _prepare_invoice(self): def _onchange_brand_id(self): res = super()._onchange_brand_id() for order in self: + order.note = order._default_note() if order.state == "draft" and order.brand_id: order.analytic_account_id = order.brand_id.analytic_account_id return res @@ -45,3 +46,15 @@ def default_get(self, fields_list): res["brand_id"] = team.brand_id.id return res + + def _default_note(self): + use_invoice_terms = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("account.use_invoice_terms") + ) + if use_invoice_terms and self.brand_id: + if self.brand_id.terms_type == "html": + return _("Terms & Conditions: %s", self.brand_id.terms_url) + return self.brand_id.invoice_terms or "" + return super()._default_note() diff --git a/sale_brand/tests/test_sale_order.py b/sale_brand/tests/test_sale_order.py index 51a55fabe..481839097 100644 --- a/sale_brand/tests/test_sale_order.py +++ b/sale_brand/tests/test_sale_order.py @@ -3,6 +3,8 @@ from odoo.tests.common import TransactionCase +from odoo.addons.brand.models.res_company import BRAND_USE_LEVEL_NO_USE_LEVEL + class TestSaleOrder(TransactionCase): def setUp(self): @@ -12,6 +14,59 @@ def setUp(self): self.sale.order_line.mapped("product_id").write({"invoice_policy": "order"}) self.sale.action_confirm() + def test_terms_url(self): + self.env["ir.config_parameter"].sudo().set_param( + "account.use_invoice_terms", True + ) + + self.sale.brand_id.write( + { + "website": "https://odoo-community.org", + "terms_type": "html", + "invoice_terms": "We are not responsible for or product to work", + "terms_page": "/terms", + } + ) + self.assertEqual( + self.sale.brand_id.terms_url, "https://odoo-community.org/terms" + ) + self.sale._onchange_brand_id() + self.assertEqual( + self.sale.note, + "

Terms & Conditions: https://odoo-community.org/terms

", + ) + + self.sale.brand_id.write({"terms_type": "plain"}) + self.sale._onchange_brand_id() + self.assertEqual( + self.sale.note, + "

We are not responsible for or product to work

", + ) + + self.env["ir.config_parameter"].sudo().set_param( + "account.use_invoice_terms", False + ) + self.sale.brand_id.write({"terms_type": "plain"}) + self.sale._onchange_brand_id() + self.assertEqual( + self.sale.note, + "", + ) + + self.env["ir.config_parameter"].sudo().set_param( + "account.use_invoice_terms", True + ) + self.env.company.write( + { + "terms_type": "plain", + "invoice_terms": "Company terms", + "brand_use_level": BRAND_USE_LEVEL_NO_USE_LEVEL, + } + ) + self.sale.brand_id = False + self.sale._onchange_brand_id() + self.assertEqual(self.sale.note, "

Company terms

") + def test_create_invoice(self): """It should create branded invoice""" self.assertEqual(self.sale.invoice_status, "to invoice") diff --git a/sale_brand/views/res_brand.xml b/sale_brand/views/res_brand.xml new file mode 100644 index 000000000..a5b0271e5 --- /dev/null +++ b/sale_brand/views/res_brand.xml @@ -0,0 +1,33 @@ + + + + + res.brand + + + + + + + + + + + From 0578fd49063d3563d29041c820d6f812e739e740 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 11 Oct 2022 13:28:53 +0200 Subject: [PATCH 2/9] [FIX] - sale_brand: flake8 ignore B950 --- sale_brand/models/res_brand.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sale_brand/models/res_brand.py b/sale_brand/models/res_brand.py index 497d2b029..ecdab2601 100644 --- a/sale_brand/models/res_brand.py +++ b/sale_brand/models/res_brand.py @@ -22,6 +22,7 @@ class ResBrand(models.Model): ) terms_url = fields.Char(string="Preview terms", compute="_compute_terms_url") + # flake8: noqa: B950 @api.onchange("website", "terms_page") def _compute_terms_url(self): link_tags = re.compile( From d3b173446cc517b79ab1afeaa7405f0d46e42e3c Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Mon, 10 Oct 2022 16:01:52 +0200 Subject: [PATCH 3/9] [ADD] mail_brand: add brand to mails If mails are send with a brand assigned (for instanse from a sales order) the brand info will be shown instead of the company info. --- mail_brand/README.rst | 84 +++++ mail_brand/__init__.py | 2 + mail_brand/__manifest__.py | 20 ++ mail_brand/controllers/__init__.py | 1 + mail_brand/controllers/main.py | 69 ++++ mail_brand/data/mail_template.xml | 58 ++++ mail_brand/models/__init__.py | 3 + mail_brand/models/ir_model.py | 16 + mail_brand/models/mail_thread.py | 29 ++ mail_brand/models/res_brand.py | 17 + mail_brand/readme/CONTRIBUTORS.rst | 1 + mail_brand/readme/CREDITS.rst | 0 mail_brand/readme/DESCRIPTION.rst | 4 + mail_brand/readme/USAGE.rst | 0 mail_brand/static/description/index.html | 423 +++++++++++++++++++++++ setup/mail_brand/odoo/addons/mail_brand | 1 + setup/mail_brand/setup.py | 6 + 17 files changed, 734 insertions(+) create mode 100644 mail_brand/README.rst create mode 100644 mail_brand/__init__.py create mode 100644 mail_brand/__manifest__.py create mode 100644 mail_brand/controllers/__init__.py create mode 100644 mail_brand/controllers/main.py create mode 100644 mail_brand/data/mail_template.xml create mode 100644 mail_brand/models/__init__.py create mode 100644 mail_brand/models/ir_model.py create mode 100644 mail_brand/models/mail_thread.py create mode 100644 mail_brand/models/res_brand.py create mode 100644 mail_brand/readme/CONTRIBUTORS.rst create mode 100644 mail_brand/readme/CREDITS.rst create mode 100644 mail_brand/readme/DESCRIPTION.rst create mode 100644 mail_brand/readme/USAGE.rst create mode 100644 mail_brand/static/description/index.html create mode 120000 setup/mail_brand/odoo/addons/mail_brand create mode 100644 setup/mail_brand/setup.py diff --git a/mail_brand/README.rst b/mail_brand/README.rst new file mode 100644 index 000000000..c04ae3f8a --- /dev/null +++ b/mail_brand/README.rst @@ -0,0 +1,84 @@ +=========== +Email Brand +=========== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github + :target: https://github.com/OCA/brand/tree/15.0/mail_brand + :alt: OCA/brand +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/brand-15-0/brand-15-0-mail_brand + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/284/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +If a model has a brand defined to it, emails send from this model will be branded accordingly. + +If the brand module gets implemented more broadly this module could need extension to work properly, because not all +odoo modules use the same mail templates + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Gert Pellin / Snakebyte Development + +Contributors +~~~~~~~~~~~~ + +* Gert Pellin + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-switch87| image:: https://github.com/switch87.png?size=40px + :target: https://github.com/switch87 + :alt: switch87 + +Current `maintainer `__: + +|maintainer-switch87| + +This module is part of the `OCA/brand `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_brand/__init__.py b/mail_brand/__init__.py new file mode 100644 index 000000000..91c5580fe --- /dev/null +++ b/mail_brand/__init__.py @@ -0,0 +1,2 @@ +from . import controllers +from . import models diff --git a/mail_brand/__manifest__.py b/mail_brand/__manifest__.py new file mode 100644 index 000000000..d6b35ca4a --- /dev/null +++ b/mail_brand/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Email Brand", + "summary": """ + If a model has a brand defined to it, emails send from this model will be + branded accordingly. If the brand module gets implemented more broadly this + module could need extension to work properly. + """, + "license": "AGPL-3", + "author": "Odoo Community Association (OCA), Gert Pellin / Snakebyte Development", + "website": "https://github.com/OCA/brand", + "version": "15.0.1.0.1", + "depends": ["mail", "brand"], + "data": [ + "data/mail_template.xml", + ], + "maintainers": ["switch87"], +} diff --git a/mail_brand/controllers/__init__.py b/mail_brand/controllers/__init__.py new file mode 100644 index 000000000..12a7e529b --- /dev/null +++ b/mail_brand/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/mail_brand/controllers/main.py b/mail_brand/controllers/main.py new file mode 100644 index 000000000..defa12076 --- /dev/null +++ b/mail_brand/controllers/main.py @@ -0,0 +1,69 @@ +# Copyright (C) 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import base64 +import functools +import io + +import odoo +from odoo import http +from odoo.modules import get_resource_path +from odoo.tools.mimetypes import guess_mimetype + +from odoo.addons.web.controllers.main import Binary + + +class BrandBinary(Binary): + @http.route() + def company_logo(self, dbname=None, **kw): + response = False + imgname = "logo" + imgext = ".png" + uid = None + placeholder = functools.partial(get_resource_path, "web", "static", "img") + if http.request.session.db: + dbname = http.request.session.db + uid = http.request.session.uid + elif dbname is None: + dbname = http.db_monodb() + if not uid: + uid = odoo.SUPERUSER_ID + if not dbname: + response = http.send_file(placeholder(imgname + imgext)) + else: + try: + has_brand = ( + int(kw["has_brand"]) if kw and kw.get("has_brand") else False + ) + if has_brand: + registry = odoo.modules.registry.Registry(dbname) + with registry.cursor() as cr: + brand = int(kw["company"]) + if brand: + cr.execute( + """ + SELECT logo_web, write_date + FROM res_brand + WHERE id = %s + """, + (brand,), + ) + row = cr.fetchone() + if row and row[0]: + image_base64 = base64.b64decode(row[0]) + image_data = io.BytesIO(image_base64) + mimetype = guess_mimetype( + image_base64, default="image/png" + ) + imgext = "." + mimetype.split("/")[1] + if imgext == ".svg+xml": + imgext = ".svg" + response = http.send_file( + image_data, + filename=imgname + imgext, + mimetype=mimetype, + mtime=row[1], + ) + except Exception: + response = http.send_file(placeholder(imgname + imgext)) + return response or super().company_logo(dbname, **kw) diff --git a/mail_brand/data/mail_template.xml b/mail_brand/data/mail_template.xml new file mode 100644 index 000000000..1bdd97e85 --- /dev/null +++ b/mail_brand/data/mail_template.xml @@ -0,0 +1,58 @@ + + + + + + + + + + diff --git a/mail_brand/models/__init__.py b/mail_brand/models/__init__.py new file mode 100644 index 000000000..1fa1f3074 --- /dev/null +++ b/mail_brand/models/__init__.py @@ -0,0 +1,3 @@ +from . import ir_model +from . import res_brand +from . import mail_thread diff --git a/mail_brand/models/ir_model.py b/mail_brand/models/ir_model.py new file mode 100644 index 000000000..0e38a1123 --- /dev/null +++ b/mail_brand/models/ir_model.py @@ -0,0 +1,16 @@ +# Copyright (C) 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class BaseModel(models.AbstractModel): + _inherit = "base" + + def get_base_url(self): + if not self: + return super().get_base_url() + if "brand_id" in self and "website_id" in self.brand_id: + return self.brand_id.website_website_id.domain + else: + return super().get_base_url() diff --git a/mail_brand/models/mail_thread.py b/mail_brand/models/mail_thread.py new file mode 100644 index 000000000..92fbc913a --- /dev/null +++ b/mail_brand/models/mail_thread.py @@ -0,0 +1,29 @@ +# Copyright (C) 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class MailThread(models.AbstractModel): + _inherit = "mail.thread" + + @api.model + def _notify_prepare_template_context( + self, message, msg_vals, model_description=False, mail_auto_delete=True + ): + result = super()._notify_prepare_template_context( + message, msg_vals, model_description, mail_auto_delete + ) + + result["has_brand"] = hasattr(self, "brand_id") + if result["has_brand"]: + result["company"] = self.brand_id + if self.brand_id.website: + result["website_url"] = ( + "https://%s" % self.brand_id.website + if not self.brand_id.website.lower().startswith(("http:", "https:")) + else self.brand_id.website + ) + else: + result["website_url"] = False + return result diff --git a/mail_brand/models/res_brand.py b/mail_brand/models/res_brand.py new file mode 100644 index 000000000..bb2f14dc5 --- /dev/null +++ b/mail_brand/models/res_brand.py @@ -0,0 +1,17 @@ +# Copyright 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models +from odoo.tools import image_process + + +class ResBrand(models.Model): + + _inherit = "res.brand" + + logo_web = fields.Binary(compute="_compute_logo_web", store=True, attachment=False) + + @api.depends("partner_id.image_1920") + def _compute_logo_web(self): + for brand in self: + brand.logo_web = image_process(brand.partner_id.image_1920, size=(180, 0)) diff --git a/mail_brand/readme/CONTRIBUTORS.rst b/mail_brand/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..aeac835e7 --- /dev/null +++ b/mail_brand/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Gert Pellin diff --git a/mail_brand/readme/CREDITS.rst b/mail_brand/readme/CREDITS.rst new file mode 100644 index 000000000..e69de29bb diff --git a/mail_brand/readme/DESCRIPTION.rst b/mail_brand/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5a12320b1 --- /dev/null +++ b/mail_brand/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +If a model has a brand defined to it, emails send from this model will be branded accordingly. + +If the brand module gets implemented more broadly this module could need extension to work properly, because not all +odoo modules use the same mail templates diff --git a/mail_brand/readme/USAGE.rst b/mail_brand/readme/USAGE.rst new file mode 100644 index 000000000..e69de29bb diff --git a/mail_brand/static/description/index.html b/mail_brand/static/description/index.html new file mode 100644 index 000000000..7b938387b --- /dev/null +++ b/mail_brand/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +Email Brand + + + +
+

Email Brand

+ + +

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

+

If a model has a brand defined to it, emails send from this model will be branded accordingly.

+

If the brand module gets implemented more broadly this module could need extension to work properly, because not all +odoo modules use the same mail templates

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Gert Pellin / Snakebyte Development
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

switch87

+

This module is part of the OCA/brand project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/setup/mail_brand/odoo/addons/mail_brand b/setup/mail_brand/odoo/addons/mail_brand new file mode 120000 index 000000000..a07fbf811 --- /dev/null +++ b/setup/mail_brand/odoo/addons/mail_brand @@ -0,0 +1 @@ +../../../../mail_brand \ No newline at end of file diff --git a/setup/mail_brand/setup.py b/setup/mail_brand/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mail_brand/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From a47562fec3119fcb9f8a1cf8f601b5394482c15e Mon Sep 17 00:00:00 2001 From: oca-ci Date: Tue, 1 Nov 2022 13:28:52 +0000 Subject: [PATCH 4/9] [UPD] Update sale_brand.pot --- sale_brand/i18n/sale_brand.pot | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot index 07d236e32..2de16f1fb 100644 --- a/sale_brand/i18n/sale_brand.pot +++ b/sale_brand/i18n/sale_brand.pot @@ -14,6 +14,17 @@ msgstr "" "Plural-Forms: \n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" @@ -34,6 +45,21 @@ msgstr "" msgid "Company" msgstr "" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" @@ -48,3 +74,29 @@ msgstr "" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" From 0e17eb6588dc2c27518667c98291e36b38f94189 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 1 Nov 2022 13:31:58 +0000 Subject: [PATCH 5/9] sale_brand 15.0.1.0.3 --- sale_brand/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index d6d480274..1f13c4661 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "15.0.1.0.2", + "version": "15.0.1.0.3", "category": "Sales Management", "website": "https://github.com/OCA/brand", "author": "Open Source Integrators, Odoo Community Association (OCA)", From 87863d22ad7f827b16501dba0476ea1c9e60c382 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 1 Nov 2022 13:32:03 +0000 Subject: [PATCH 6/9] [UPD] addons table in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cba2475f..84cd25075 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ addon | version | maintainers | summary [brand_external_report_layout](brand_external_report_layout/) | 15.0.1.0.0 | [![sbejaoui](https://github.com/sbejaoui.png?size=30px)](https://github.com/sbejaoui) | This module allows you to have a different layout by brand for your external reports. [contract_brand](contract_brand/) | 15.0.1.0.0 | [![sbejaoui](https://github.com/sbejaoui.png?size=30px)](https://github.com/sbejaoui) | This module allows you to manage branded contracts. It adds a brand field on the contract and propagate the value on the invoices. [product_brand](product_brand/) | 15.0.1.0.0 | | Product Brand Manager -[sale_brand](sale_brand/) | 15.0.1.0.2 | [![osi-scampbell](https://github.com/osi-scampbell.png?size=30px)](https://github.com/osi-scampbell) [![sbejaoui](https://github.com/sbejaoui.png?size=30px)](https://github.com/sbejaoui) | Send branded sales orders +[sale_brand](sale_brand/) | 15.0.1.0.3 | [![osi-scampbell](https://github.com/osi-scampbell.png?size=30px)](https://github.com/osi-scampbell) [![sbejaoui](https://github.com/sbejaoui.png?size=30px)](https://github.com/sbejaoui) | Send branded sales orders [//]: # (end addons) From 6d283dbfbbe51ce12f35f749119053f7ffb13f12 Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 1 Nov 2022 13:32:11 +0000 Subject: [PATCH 7/9] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: brand-15.0/brand-15.0-sale_brand Translate-URL: https://translation.odoo-community.org/projects/brand-15-0/brand-15-0-sale_brand/ --- sale_brand/i18n/es_AR.po | 52 +++++++++++++++++++++++++++++ sale_brand/i18n/fr_FR.po | 70 +++++++++++++++++++++++++++++++--------- sale_brand/i18n/hr.po | 62 +++++++++++++++++++++++++++++++++++ sale_brand/i18n/it.po | 70 +++++++++++++++++++++++++++++++--------- sale_brand/i18n/nl.po | 62 +++++++++++++++++++++++++++++++++++ sale_brand/i18n/zh_CN.po | 62 +++++++++++++++++++++++++++++++++++ 6 files changed, 348 insertions(+), 30 deletions(-) diff --git a/sale_brand/i18n/es_AR.po b/sale_brand/i18n/es_AR.po index 67f7cf7c1..50f08d9fd 100644 --- a/sale_brand/i18n/es_AR.po +++ b/sale_brand/i18n/es_AR.po @@ -17,6 +17,17 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" @@ -37,6 +48,21 @@ msgstr "Marca a utilizar para este venta" msgid "Company" msgstr "Compañía" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" @@ -51,3 +77,29 @@ msgstr "Pedido de Ventas" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "Equipo de Ventas" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" diff --git a/sale_brand/i18n/fr_FR.po b/sale_brand/i18n/fr_FR.po index 145c368f5..4a8d0eaff 100644 --- a/sale_brand/i18n/fr_FR.po +++ b/sale_brand/i18n/fr_FR.po @@ -17,6 +17,17 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" @@ -38,25 +49,19 @@ msgid "Company" msgstr "Société" #. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_crm_team__display_name -#: model:ir.model.fields,field_description:sale_brand.field_sale_advance_payment_inv__display_name -#: model:ir.model.fields,field_description:sale_brand.field_sale_order__display_name -msgid "Display Name" -msgstr "Nom affiché" +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" #. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_crm_team__id -#: model:ir.model.fields,field_description:sale_brand.field_sale_advance_payment_inv__id -#: model:ir.model.fields,field_description:sale_brand.field_sale_order__id -msgid "ID" -msgstr "ID" +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" #. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_crm_team____last_update -#: model:ir.model.fields,field_description:sale_brand.field_sale_advance_payment_inv____last_update -#: model:ir.model.fields,field_description:sale_brand.field_sale_order____last_update -msgid "Last Modified on" -msgstr "Dernière modif le" +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv @@ -72,3 +77,38 @@ msgstr "Commande de vente" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "Equipe commerciale" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" + +#~ msgid "Display Name" +#~ msgstr "Nom affiché" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Dernière modif le" diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po index ea2dc930a..f91e27cd7 100644 --- a/sale_brand/i18n/hr.po +++ b/sale_brand/i18n/hr.po @@ -18,16 +18,52 @@ msgstr "" "X-Generator: Weblate 3.8\n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "Brand" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_use_level +msgid "Brand Use Level" +msgstr "" + #. module: sale_brand #: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id msgid "Brand to use for this sale" msgstr "Za ovu prodaju koristiti brand" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__company_id +msgid "Company" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" @@ -43,3 +79,29 @@ msgstr "Ponuda" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" diff --git a/sale_brand/i18n/it.po b/sale_brand/i18n/it.po index 7ffc91259..ee7261851 100644 --- a/sale_brand/i18n/it.po +++ b/sale_brand/i18n/it.po @@ -17,6 +17,17 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" @@ -38,25 +49,19 @@ msgid "Company" msgstr "Azienda" #. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_crm_team__display_name -#: model:ir.model.fields,field_description:sale_brand.field_sale_advance_payment_inv__display_name -#: model:ir.model.fields,field_description:sale_brand.field_sale_order__display_name -msgid "Display Name" -msgstr "Nome visualizzato" +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" #. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_crm_team__id -#: model:ir.model.fields,field_description:sale_brand.field_sale_advance_payment_inv__id -#: model:ir.model.fields,field_description:sale_brand.field_sale_order__id -msgid "ID" -msgstr "ID" +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" #. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_crm_team____last_update -#: model:ir.model.fields,field_description:sale_brand.field_sale_advance_payment_inv____last_update -#: model:ir.model.fields,field_description:sale_brand.field_sale_order____last_update -msgid "Last Modified on" -msgstr "Ultima Modifica il" +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv @@ -72,3 +77,38 @@ msgstr "Ordine di vendita" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "Team di Vendita" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima Modifica il" diff --git a/sale_brand/i18n/nl.po b/sale_brand/i18n/nl.po index b04fbfc8d..444112222 100644 --- a/sale_brand/i18n/nl.po +++ b/sale_brand/i18n/nl.po @@ -17,16 +17,52 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "Merk" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_use_level +msgid "Brand Use Level" +msgstr "" + #. module: sale_brand #: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id msgid "Brand to use for this sale" msgstr "Merk te gebruiken voor deze verkoop" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__company_id +msgid "Company" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" @@ -41,3 +77,29 @@ msgstr "" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index 78113808d..1d5794c80 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -17,16 +17,52 @@ msgstr "" "X-Generator: Weblate 3.8\n" #. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain +msgid "Add a Note" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html +msgid "Add a link to a Web Page" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_res_brand #: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "品牌" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_use_level +msgid "Brand Use Level" +msgstr "" + #. module: sale_brand #: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id msgid "Brand to use for this sale" msgstr "品牌用于此次销售" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__company_id +msgid "Company" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms +msgid "Default Terms and Conditions" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Insert your terms & conditions here..." +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url +msgid "Preview terms" +msgstr "" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" @@ -42,3 +78,29 @@ msgstr "销售订单" #: model:ir.model,name:sale_brand.model_crm_team msgid "Sales Team" msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type +msgid "Terms & Conditions format" +msgstr "" + +#. module: sale_brand +#: code:addons/sale_brand/models/sale_order.py:0 +#, python-format +msgid "Terms & Conditions: %s" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page +msgid "Terms Page" +msgstr "" + +#. module: sale_brand +#: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view +msgid "Terms page" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page +msgid "page on the brands site where the terms can be found" +msgstr "" From cff91544f4e62ba923ce86b1e27e58c80a797d72 Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Wed, 2 Nov 2022 03:34:02 +0000 Subject: [PATCH 8/9] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (17 of 17 strings) Translation: brand-15.0/brand-15.0-sale_brand Translate-URL: https://translation.odoo-community.org/projects/brand-15-0/brand-15-0-sale_brand/es_AR/ --- sale_brand/i18n/es_AR.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sale_brand/i18n/es_AR.po b/sale_brand/i18n/es_AR.po index 50f08d9fd..09f7d8e57 100644 --- a/sale_brand/i18n/es_AR.po +++ b/sale_brand/i18n/es_AR.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-09-05 07:07+0000\n" +"PO-Revision-Date: 2022-11-02 05:44+0000\n" "Last-Translator: Ignacio Buioli \n" "Language-Team: none\n" "Language: es_AR\n" @@ -14,17 +14,17 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.14.1\n" #. module: sale_brand #: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__plain msgid "Add a Note" -msgstr "" +msgstr "Añadir una Nota" #. module: sale_brand #: model:ir.model.fields.selection,name:sale_brand.selection__res_brand__terms_type__html msgid "Add a link to a Web Page" -msgstr "" +msgstr "Añadir un vínculo a una Página Web" #. module: sale_brand #: model:ir.model,name:sale_brand.model_res_brand @@ -51,17 +51,17 @@ msgstr "Compañía" #. module: sale_brand #: model:ir.model.fields,field_description:sale_brand.field_res_brand__invoice_terms msgid "Default Terms and Conditions" -msgstr "" +msgstr "Términos y Condiciones Predeterminados" #. module: sale_brand #: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view msgid "Insert your terms & conditions here..." -msgstr "" +msgstr "Inserte sus términos y condiciones acá..." #. module: sale_brand #: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_url msgid "Preview terms" -msgstr "" +msgstr "Previsualización de términos" #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv @@ -81,25 +81,25 @@ msgstr "Equipo de Ventas" #. module: sale_brand #: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_type msgid "Terms & Conditions format" -msgstr "" +msgstr "Formato de Términos y Condiciones" #. module: sale_brand #: code:addons/sale_brand/models/sale_order.py:0 #, python-format msgid "Terms & Conditions: %s" -msgstr "" +msgstr "Términos y Condiciones: %s" #. module: sale_brand #: model:ir.model.fields,field_description:sale_brand.field_res_brand__terms_page msgid "Terms Page" -msgstr "" +msgstr "Página de Términos" #. module: sale_brand #: model_terms:ir.ui.view,arch_db:sale_brand.res_brand_sale_form_view msgid "Terms page" -msgstr "" +msgstr "Página de términos" #. module: sale_brand #: model:ir.model.fields,help:sale_brand.field_res_brand__terms_page msgid "page on the brands site where the terms can be found" -msgstr "" +msgstr "página en el sitio de las marcas donde pueden encontrarse los términos" From e195a98e77c1f8921aba1b28dc2d3bb44b8721ab Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Mon, 10 Oct 2022 16:01:52 +0200 Subject: [PATCH 9/9] [ADD] mail_brand: add brand to mails If mails are send with a brand assigned (for instanse from a sales order) the brand info will be shown instead of the company info. --- mail_brand/README.rst | 84 +++++ mail_brand/__init__.py | 2 + mail_brand/__manifest__.py | 20 ++ mail_brand/controllers/__init__.py | 1 + mail_brand/controllers/main.py | 69 ++++ mail_brand/data/mail_template.xml | 58 ++++ mail_brand/models/__init__.py | 3 + mail_brand/models/ir_model.py | 16 + mail_brand/models/mail_thread.py | 30 ++ mail_brand/models/res_brand.py | 17 + mail_brand/readme/CONTRIBUTORS.rst | 1 + mail_brand/readme/CREDITS.rst | 0 mail_brand/readme/DESCRIPTION.rst | 4 + mail_brand/readme/USAGE.rst | 0 mail_brand/static/description/index.html | 423 +++++++++++++++++++++++ setup/mail_brand/odoo/addons/mail_brand | 1 + setup/mail_brand/setup.py | 6 + 17 files changed, 735 insertions(+) create mode 100644 mail_brand/README.rst create mode 100644 mail_brand/__init__.py create mode 100644 mail_brand/__manifest__.py create mode 100644 mail_brand/controllers/__init__.py create mode 100644 mail_brand/controllers/main.py create mode 100644 mail_brand/data/mail_template.xml create mode 100644 mail_brand/models/__init__.py create mode 100644 mail_brand/models/ir_model.py create mode 100644 mail_brand/models/mail_thread.py create mode 100644 mail_brand/models/res_brand.py create mode 100644 mail_brand/readme/CONTRIBUTORS.rst create mode 100644 mail_brand/readme/CREDITS.rst create mode 100644 mail_brand/readme/DESCRIPTION.rst create mode 100644 mail_brand/readme/USAGE.rst create mode 100644 mail_brand/static/description/index.html create mode 120000 setup/mail_brand/odoo/addons/mail_brand create mode 100644 setup/mail_brand/setup.py diff --git a/mail_brand/README.rst b/mail_brand/README.rst new file mode 100644 index 000000000..c04ae3f8a --- /dev/null +++ b/mail_brand/README.rst @@ -0,0 +1,84 @@ +=========== +Email Brand +=========== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github + :target: https://github.com/OCA/brand/tree/15.0/mail_brand + :alt: OCA/brand +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/brand-15-0/brand-15-0-mail_brand + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/284/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +If a model has a brand defined to it, emails send from this model will be branded accordingly. + +If the brand module gets implemented more broadly this module could need extension to work properly, because not all +odoo modules use the same mail templates + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Gert Pellin / Snakebyte Development + +Contributors +~~~~~~~~~~~~ + +* Gert Pellin + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-switch87| image:: https://github.com/switch87.png?size=40px + :target: https://github.com/switch87 + :alt: switch87 + +Current `maintainer `__: + +|maintainer-switch87| + +This module is part of the `OCA/brand `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_brand/__init__.py b/mail_brand/__init__.py new file mode 100644 index 000000000..91c5580fe --- /dev/null +++ b/mail_brand/__init__.py @@ -0,0 +1,2 @@ +from . import controllers +from . import models diff --git a/mail_brand/__manifest__.py b/mail_brand/__manifest__.py new file mode 100644 index 000000000..d6b35ca4a --- /dev/null +++ b/mail_brand/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Email Brand", + "summary": """ + If a model has a brand defined to it, emails send from this model will be + branded accordingly. If the brand module gets implemented more broadly this + module could need extension to work properly. + """, + "license": "AGPL-3", + "author": "Odoo Community Association (OCA), Gert Pellin / Snakebyte Development", + "website": "https://github.com/OCA/brand", + "version": "15.0.1.0.1", + "depends": ["mail", "brand"], + "data": [ + "data/mail_template.xml", + ], + "maintainers": ["switch87"], +} diff --git a/mail_brand/controllers/__init__.py b/mail_brand/controllers/__init__.py new file mode 100644 index 000000000..12a7e529b --- /dev/null +++ b/mail_brand/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/mail_brand/controllers/main.py b/mail_brand/controllers/main.py new file mode 100644 index 000000000..defa12076 --- /dev/null +++ b/mail_brand/controllers/main.py @@ -0,0 +1,69 @@ +# Copyright (C) 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import base64 +import functools +import io + +import odoo +from odoo import http +from odoo.modules import get_resource_path +from odoo.tools.mimetypes import guess_mimetype + +from odoo.addons.web.controllers.main import Binary + + +class BrandBinary(Binary): + @http.route() + def company_logo(self, dbname=None, **kw): + response = False + imgname = "logo" + imgext = ".png" + uid = None + placeholder = functools.partial(get_resource_path, "web", "static", "img") + if http.request.session.db: + dbname = http.request.session.db + uid = http.request.session.uid + elif dbname is None: + dbname = http.db_monodb() + if not uid: + uid = odoo.SUPERUSER_ID + if not dbname: + response = http.send_file(placeholder(imgname + imgext)) + else: + try: + has_brand = ( + int(kw["has_brand"]) if kw and kw.get("has_brand") else False + ) + if has_brand: + registry = odoo.modules.registry.Registry(dbname) + with registry.cursor() as cr: + brand = int(kw["company"]) + if brand: + cr.execute( + """ + SELECT logo_web, write_date + FROM res_brand + WHERE id = %s + """, + (brand,), + ) + row = cr.fetchone() + if row and row[0]: + image_base64 = base64.b64decode(row[0]) + image_data = io.BytesIO(image_base64) + mimetype = guess_mimetype( + image_base64, default="image/png" + ) + imgext = "." + mimetype.split("/")[1] + if imgext == ".svg+xml": + imgext = ".svg" + response = http.send_file( + image_data, + filename=imgname + imgext, + mimetype=mimetype, + mtime=row[1], + ) + except Exception: + response = http.send_file(placeholder(imgname + imgext)) + return response or super().company_logo(dbname, **kw) diff --git a/mail_brand/data/mail_template.xml b/mail_brand/data/mail_template.xml new file mode 100644 index 000000000..1bdd97e85 --- /dev/null +++ b/mail_brand/data/mail_template.xml @@ -0,0 +1,58 @@ + + + + + + + + + + diff --git a/mail_brand/models/__init__.py b/mail_brand/models/__init__.py new file mode 100644 index 000000000..1fa1f3074 --- /dev/null +++ b/mail_brand/models/__init__.py @@ -0,0 +1,3 @@ +from . import ir_model +from . import res_brand +from . import mail_thread diff --git a/mail_brand/models/ir_model.py b/mail_brand/models/ir_model.py new file mode 100644 index 000000000..0e38a1123 --- /dev/null +++ b/mail_brand/models/ir_model.py @@ -0,0 +1,16 @@ +# Copyright (C) 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class BaseModel(models.AbstractModel): + _inherit = "base" + + def get_base_url(self): + if not self: + return super().get_base_url() + if "brand_id" in self and "website_id" in self.brand_id: + return self.brand_id.website_website_id.domain + else: + return super().get_base_url() diff --git a/mail_brand/models/mail_thread.py b/mail_brand/models/mail_thread.py new file mode 100644 index 000000000..b861d18e6 --- /dev/null +++ b/mail_brand/models/mail_thread.py @@ -0,0 +1,30 @@ +# Copyright (C) 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class MailThread(models.AbstractModel): + _name = "mail.thread" + _inherit = ["mail.thread", "res.brand.mixin"] + + @api.model + def _notify_prepare_template_context( + self, message, msg_vals, model_description=False, mail_auto_delete=True + ): + result = super()._notify_prepare_template_context( + message, msg_vals, model_description, mail_auto_delete + ) + + result["has_brand"] = hasattr(self, "brand_id") + if result["has_brand"]: + result["company"] = self.brand_id + if self.brand_id.website: + result["website_url"] = ( + "https://%s" % self.brand_id.website + if not self.brand_id.website.lower().startswith(("http:", "https:")) + else self.brand_id.website + ) + else: + result["website_url"] = False + return result diff --git a/mail_brand/models/res_brand.py b/mail_brand/models/res_brand.py new file mode 100644 index 000000000..bb2f14dc5 --- /dev/null +++ b/mail_brand/models/res_brand.py @@ -0,0 +1,17 @@ +# Copyright 2022 Snakebyte +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models +from odoo.tools import image_process + + +class ResBrand(models.Model): + + _inherit = "res.brand" + + logo_web = fields.Binary(compute="_compute_logo_web", store=True, attachment=False) + + @api.depends("partner_id.image_1920") + def _compute_logo_web(self): + for brand in self: + brand.logo_web = image_process(brand.partner_id.image_1920, size=(180, 0)) diff --git a/mail_brand/readme/CONTRIBUTORS.rst b/mail_brand/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..aeac835e7 --- /dev/null +++ b/mail_brand/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Gert Pellin diff --git a/mail_brand/readme/CREDITS.rst b/mail_brand/readme/CREDITS.rst new file mode 100644 index 000000000..e69de29bb diff --git a/mail_brand/readme/DESCRIPTION.rst b/mail_brand/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5a12320b1 --- /dev/null +++ b/mail_brand/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +If a model has a brand defined to it, emails send from this model will be branded accordingly. + +If the brand module gets implemented more broadly this module could need extension to work properly, because not all +odoo modules use the same mail templates diff --git a/mail_brand/readme/USAGE.rst b/mail_brand/readme/USAGE.rst new file mode 100644 index 000000000..e69de29bb diff --git a/mail_brand/static/description/index.html b/mail_brand/static/description/index.html new file mode 100644 index 000000000..7b938387b --- /dev/null +++ b/mail_brand/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +Email Brand + + + +
+

Email Brand

+ + +

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

+

If a model has a brand defined to it, emails send from this model will be branded accordingly.

+

If the brand module gets implemented more broadly this module could need extension to work properly, because not all +odoo modules use the same mail templates

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Gert Pellin / Snakebyte Development
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

switch87

+

This module is part of the OCA/brand project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/setup/mail_brand/odoo/addons/mail_brand b/setup/mail_brand/odoo/addons/mail_brand new file mode 120000 index 000000000..a07fbf811 --- /dev/null +++ b/setup/mail_brand/odoo/addons/mail_brand @@ -0,0 +1 @@ +../../../../mail_brand \ No newline at end of file diff --git a/setup/mail_brand/setup.py b/setup/mail_brand/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mail_brand/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)