Allow all level subdivisions on party_addresses

This commit is contained in:
Sergi Almacellas Abellana 2016-06-21 16:17:30 +02:00
parent b4a9857fea
commit 50df14e3f0
2 changed files with 24 additions and 0 deletions

View File

@ -5,10 +5,12 @@
from trytond.pool import Pool
from .country_zip import *
from .address import *
def register():
Pool.register(
Address,
LoadCountryZipsStart,
module='country_zip_es', type_='model')
Pool.register(

22
address.py Normal file
View File

@ -0,0 +1,22 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import PoolMeta
__all__ = ['Address']
class Address:
__metaclass__ = PoolMeta
__name__ = 'party.address'
@classmethod
def __setup__(cls):
super(Address, cls).__setup__()
# Remove domain as we want to be able to select all levels.
# See: https://bugs.tryton.org/issue5563
parent_domain = ('parent', '=', None)
new_domain = []
for clause in cls.subdivision.domain:
if clause != parent_domain:
new_domain.append(clause)
cls.subdivision.domain = new_domain