[MERGE] forward port branch 11.0 up to 7742887e96
This commit is contained in:
@@ -1389,7 +1389,8 @@ class AccountPartialReconcile(models.Model):
|
||||
move_date = self.debit_move_id.date
|
||||
newly_created_move = self.env['account.move']
|
||||
with self.env.norecompute():
|
||||
for move in (self.debit_move_id.move_id, self.credit_move_id.move_id):
|
||||
# We use a set here in case the reconciled lines belong to the same move (it happens with POS)
|
||||
for move in {self.debit_move_id.move_id, self.credit_move_id.move_id}:
|
||||
#move_date is the max of the 2 reconciled items
|
||||
if move_date < move.date:
|
||||
move_date = move.date
|
||||
|
||||
@@ -257,13 +257,11 @@ class account_register_payments(models.TransientModel):
|
||||
'''
|
||||
amount = self._compute_payment_amount(invoices=invoices) if self.multi else self.amount
|
||||
payment_type = ('inbound' if amount > 0 else 'outbound') if self.multi else self.payment_type
|
||||
communication = (' '.join([inv.reference or inv.number for inv in invoices])
|
||||
if self.multi else self.communication)
|
||||
return {
|
||||
'journal_id': self.journal_id.id,
|
||||
'payment_method_id': self.payment_method_id.id,
|
||||
'payment_date': self.payment_date,
|
||||
'communication': communication, # DO NOT FORWARD PORT TO V12 OR ABOVE
|
||||
'communication': self.communication, # DO NOT FORWARD PORT TO V12 OR ABOVE
|
||||
'invoice_ids': [(6, 0, invoices.ids)],
|
||||
'payment_type': payment_type,
|
||||
'amount': abs(amount),
|
||||
|
||||
@@ -241,7 +241,7 @@ class Lead(models.Model):
|
||||
return {}
|
||||
if user_id and self._context.get('team_id'):
|
||||
team = self.env['crm.team'].browse(self._context['team_id'])
|
||||
if user_id in team.member_ids.ids:
|
||||
if user_id in team.member_ids.ids or user_id == team.user_id.id:
|
||||
return {}
|
||||
team_id = self.env['crm.team']._get_default_team_id(user_id=user_id)
|
||||
return {'team_id': team_id}
|
||||
|
||||
@@ -43,7 +43,7 @@ def _guess_mimetype(ext=False, default='text/html'):
|
||||
return ext is not False and exts.get(ext, default) or exts
|
||||
|
||||
|
||||
def slugify_one(s, max_length=None):
|
||||
def slugify_one(s, max_length=0):
|
||||
""" Transform a string to a slug that can be used in a url path.
|
||||
This method will first try to do the job with python-slugify if present.
|
||||
Otherwise it will process string by stripping leading and ending spaces,
|
||||
@@ -61,13 +61,12 @@ def slugify_one(s, max_length=None):
|
||||
except TypeError:
|
||||
pass
|
||||
uni = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore').decode('ascii')
|
||||
slug_str = re.sub('[\W_]', ' ', uni).strip().lower()
|
||||
slug_str = re.sub('[-\s]+', '-', slug_str)
|
||||
|
||||
return slug_str[:max_length]
|
||||
slug_str = re.sub(r'[\W_]', ' ', uni).strip().lower()
|
||||
slug_str = re.sub(r'[-\s]+', '-', slug_str)
|
||||
return slug_str[:max_length] if max_length > 0 else slug_str
|
||||
|
||||
|
||||
def slugify(s, max_length=None, path=False):
|
||||
def slugify(s, max_length=0, path=False):
|
||||
if not path:
|
||||
return slugify_one(s, max_length=max_length)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user