Skip to content

Commit

Permalink
Merge pull request #14 from eLBati/8.0
Browse files Browse the repository at this point in the history
[ADD] partner_firstname for v8
  • Loading branch information
hbrunn committed Aug 11, 2014
2 parents bf69ae2 + c792e1b commit 332ca70
Show file tree
Hide file tree
Showing 21 changed files with 312 additions and 203 deletions.
113 changes: 0 additions & 113 deletions __unported__/partner_firstname/tests/test_partner_firstname.py

This file was deleted.

19 changes: 13 additions & 6 deletions base_location/better_zip.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Contributor: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
Expand All @@ -18,11 +18,12 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
from openerp.osv import orm, fields


class BetterZip(orm.Model):

" City/locations completion object"

_name = "res.better.zip"
Expand Down Expand Up @@ -57,19 +58,25 @@ def name_get(self, cursor, uid, ids, context=None):
def onchange_state_id(self, cr, uid, ids, state_id=False, context=None):
result = {}
if state_id:
state = self.pool['res.country.state'].browse(cr, uid, state_id, context=context)
state = self.pool['res.country.state'].browse(
cr, uid, state_id, context=context)
if state:
result['value'] = {'country_id': state.country_id.id}
return result

def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
def name_search(
self, cr, uid, name, args=None, operator='ilike', context=None,
limit=100
):
if args is None:
args = []
if context is None:
context = {}
ids = []
if name:
ids = self.search(cr, uid, [('name', 'ilike', name)] + args, limit=limit)
ids = self.search(
cr, uid, [('name', 'ilike', name)] + args, limit=limit)
if not ids:
ids = self.search(cr, uid, [('city', operator, name)] + args, limit=limit)
ids = self.search(
cr, uid, [('city', operator, name)] + args, limit=limit)
return self.name_get(cr, uid, ids, context=context)
26 changes: 14 additions & 12 deletions base_location/company.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Contributor: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
Expand All @@ -18,7 +18,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
from openerp.osv import orm, fields


Expand All @@ -31,17 +31,19 @@ def on_change_city(self, cr, uid, ids, zip_id, context=None):
if context is None:
context = {}
if zip_id:
bzip = self.pool['res.better.zip'].browse(cr, uid, zip_id, context=context)
result = {'value': {'zip': bzip.name,
'country_id': bzip.country_id.id if bzip.country_id else False,
'city': bzip.city,
'state_id': bzip.state_id.id if bzip.state_id else False
}
}
bzip = self.pool['res.better.zip'].browse(
cr, uid, zip_id, context=context)
result = {'value': {
'zip': bzip.name,
'country_id': bzip.country_id.id if bzip.country_id else False,
'city': bzip.city,
'state_id': bzip.state_id.id if bzip.state_id else False
}
}
return result

_columns = {
'better_zip_id': fields.many2one('res.better.zip', 'Location', select=1,
help=('Use the city name or the zip code'
' to search the location')),
'better_zip_id': fields.many2one(
'res.better.zip', 'Location', select=1,
help=('Use the city name or the zip code to search the location')),
}
20 changes: 11 additions & 9 deletions base_location/partner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Contributor: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
Expand All @@ -18,7 +18,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
from openerp.osv import orm, fields


Expand All @@ -31,10 +31,12 @@ def onchange_zip_id(self, cursor, uid, ids, zip_id, context=None):
return {}
if isinstance(zip_id, list):
zip_id = zip_id[0]
bzip = self.pool['res.better.zip'].browse(cursor, uid, zip_id, context=context)
return {'value': {'zip': bzip.name,
'city': bzip.city,
'country_id': bzip.country_id.id if bzip.country_id else False,
'state_id': bzip.state_id.id if bzip.state_id else False,
}
}
bzip = self.pool['res.better.zip'].browse(
cursor, uid, zip_id, context=context)
return {'value': {
'zip': bzip.name,
'city': bzip.city,
'country_id': bzip.country_id.id if bzip.country_id else False,
'state_id': bzip.state_id.id if bzip.state_id else False,
}
}
7 changes: 4 additions & 3 deletions base_location/state.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Contributor: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
Expand All @@ -18,12 +18,13 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
from openerp.osv import orm, fields


class ResCountryState(orm.Model):

_inherit = 'res.country.state'

_columns = {'better_zip_ids': fields.one2many('res.better.zip', 'state_id', 'Cities')}
_columns = {'better_zip_ids': fields.one2many(
'res.better.zip', 'state_id', 'Cities')}
4 changes: 3 additions & 1 deletion base_partner_merge/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
'author': 'OpenERP S.A.',
'category': 'Generic Modules/Base',
'version': '0.1',
'description': """backport module, to be removed when we switch to saas2 on the private servers""",
'description': """
backport module, to be removed when we switch to saas2 on the private servers
""",
'depends': [
'base',
],
Expand Down
65 changes: 41 additions & 24 deletions base_partner_merge/validate_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,51 @@ class ServerError(Exception):
# even when it's not strictly necessary. This way we don't forget
# when it is necessary.)
#
WSP = r'[ \t]' # see 2.2.2. Structured Header Field Bodies
CRLF = r'(?:\r\n)' # see 2.2.3. Long Header Fields
NO_WS_CTL = r'\x01-\x08\x0b\x0c\x0f-\x1f\x7f' # see 3.2.1. Primitive Tokens
QUOTED_PAIR = r'(?:\\.)' # see 3.2.2. Quoted characters
FWS = r'(?:(?:{0}*{1})?{0}+)'.format(WSP, CRLF) # see 3.2.3. Folding white space and comments
CTEXT = r'[{0}\x21-\x27\x2a-\x5b\x5d-\x7e]'.format(NO_WS_CTL) # see 3.2.3
# see 3.2.3 (NB: The RFC includes COMMENT here as well, but that would be circular.)
WSP = r'[ \t]' # see 2.2.2. Structured Header Field Bodies
CRLF = r'(?:\r\n)' # see 2.2.3. Long Header Fields
NO_WS_CTL = r'\x01-\x08\x0b\x0c\x0f-\x1f\x7f' # see 3.2.1. Primitive Tokens
QUOTED_PAIR = r'(?:\\.)' # see 3.2.2. Quoted characters
FWS = r'(?:(?:{0}*{1})?{0}+)'.format(WSP, CRLF)
# see 3.2.3. Folding white space and comments
CTEXT = r'[{0}\x21-\x27\x2a-\x5b\x5d-\x7e]'.format(
NO_WS_CTL) # see 3.2.3
# see 3.2.3 (NB: The RFC includes COMMENT here as well, but that would be
# circular.)
CCONTENT = r'(?:{0}|{1})'.format(CTEXT, QUOTED_PAIR)
COMMENT = r'\((?:{0}?{1})*{0}?\)'.format(FWS, CCONTENT) # see 3.2.3
CFWS = r'(?:{0}?{1})*(?:{0}?{1}|{0})'.format(FWS, COMMENT) # see 3.2.3
ATEXT = r'[\w!#$%&\'\*\+\-/=\?\^`\{\|\}~]' # see 3.2.4. Atom
ATOM = r'{0}?{1}+{0}?'.format(CFWS, ATEXT) # see 3.2.4
DOT_ATOM_TEXT = r'{0}+(?:\.{0}+)*'.format(ATEXT) # see 3.2.4
DOT_ATOM = r'{0}?{1}{0}?'.format(CFWS, DOT_ATOM_TEXT) # see 3.2.4
QTEXT = r'[{0}\x21\x23-\x5b\x5d-\x7e]'.format(NO_WS_CTL) # see 3.2.5. Quoted strings
QCONTENT = r'(?:{0}|{1})'.format(QTEXT, QUOTED_PAIR) # see 3.2.5
COMMENT = r'\((?:{0}?{1})*{0}?\)'.format(
FWS, CCONTENT) # see 3.2.3
CFWS = r'(?:{0}?{1})*(?:{0}?{1}|{0})'.format(
FWS, COMMENT) # see 3.2.3
ATEXT = r'[\w!#$%&\'\*\+\-/=\?\^`\{\|\}~]' # see 3.2.4. Atom
ATOM = r'{0}?{1}+{0}?'.format(CFWS, ATEXT)
# see 3.2.4
DOT_ATOM_TEXT = r'{0}+(?:\.{0}+)*'.format(
ATEXT) # see 3.2.4
DOT_ATOM = r'{0}?{1}{0}?'.format(
CFWS, DOT_ATOM_TEXT) # see 3.2.4
QTEXT = r'[{0}\x21\x23-\x5b\x5d-\x7e]'.format(
NO_WS_CTL) # see 3.2.5. Quoted strings
QCONTENT = r'(?:{0}|{1})'.format(QTEXT, QUOTED_PAIR)
# see 3.2.5
QUOTED_STRING = r'{0}?"(?:{1}?{2})*{1}?"{0}?'.format(CFWS, FWS, QCONTENT)
LOCAL_PART = r'(?:{0}|{1})'.format(DOT_ATOM, QUOTED_STRING) # see 3.4.1. Addr-spec specification
DTEXT = r'[{0}\x21-\x5a\x5e-\x7e]'.format(NO_WS_CTL) # see 3.4.1
DCONTENT = r'(?:{0}|{1})'.format(DTEXT, QUOTED_PAIR) # see 3.4.1
DOMAIN_LITERAL = r'{0}?\[(?:{1}?{2})*{1}?\]{0}?'.format(CFWS, FWS, DCONTENT) # see 3.4.1
DOMAIN = r'(?:{0}|{1})'.format(DOT_ATOM, DOMAIN_LITERAL) # see 3.4.1
ADDR_SPEC = r'{0}@{1}'.format(LOCAL_PART, DOMAIN) # see 3.4.1
LOCAL_PART = r'(?:{0}|{1})'.format(DOT_ATOM, QUOTED_STRING)
# see 3.4.1. Addr-spec specification
DTEXT = r'[{0}\x21-\x5a\x5e-\x7e]'.format(
NO_WS_CTL) # see 3.4.1
DCONTENT = r'(?:{0}|{1})'.format(DTEXT, QUOTED_PAIR)
# see 3.4.1
DOMAIN_LITERAL = r'{0}?\[(?:{1}?{2})*{1}?\]{0}?'.format(
CFWS, FWS, DCONTENT) # see 3.4.1
DOMAIN = r'(?:{0}|{1})'.format(DOT_ATOM, DOMAIN_LITERAL)
# see 3.4.1
ADDR_SPEC = r'{0}@{1}'.format(
LOCAL_PART, DOMAIN) # see 3.4.1

# A valid address will match exactly the 3.4.1 addr-spec.
VALID_ADDRESS_REGEXP = '^' + ADDR_SPEC + '$'


def validate_email(email, check_mx=False, verify=False):

"""Indicate whether the given string is a valid email address
according to the 'addr-spec' portion of RFC 2822 (see section
3.4.1). Parts of the spec that are marked obsolete are *not*
Expand Down Expand Up @@ -104,7 +119,8 @@ def validate_email(email, check_mx=False, verify=False):
if status != 250:
return False
break
except smtplib.SMTPServerDisconnected: # Server not permits verify user
except smtplib.SMTPServerDisconnected:
# Server not permits verify user
break
except smtplib.SMTPConnectError:
continue
Expand All @@ -114,5 +130,6 @@ def validate_email(email, check_mx=False, verify=False):

# import sys

# sys.modules[__name__], sys.modules['validate_email_module'] = validate_email, sys.modules[__name__]
# sys.modules[__name__], sys.modules['validate_email_module'] = validate_email,
# sys.modules[__name__]
# from validate_email_module import *
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
This module splits first name and last name for non company partners
====================================================================
The field 'name' becomes a stored function field concatenating lastname and firstname
Note: in version 7.0, installing this module invalidates a yaml test in the 'edi' module
The field 'name' becomes a stored function field concatenating lastname and
firstname
Note: in version 7.0, installing this module invalidates a yaml test in the
'edi' module
Contributors
============
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 332ca70

Please sign in to comment.