[MERGE] forward port branch saas-14 up to a2361e23ea
This commit is contained in:
@@ -69,7 +69,7 @@ class Location(models.Model):
|
|||||||
_sql_constraints = [('barcode_company_uniq', 'unique (barcode,company_id)', 'The barcode for a location must be unique per company !')]
|
_sql_constraints = [('barcode_company_uniq', 'unique (barcode,company_id)', 'The barcode for a location must be unique per company !')]
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.depends('name', 'location_id')
|
@api.depends('name', 'location_id.name')
|
||||||
def _compute_complete_name(self):
|
def _compute_complete_name(self):
|
||||||
""" Forms complete name of location from parent location to child location. """
|
""" Forms complete name of location from parent location to child location. """
|
||||||
name = self.name
|
name = self.name
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ class WebsiteEventController(http.Controller):
|
|||||||
def registration_new(self, event, **post):
|
def registration_new(self, event, **post):
|
||||||
tickets = self._process_tickets_details(post)
|
tickets = self._process_tickets_details(post)
|
||||||
if not tickets:
|
if not tickets:
|
||||||
return request.redirect("/event/%s" % slug(event))
|
return False
|
||||||
return request.env['ir.ui.view'].render_template("website_event.registration_attendee_details", {'tickets': tickets, 'event': event})
|
return request.env['ir.ui.view'].render_template("website_event.registration_attendee_details", {'tickets': tickets, 'event': event})
|
||||||
|
|
||||||
def _process_registration_details(self, details):
|
def _process_registration_details(self, details):
|
||||||
|
|||||||
@@ -364,7 +364,8 @@ class WebsiteSale(http.Controller):
|
|||||||
values['suggested_products'] = _order._cart_accessories()
|
values['suggested_products'] = _order._cart_accessories()
|
||||||
|
|
||||||
if post.get('type') == 'popover':
|
if post.get('type') == 'popover':
|
||||||
return request.render("website_sale.cart_popover", values)
|
# force no-cache so IE11 doesn't cache this XHR
|
||||||
|
return request.render("website_sale.cart_popover", values, headers={'Cache-Control': 'no-cache'})
|
||||||
|
|
||||||
return request.render("website_sale.cart", values)
|
return request.render("website_sale.cart", values)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -555,7 +555,7 @@ class Field(object):
|
|||||||
""" Traverse the fields of the related field `self` except for the last
|
""" Traverse the fields of the related field `self` except for the last
|
||||||
one, and return it as a pair `(last_record, last_field)`. """
|
one, and return it as a pair `(last_record, last_field)`. """
|
||||||
for name in self.related[:-1]:
|
for name in self.related[:-1]:
|
||||||
record = record[name][:1]
|
record = record[name][:1].with_prefetch(record._prefetch)
|
||||||
return record, self.related_field
|
return record, self.related_field
|
||||||
|
|
||||||
def _compute_related(self, records):
|
def _compute_related(self, records):
|
||||||
@@ -1020,6 +1020,7 @@ class Field(object):
|
|||||||
self.compute_value(record)
|
self.compute_value(record)
|
||||||
else:
|
else:
|
||||||
recs = record._in_cache_without(self)
|
recs = record._in_cache_without(self)
|
||||||
|
recs = recs.with_prefetch(record._prefetch)
|
||||||
self.compute_value(recs)
|
self.compute_value(recs)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
+8
-9
@@ -2555,10 +2555,6 @@ class BaseModel(object):
|
|||||||
else:
|
else:
|
||||||
records &= self._in_cache_without(f)
|
records &= self._in_cache_without(f)
|
||||||
|
|
||||||
# prefetch at most PREFETCH_MAX records
|
|
||||||
if len(records) > PREFETCH_MAX:
|
|
||||||
records = records[:PREFETCH_MAX] | self
|
|
||||||
|
|
||||||
# fetch records with read()
|
# fetch records with read()
|
||||||
assert self in records and field in fs
|
assert self in records and field in fs
|
||||||
records = records.with_prefetch(self._prefetch)
|
records = records.with_prefetch(self._prefetch)
|
||||||
@@ -4683,13 +4679,16 @@ class BaseModel(object):
|
|||||||
return RecordCache(self)
|
return RecordCache(self)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _in_cache_without(self, field):
|
def _in_cache_without(self, field, limit=PREFETCH_MAX):
|
||||||
""" Make sure ``self`` is present in cache (for prefetching), and return
|
""" Return records to prefetch that have no value in cache for ``field``
|
||||||
the records of model ``self`` in cache that have no value for ``field``
|
(:class:`Field` instance), including ``self``.
|
||||||
(:class:`Field` instance).
|
Return at most ``limit`` records.
|
||||||
"""
|
"""
|
||||||
ids = filter(None, self._prefetch[self._name] - set(self.env.cache[field]))
|
ids = filter(None, self._prefetch[self._name] - set(self.env.cache[field]))
|
||||||
return self.browse(ids)
|
recs = self.browse(ids)
|
||||||
|
if limit and len(recs) > limit:
|
||||||
|
recs = self + (recs - self)[:(limit - len(self))]
|
||||||
|
return recs
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user