Skip to content

Commit

Permalink
Merge 9a23821 into 3c6350d
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonow-c2c committed Feb 3, 2020
2 parents 3c6350d + 9a23821 commit 2cdb540
Show file tree
Hide file tree
Showing 10 changed files with 572 additions and 0 deletions.
81 changes: 81 additions & 0 deletions 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 <https://github.com/OCA/partner-contact/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 <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_address_two_lines%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Camptocamp

Contributors
~~~~~~~~~~~~

* Thomas Nowicki <thomas.nowicki@camptocamp.com>
* Akim Juillerat <akim.juillerat@camptocamp.com>

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 <https://github.com/OCA/partner-contact/tree/10.0/partner_address_two_lines>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions partner_address_two_lines/__init__.py
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions 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,
}
2 changes: 2 additions & 0 deletions partner_address_two_lines/models/__init__.py
@@ -0,0 +1,2 @@
from . import report
from . import res_partner
20 changes: 20 additions & 0 deletions 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)
17 changes: 17 additions & 0 deletions 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)
2 changes: 2 additions & 0 deletions partner_address_two_lines/readme/CONTRIBUTORS.rst
@@ -0,0 +1,2 @@
* Thomas Nowicki <thomas.nowicki@camptocamp.com>
* Akim Juillerat <akim.juillerat@camptocamp.com>
2 changes: 2 additions & 0 deletions 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.
2 changes: 2 additions & 0 deletions 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

0 comments on commit 2cdb540

Please sign in to comment.