[MERGE] forward port of branch saas-6 up to d5dcfcb
This commit is contained in:
@@ -1681,7 +1681,9 @@ class calendar_event(osv.Model):
|
||||
continue
|
||||
if r['class'] == 'private':
|
||||
for f in r.keys():
|
||||
if f not in ('id', 'allday', 'start', 'stop', 'duration', 'user_id', 'state', 'interval', 'count', 'recurrent_id_date', 'rrule'):
|
||||
recurrent_fields = self._get_recurrent_fields(cr, uid, context=context)
|
||||
public_fields = list(set(recurrent_fields + ['id', 'allday', 'start', 'stop', 'duration', 'user_id', 'state', 'interval', 'count', 'recurrent_id_date', 'rrule']))
|
||||
if f not in public_fields:
|
||||
if isinstance(r[f], list):
|
||||
r[f] = []
|
||||
else:
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import datetime
|
||||
import pytz
|
||||
import time
|
||||
from openerp import tools
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
@@ -28,7 +31,22 @@ class pos_details(report_sxw.rml_parse):
|
||||
result = {}
|
||||
user_ids = form['user_ids'] or self._get_all_users()
|
||||
company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
|
||||
pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('state','in',['done','paid','invoiced']),('company_id','=',company_id)])
|
||||
user = self.pool['res.users'].browse(self.cr, self.uid, self.uid) or self.localcontext.get('tz') or 'UTC'
|
||||
tz_name = user.tz
|
||||
user_tz = pytz.timezone(tz_name)
|
||||
between_dates = {}
|
||||
for date_field, delta in {'date_start': {'days': 0}, 'date_end': {'days': 1}}.items():
|
||||
timestamp = datetime.datetime.strptime(form[date_field] + ' 00:00:00', tools.DEFAULT_SERVER_DATETIME_FORMAT) + datetime.timedelta(**delta)
|
||||
timestamp = user_tz.localize(timestamp).astimezone(pytz.utc)
|
||||
between_dates[date_field] = timestamp.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
|
||||
pos_ids = pos_obj.search(self.cr, self.uid, [
|
||||
('date_order', '>=', between_dates['date_start']),
|
||||
('date_order', '<', between_dates['date_end']),
|
||||
('user_id', 'in', user_ids),
|
||||
('state', 'in', ['done', 'paid', 'invoiced']),
|
||||
('company_id', '=', company_id)
|
||||
])
|
||||
for pos in pos_obj.browse(self.cr, self.uid, pos_ids, context=self.localcontext):
|
||||
for pol in pos.lines:
|
||||
result = {
|
||||
|
||||
@@ -453,8 +453,8 @@ exports.PosModel = Backbone.Model.extend({
|
||||
self.company_logo.onerror = function(){
|
||||
logo_loaded.reject();
|
||||
};
|
||||
self.company_logo.crossOrigin = "anonymous";
|
||||
self.company_logo.src = '/web/binary/company_logo' +'?_'+Math.random();
|
||||
self.company_logo.crossOrigin = "anonymous";
|
||||
self.company_logo.src = '/web/binary/company_logo' +'?dbname=' + session.db + '&_'+Math.random();
|
||||
|
||||
return logo_loaded;
|
||||
},
|
||||
|
||||
@@ -191,8 +191,7 @@ class product_pricelist(osv.osv):
|
||||
if is_product_template:
|
||||
if rule.product_tmpl_id and product.id != rule.product_tmpl_id.id:
|
||||
continue
|
||||
if rule.product_id and \
|
||||
(product.product_variant_count > 1 or product.product_variant_ids[0].id != rule.product_id.id):
|
||||
if rule.product_id and not (product.product_variant_count == 1 and product.product_variant_ids[0].id == rule.product_id.id):
|
||||
# product rule acceptable on template if has only one variant
|
||||
continue
|
||||
else:
|
||||
|
||||
@@ -505,7 +505,7 @@ class website(osv.osv):
|
||||
"""
|
||||
router = request.httprequest.app.get_db_router(request.db)
|
||||
# Force enumeration to be performed as public user
|
||||
url_list = []
|
||||
url_set = set()
|
||||
for rule in router.iter_rules():
|
||||
if not self.rule_is_enumerable(rule):
|
||||
continue
|
||||
@@ -537,9 +537,9 @@ class website(osv.osv):
|
||||
page[key[2:]] = val
|
||||
if url in ('/sitemap.xml',):
|
||||
continue
|
||||
if url in url_list:
|
||||
if url in url_set:
|
||||
continue
|
||||
url_list.append(url)
|
||||
url_set.add(url)
|
||||
|
||||
yield page
|
||||
|
||||
|
||||
Reference in New Issue
Block a user