Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] partner helper + rename it partner_address_split #1543

Merged
merged 27 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8b7a593
[ADD] partner_helper module
bealdav Nov 5, 2014
e39b61a
Add OCA as author of OCA addons
gurneyalex Mar 2, 2015
63c8596
Add missing default oca icons
yvaucher Aug 18, 2015
45f1e71
OCA Transbot updated translations from Transifex
oca-transbot Sep 1, 2015
65c50c9
OCA Transbot updated translations from Transifex
oca-transbot Oct 5, 2015
4393a28
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
69d1116
OCA Transbot updated translations from Transifex
oca-transbot Oct 11, 2015
60ead3c
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
9b4b5da
[FIX] remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
bc42288
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
351f910
[MIG] partner_helper: Migration to 10.0 (#386)
EBII Apr 5, 2017
7a223aa
OCA Transbot updated translations from Transifex
oca-transbot May 1, 2017
289b6d5
MIGR partner_helper: to v12
bealdav Jun 12, 2019
3231951
[UPD] README.rst
OCA-git-bot Jun 14, 2019
9f1f81b
[UPD] Update partner_helper.pot
oca-travis Jun 14, 2019
cbe6fab
Update translation files
oca-transbot Jun 29, 2019
1eacbd3
[UPD] README.rst
OCA-git-bot Jul 29, 2019
fc4b9fc
Translated using Weblate (Croatian)
badbole Nov 18, 2019
8adabd2
[IMP] partner_helper: black, isort, prettier
florian-dacosta Dec 8, 2020
e8d3fe2
[MIG] partner_helper: Migration to 14.0
florian-dacosta Dec 8, 2020
8f753bf
[UPD] Update partner_helper.pot
oca-travis May 19, 2021
64805d7
[UPD] README.rst
OCA-git-bot May 19, 2021
cccfc98
Update translation files
oca-transbot May 19, 2021
a2d17a0
Translated using Weblate (Portuguese (Brazil))
Feb 1, 2022
c592ddf
[IMP] partner_contact : precommit stuff
florian-dacosta Nov 23, 2022
f16aaec
[MIG] Migrate partner_helper to v16
florian-dacosta Nov 23, 2022
b4f7d61
[IMP] Rename partner_helper to partner_address_split + add some tests
florian-dacosta Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions partner_address_split/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
==============
Partner Helper
==============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/14.0/partner_helper
: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-14-0/partner-contact-14-0-partner_helper
: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/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

The purpose of this module is to gather generic partner methods.
It avoids to grow up excessively the number of modules in Odoo
for small features.

Add methods to Partner model like `_get_split_address()`

This method allows to get a number of street fields according to
your choice. 2 fields by default in Odoo with 128 width chars.
In some countries you have constraints on width of street fields and you
should use 3 or 4 shorter fields.
You also need of this feature to avoid headache with overflow printing task

**Table of contents**

.. contents::
:local:

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_helper%0Aversion:%2014.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
~~~~~~~

* Akretion

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

* Akretion:

* Sébastien Beau <[email protected]>

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/14.0/partner_helper>`_ 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_split/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions partner_address_split/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Author: Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Partner Address Split",
"version": "16.0.1.0.0",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainer": "Akretion",
"category": "Warehouse",
"depends": [
"base",
],
"summary": "Add specific helper methods",
"website": "https://github.com/OCA/partner-contact",
"installable": True,
"auto_install": False,
"license": "AGPL-3",
}
1 change: 1 addition & 0 deletions partner_address_split/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import partner
48 changes: 48 additions & 0 deletions partner_address_split/models/partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (C) 2016 Akretion (http://www.akretion.com)
# Author: Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


def split_char(char, output_number, size):
words = char.split(" ")
result = []
word = words.pop(0)
for index in range(0, output_number):
result.append(word)
word = ""
while len(words) > 0:
word = words.pop(0)
if len(result[index] + " %s" % word) > size:
break
else:
result[index] += " %s" % word
word = ""
return result


class ResPartner(models.Model):
_inherit = "res.partner"

def _get_split_address(self, output_number, max_size):
"""This method allows to get a number of street fields according to
your choice. Default is 2 large fields in Odoo (128 chars).
In some countries you may use 3 or 4 shorter street fields.

example:
res = self.partner_id._get_split_address(3, 35)
street1, street2, street3 = res
"""
self.ensure_one()
street = self.street or ""
street2 = self.street2 or ""
if len(street) <= max_size and len(street2) <= max_size:
result = ["" for i in range(0, output_number)]
result[0] = street
result[1] = street2
return result
elif len(street) <= max_size:
return [street] + split_char(street2, output_number - 1, max_size)
else:
return split_char("{} {}".format(street, street2), output_number, max_size)
3 changes: 3 additions & 0 deletions partner_address_split/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Akretion:

* Sébastien Beau <[email protected]>
9 changes: 9 additions & 0 deletions partner_address_split/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The purpose of this module is to gather generic method to spliit address.

Add methods to Partner model like `_get_split_address()`

This method allows to get a number of street fields according to
your choice. 2 fields by default in Odoo with 128 width chars.
In some countries you have constraints on width of street fields and you
should use 3 or 4 shorter fields.
You also need of this feature to avoid headache with overflow printing task
Binary file added partner_address_split/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading