[MERGE] forward port branch saas-6 up to 7be1a1c55b

This commit is contained in:
Christophe Simonis
2017-01-02 11:42:52 +01:00
11 changed files with 55 additions and 14 deletions
+6 -6
View File
@@ -694,15 +694,15 @@ class calendar_event(osv.Model):
return [d.astimezone(pytz.UTC) for d in rset1]
def _get_recurrency_end_date(self, cr, uid, id, context=None):
data = self.read(cr, uid, id, ['final_date', 'recurrency', 'rrule_type', 'count', 'end_type', 'stop'], context=context)
data = self.read(cr, uid, id, ['final_date', 'recurrency', 'rrule_type', 'count', 'end_type', 'stop', 'interval'], context=context)
if not data.get('recurrency'):
return False
end_type = data.get('end_type')
final_date = data.get('final_date')
if end_type == 'count' and all(data.get(key) for key in ['count', 'rrule_type', 'stop']):
count = data['count'] + 1
if end_type == 'count' and all(data.get(key) for key in ['count', 'rrule_type', 'stop', 'interval']):
count = (data['count'] + 1) * data['interval']
delay, mult = {
'daily': ('days', 1),
'weekly': ('days', 7),
@@ -982,12 +982,12 @@ class calendar_event(osv.Model):
startdatetime = startdatetime or start
if startdatetime:
start = datetime.strptime(startdatetime, DEFAULT_SERVER_DATETIME_FORMAT)
value['start_date'] = datetime.strftime(start, DEFAULT_SERVER_DATE_FORMAT)
value['start_date'] = fields.date.context_today(self, cr, uid, context=context, timestamp=start)
enddatetime = enddatetime or end
if enddatetime:
end = datetime.strptime(enddatetime, DEFAULT_SERVER_DATETIME_FORMAT)
value['stop_date'] = datetime.strftime(end, DEFAULT_SERVER_DATE_FORMAT)
value['stop_date'] = fields.date.context_today(self, cr, uid, context=context, timestamp=end)
else: # from date to datetime
user = self.pool['res.users'].browse(cr, uid, uid, context)
tz = pytz.timezone(user.tz) if user.tz else pytz.utc
@@ -1322,7 +1322,7 @@ class calendar_event(osv.Model):
data['rrule_type'] = 'monthly'
if r._bymonthday:
data['day'] = r._bymonthday[0]
data['day'] = list(r._bymonthday)[0]
data['month_by'] = 'date'
data['rrule_type'] = 'monthly'
+1 -1
View File
@@ -34,7 +34,7 @@ class event_ticket(models.Model):
event_id = fields.Many2one('event.event', "Event", required=True, ondelete='cascade')
product_id = fields.Many2one(
'product.product', 'Product',
required=True, domain=[("event_type_id", "!=", False)],
required=True, domain=["|", ("event_type_id", "!=", False), ("event_ok", "=", True)],
default=lambda self: self._default_product_id())
registration_ids = fields.One2many('event.registration', 'event_ticket_id', 'Registrations')
price = fields.Float('Price', digits=dp.get_precision('Product Price'))
+2 -2
View File
@@ -201,8 +201,8 @@ class google_calendar(osv.AbstractModel):
if not context:
context = {}
if event.allday:
start_date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.start, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context).isoformat('T').split('T')[0]
final_date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(event.stop, tools.DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(days=1), context=context).isoformat('T').split('T')[0]
start_date = event.start_date
final_date = (datetime.strptime(event.stop_date, tools.DEFAULT_SERVER_DATE_FORMAT) + timedelta(days=1)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
type = 'date'
vstype = 'dateTime'
else:
+3 -1
View File
@@ -18,6 +18,7 @@ from dateutil.relativedelta import relativedelta
from openerp.exceptions import UserError, AccessError
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools import float_compare
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
@@ -486,7 +487,8 @@ class hr_holidays(osv.osv):
if record.holiday_type != 'employee' or record.type != 'remove' or not record.employee_id or record.holiday_status_id.limit:
continue
leave_days = self.pool.get('hr.holidays.status').get_days(cr, uid, [record.holiday_status_id.id], record.employee_id.id, context=context)[record.holiday_status_id.id]
if leave_days['remaining_leaves'] < 0 or leave_days['virtual_remaining_leaves'] < 0:
if float_compare(leave_days['remaining_leaves'], 0, precision_digits=2) == -1 or \
float_compare(leave_days['virtual_remaining_leaves'], 0, precision_digits=2) == -1:
return False
return True
+5 -1
View File
@@ -3,6 +3,7 @@
import json
import logging
import pprint
import urllib
import urllib2
import werkzeug
@@ -26,7 +27,7 @@ class PaypalController(http.Controller):
return return_url
def _parse_pdt_response(self, response):
""" Parse a text reponse for a PDT verification .
""" Parse a text response for a PDT verification .
:param response str: text response, structured in the following way:
STATUS\nkey1=value1\nkey2=value2...\n
@@ -37,6 +38,9 @@ class PaypalController(http.Controller):
lines = filter(None, response.split('\n'))
status = lines.pop(0)
pdt_post = dict(line.split('=', 1) for line in lines)
# html unescape
for post in pdt_post:
pdt_post[post] = urllib.unquote_plus(pdt_post[post]).decode('utf8')
return status, pdt_post
def paypal_validate_data(self, **post):
+3 -1
View File
@@ -81,7 +81,9 @@ class wizard_user(osv.osv_memory):
_columns = {
'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True, ondelete='cascade'),
'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True),
'partner_id': fields.many2one(
'res.partner', string='Contact', required=True, readonly=True,
ondelete='cascade'),
'email': fields.char(string='Email', size=240),
'in_portal': fields.boolean('In Portal'),
'user_id': fields.many2one('res.users', string='Login User'),
+1 -1
View File
@@ -561,7 +561,7 @@ class product_template(osv.osv):
else:
company_id = context.get('force_company') or product.env.user.company_id.id
product = product.with_context(force_company=company_id)
res[product.id] = res[product.id] = product.sudo()[ptype]
res[product.id] = product.sudo()[ptype]
if ptype == 'list_price':
res[product.id] += product._name == "product.product" and product.price_extra or 0.0
if 'uom' in context:
@@ -41,7 +41,7 @@ $('.oe_website_sale #add_to_cart, .oe_website_sale #products_grid .a-submit')
data: {lang: base.get_context().lang},
success: function (quantity) {
if (!$a.hasClass('js_goto_shop')) {
window.location.href = window.location.href.replace(/shop([\/?].*)?$/, "shop/cart");
window.location.pathname = window.location.pathname.replace(/shop([\/?].*)?$/, "shop/cart");
}
var $q = $(".my_cart_quantity");
$q.parent().parent().removeClass("hidden", !quantity);
+11
View File
@@ -0,0 +1,11 @@
Spain, 2016-04-15
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Javier Colmenero Fernández javierjcf@gmail.com https://github.com/javierjcf
+11
View File
@@ -0,0 +1,11 @@
Ecuador, 2016-12-13
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Juan Cristobal Lopez Arrieta juancristobal@gmail.com https://github.com/jclopezar
+11
View File
@@ -0,0 +1,11 @@
Cuba, 2016-12-01
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Rigoberto Martínez rigo1985@gmail.com https://github.com/rigo1985