forked from Yaltik/golem
Merge branch 'master' into analysis
This commit is contained in:
commit
953d0bca3d
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2016-2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2016-2019 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2018 Michel Dessenne <michel@yaltik.com>
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
'name': 'GOLEM non-profit members',
|
||||
'summary': 'Extends Odoo contacts for MJC',
|
||||
'description': 'Extends Odoo contacts for MJC',
|
||||
'version': '10.0.2.5.0',
|
||||
'version': '10.0.2.5.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Fabien Bourgeois, Michel Dessenne',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2016-2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2016-2019 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@ -19,12 +19,16 @@
|
||||
""" GOLEM Members """
|
||||
|
||||
import logging
|
||||
from re import compile as rcompile
|
||||
from datetime import date, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
street_number = rcompile(r'^(\d-?(bis)*(ter)*,?\s*)+')
|
||||
|
||||
def get_root_area(area_id):
|
||||
""" Get root area """
|
||||
if not area_id.parent_id:
|
||||
@ -161,6 +165,7 @@ class ResPartner(models.Model):
|
||||
for member in self:
|
||||
if member.street and not member.area_from_street:
|
||||
mstreet = member.street.strip()
|
||||
mstreet = street_number.sub(u'', mstreet).strip()
|
||||
street_id = self.env['golem.partner.area.street'].search(
|
||||
[('name', 'ilike', mstreet)]
|
||||
)
|
||||
@ -274,6 +279,7 @@ class GolemMember(models.Model):
|
||||
for member in self:
|
||||
mstreet = member.street.strip() if member.street else False
|
||||
if mstreet and not member.area_id:
|
||||
mstreet = street_number.sub('', mstreet).strip()
|
||||
street_id = self.env['golem.partner.area.street'].search(
|
||||
[('name', 'ilike', mstreet)], limit=1
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user