[MERGE] forward port branch 10.0 up to 544aa9b04a
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 !')]
|
||||
|
||||
@api.one
|
||||
@api.depends('name', 'location_id')
|
||||
@api.depends('name', 'location_id.name')
|
||||
def _compute_complete_name(self):
|
||||
""" Forms complete name of location from parent location to child location. """
|
||||
name = self.name
|
||||
|
||||
@@ -226,7 +226,7 @@ class WebsiteEventController(http.Controller):
|
||||
def registration_new(self, event, **post):
|
||||
tickets = self._process_tickets_details(post)
|
||||
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})
|
||||
|
||||
def _process_registration_details(self, details):
|
||||
|
||||
@@ -358,7 +358,8 @@ class WebsiteSale(http.Controller):
|
||||
values['suggested_products'] = _order._cart_accessories()
|
||||
|
||||
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)
|
||||
|
||||
|
||||
+2
-1
@@ -568,7 +568,7 @@ class Field(object):
|
||||
""" Traverse the fields of the related field `self` except for the last
|
||||
one, and return it as a pair `(last_record, last_field)`. """
|
||||
for name in self.related[:-1]:
|
||||
record = record[name][:1]
|
||||
record = record[name][:1].with_prefetch(record._prefetch)
|
||||
return record, self.related_field
|
||||
|
||||
def _compute_related(self, records):
|
||||
@@ -981,6 +981,7 @@ class Field(object):
|
||||
self.compute_value(record)
|
||||
else:
|
||||
recs = record._in_cache_without(self)
|
||||
recs = recs.with_prefetch(record._prefetch)
|
||||
self.compute_value(recs)
|
||||
|
||||
else:
|
||||
|
||||
+8
-9
@@ -3070,10 +3070,6 @@ class BaseModel(object):
|
||||
else:
|
||||
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()
|
||||
assert self in records and field in fs
|
||||
records = records.with_prefetch(self._prefetch)
|
||||
@@ -5195,13 +5191,16 @@ class BaseModel(object):
|
||||
return RecordCache(self)
|
||||
|
||||
@api.model
|
||||
def _in_cache_without(self, field):
|
||||
""" Make sure ``self`` is present in cache (for prefetching), and return
|
||||
the records of model ``self`` in cache that have no value for ``field``
|
||||
(:class:`Field` instance).
|
||||
def _in_cache_without(self, field, limit=PREFETCH_MAX):
|
||||
""" Return records to prefetch that have no value in cache for ``field``
|
||||
(:class:`Field` instance), including ``self``.
|
||||
Return at most ``limit`` records.
|
||||
"""
|
||||
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
|
||||
def refresh(self):
|
||||
|
||||
Reference in New Issue
Block a user