From 9a238217f294331f2f7bd542f9abf6642048f4e6 Mon Sep 17 00:00:00 2001 From: Tonow-c2c Date: Mon, 3 Feb 2020 11:51:12 +0100 Subject: [PATCH] [ADD][10.0] add partner_address_two_lines module --- partner_address_two_lines/README.rst | 81 ++++ partner_address_two_lines/__init__.py | 1 + partner_address_two_lines/__manifest__.py | 18 + partner_address_two_lines/models/__init__.py | 2 + partner_address_two_lines/models/report.py | 20 + .../models/res_partner.py | 17 + .../readme/CONTRIBUTORS.rst | 2 + .../readme/DESCRIPTION.rst | 2 + partner_address_two_lines/readme/INSTALL.rst | 2 + .../static/description/index.html | 427 ++++++++++++++++++ 10 files changed, 572 insertions(+) create mode 100644 partner_address_two_lines/README.rst create mode 100644 partner_address_two_lines/__init__.py create mode 100644 partner_address_two_lines/__manifest__.py create mode 100644 partner_address_two_lines/models/__init__.py create mode 100644 partner_address_two_lines/models/report.py create mode 100644 partner_address_two_lines/models/res_partner.py create mode 100644 partner_address_two_lines/readme/CONTRIBUTORS.rst create mode 100644 partner_address_two_lines/readme/DESCRIPTION.rst create mode 100644 partner_address_two_lines/readme/INSTALL.rst create mode 100644 partner_address_two_lines/static/description/index.html diff --git a/partner_address_two_lines/README.rst b/partner_address_two_lines/README.rst new file mode 100644 index 000000000000..c56ca7d8b5e1 --- /dev/null +++ b/partner_address_two_lines/README.rst @@ -0,0 +1,81 @@ +============================ +Partner address in two lines +============================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/10.0/partner_address_two_lines + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-10-0/partner-contact-10-0-partner_address_two_lines + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/10.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module changes the reports layout. +The company partner and the partner name are on two different lines. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +To install this module, you need to: +* Add https://github.com/OCA/OCB/pull/903 and https://github.com/OCA/OCB/pull/904 + +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 +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Thomas Nowicki +* Akim Juillerat + +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. + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_address_two_lines/__init__.py b/partner_address_two_lines/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/partner_address_two_lines/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_address_two_lines/__manifest__.py b/partner_address_two_lines/__manifest__.py new file mode 100644 index 000000000000..f08523040195 --- /dev/null +++ b/partner_address_two_lines/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Partner address in two lines", + "version": "10.0.1.0.0", + "summary": "The company and the partner name are on two different lines", + "author": "Camptocamp," "Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Partner", + "website": "http://github.com/OCA/partner-contact", + "depends": [ + "base", + "report", + ], + "installable": True, + "auto_install": False, +} diff --git a/partner_address_two_lines/models/__init__.py b/partner_address_two_lines/models/__init__.py new file mode 100644 index 000000000000..600ede46e68e --- /dev/null +++ b/partner_address_two_lines/models/__init__.py @@ -0,0 +1,2 @@ +from . import report +from . import res_partner diff --git a/partner_address_two_lines/models/report.py b/partner_address_two_lines/models/report.py new file mode 100644 index 000000000000..e9447ea90d39 --- /dev/null +++ b/partner_address_two_lines/models/report.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class Report(models.Model): + _inherit = "report" + + @api.multi + def render(self, template, values=None): + """ Set context key to split partner address on two line only on report + """ + if values is not None: + values['docs'] = values.get('docs').with_context( + _two_lines_partner_address=True + ) + + return super(Report, self).render(template, values) diff --git a/partner_address_two_lines/models/res_partner.py b/partner_address_two_lines/models/res_partner.py new file mode 100644 index 000000000000..1836935bdc8b --- /dev/null +++ b/partner_address_two_lines/models/res_partner.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + def _get_contact_name(self, partner, name): + if self.env.context.get("_two_lines_partner_address"): + return "{}\n {}".format( + partner.commercial_company_name or partner.parent_id.name, name + ) + else: + return super(ResPartner, self)._get_contact_name(partner, name) diff --git a/partner_address_two_lines/readme/CONTRIBUTORS.rst b/partner_address_two_lines/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..26b8c9131ce6 --- /dev/null +++ b/partner_address_two_lines/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Thomas Nowicki +* Akim Juillerat diff --git a/partner_address_two_lines/readme/DESCRIPTION.rst b/partner_address_two_lines/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..78f3a8c98dc4 --- /dev/null +++ b/partner_address_two_lines/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module changes the reports layout. +The company partner and the partner name are on two different lines. diff --git a/partner_address_two_lines/readme/INSTALL.rst b/partner_address_two_lines/readme/INSTALL.rst new file mode 100644 index 000000000000..13210d7d225c --- /dev/null +++ b/partner_address_two_lines/readme/INSTALL.rst @@ -0,0 +1,2 @@ +To install this module, you need to: +* Add https://github.com/OCA/OCB/pull/903 and https://github.com/OCA/OCB/pull/904 diff --git a/partner_address_two_lines/static/description/index.html b/partner_address_two_lines/static/description/index.html new file mode 100644 index 000000000000..06e729844d38 --- /dev/null +++ b/partner_address_two_lines/static/description/index.html @@ -0,0 +1,427 @@ + + + + + + +Partner address in two lines + + + +
+

Partner address in two lines

+ + +

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

+

This module changes the reports layout. +The company partner and the partner name are on two different lines.

+

Table of contents

+ +
+

Installation

+

To install this module, you need to: +* Add https://github.com/OCA/OCB/pull/903 and https://github.com/OCA/OCB/pull/904

+
+
+

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

+
    +
  • Camptocamp
  • +
+
+ +
+

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.

+

This module is part of the OCA/partner-contact project on GitHub.

+

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

+
+
+
+ +