forked from Yaltik/golem
Remove number from street before saving it or extracting it from Territories
This commit is contained in:
parent
3764bb0f9e
commit
fc943bf71e
@ -19,6 +19,7 @@
|
||||
""" GOLEM Members """
|
||||
|
||||
import logging
|
||||
import re
|
||||
from datetime import date, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo import models, fields, api, _
|
||||
@ -161,6 +162,8 @@ class ResPartner(models.Model):
|
||||
for member in self:
|
||||
if member.street and not member.area_from_street:
|
||||
mstreet = member.street.strip()
|
||||
p = re.compile(r'^\d+')
|
||||
mstreet = p.sub('', mstreet).strip()
|
||||
street_id = self.env['golem.partner.area.street'].search(
|
||||
[('name', 'ilike', mstreet)]
|
||||
)
|
||||
@ -274,6 +277,8 @@ class GolemMember(models.Model):
|
||||
for member in self:
|
||||
mstreet = member.street.strip() if member.street else False
|
||||
if mstreet and not member.area_id:
|
||||
p = re.compile(r'^\d+')
|
||||
mstreet = p.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