Skip to content

Commit

Permalink
[MERGE] forward port of branch 8.0 up to aabbdc7
Browse files Browse the repository at this point in the history
  • Loading branch information
beledouxdenis committed Sep 21, 2015
2 parents 9975a04 + aabbdc7 commit a3648fd
Show file tree
Hide file tree
Showing 40 changed files with 468 additions and 319 deletions.
10 changes: 6 additions & 4 deletions addons/delivery/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,18 @@ def delivery_set(self, cr, uid, ids, context=None):
if order.company_id.currency_id.id != order.pricelist_id.currency_id.id:
price_unit = currency_obj.compute(cr, uid, order.company_id.currency_id.id, order.pricelist_id.currency_id.id,
price_unit, context=dict(context or {}, date=order.date_order))
#create the sale order line
line_id = line_obj.create(cr, uid, {
values = {
'order_id': order.id,
'name': grid.carrier_id.name,
'product_uom_qty': 1,
'product_uom': grid.carrier_id.product_id.uom_id.id,
'product_id': grid.carrier_id.product_id.id,
'price_unit': price_unit,
'tax_id': [(6, 0, taxes_ids)],
'is_delivery': True
}, context=context)
'is_delivery': True,
}
if order.order_line:
values['sequence'] = order.order_line[-1].sequence + 1
line_id = line_obj.create(cr, uid, values, context=context)
line_ids.append(line_id)
return line_ids
3 changes: 3 additions & 0 deletions addons/event/email_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<field name="model_id" ref="event.model_event_registration"/>
<field name="email_from">${(object.event_id.organizer_id.email or object.event_id.user_id.email or '')|safe}</field>
<field name="email_to" >${object.email|safe}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="reply_to">${object.event_id.reply_to|safe}</field>
<field name="subject">Your subscription at ${object.event_id.name}</field>
<field name="body_html"><![CDATA[<p>Hello ${object.name},</p>
Expand All @@ -21,6 +22,7 @@ You will automatically receive an email providing you more practical information
<field name="model_id" ref="event.model_event_registration"/>
<field name="email_from">${(object.event_id.organizer_id.email or object.event_id.user_id.email or '')|safe}</field>
<field name="email_to" >${object.partner_id.email or object.email|safe}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="reply_to">${object.event_id.reply_to|safe}</field>
<field name="subject">Reminder of event ${object.event_id.name}</field>
<field name="body_html"><![CDATA[<p>Hello ${object.name},</p>
Expand All @@ -35,6 +37,7 @@ For any further information please contact our event department.</p>
<field name="model_id" ref="event.model_event_registration"/>
<field name="email_from">${(object.event_id.organizer_id.email or object.event_id.user_id.email or '')|safe}</field>
<field name="email_to" >${object.partner_id.email or object.email|safe}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="reply_to">${object.event_id.reply_to|safe}</field>
<field name="subject">Thanks for attending ${object.event_id.name}</field>
<field name="body_html"><![CDATA[<p>Hello ${object.name},</p>
Expand Down
8 changes: 8 additions & 0 deletions addons/hw_escpos/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ def __call__(self, device):

printers = usb.core.find(find_all=True, custom_match=FindUsbClass(7))

# Currently we ask customers to put the STAR TSP650II into
# 'USB Mode' Vendor class instead of Printer class. When set
# to Printer class it doesn't show up under Linux at
# all. Vendor class does work, but that means that it's not
# going to have an interfaceClass 7.
if not printers:
printers = usb.core.find(find_all=True, idVendor=0x0519)

for printer in printers:
connected.append({
'vendor': printer.idVendor,
Expand Down
8 changes: 4 additions & 4 deletions addons/hw_escpos/escpos/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, msg=""):
self.resultcode = 70

def __str__(self):
return "Impossible to get status from the printer"
return "Impossible to get status from the printer: " + str(self.msg)

class TicketNotPrinted(Error):
def __init__(self, msg=""):
Expand All @@ -95,7 +95,7 @@ def __init__(self, msg=""):
self.resultcode = 80

def __str__(self):
return "A part of the ticket was not been printed"
return "A part of the ticket was not been printed: " + str(self.msg)

class NoDeviceError(Error):
def __init__(self, msg=""):
Expand All @@ -104,7 +104,7 @@ def __init__(self, msg=""):
self.resultcode = 90

def __str__(self):
return "Impossible to find the printer Device"
return str(self.msg)

class HandleDeviceError(Error):
def __init__(self, msg=""):
Expand All @@ -113,4 +113,4 @@ def __init__(self, msg=""):
self.resultcode = 100

def __str__(self):
return "Impossible to handle device"
return str(self.msg)
2 changes: 1 addition & 1 deletion addons/hw_escpos/escpos/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def close(self):
return True
except usb.core.USBError as e:
i += 1
if i > 100:
if i > 10:
return False

sleep(0.1)
Expand Down
19 changes: 1 addition & 18 deletions addons/hw_proxy/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,7 @@ def status_http(self):
if count == 0:
resp += "<div class='device'>No USB Device Found</div>"

resp += "</div>\n"
resp += """
<h2>Add New Printer</h2>
<p>
Copy and paste your printer's device description in the form below. You can find
your printer's description in the device list above. If you find that your printer works
well, please send your printer's description to <a href='mailto:[email protected]'>
[email protected]</a> so that we can add it to the default list of supported devices.
</p>
<form action='/hw_proxy/escpos/add_supported_device' method='GET'>
<input type='text' style='width:400px' name='device_string' placeholder='123a:b456 Sample Device description' />
<input type='submit' value='submit' />
</form>
<h2>Reset To Defaults</h2>
<p>If the added devices cause problems, you can <a href='/hw_proxy/escpos/reset_supported_devices'>Reset the
device list to factory default.</a> This operation cannot be undone.</p>
"""
resp += "</body>\n</html>\n\n"
resp += "</div>\n</body>\n</html>\n\n"

return request.make_response(resp,{
'Cache-Control': 'no-cache',
Expand Down
1 change: 0 additions & 1 deletion addons/l10n_sa/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{
'name': 'Saudi Arabia - Accounting',
'version': '1.1',
'sequence': 1,
'author': 'DVIT.ME',
'category': 'Localization/Account Charts',
'description': """
Expand Down
2 changes: 1 addition & 1 deletion addons/mail/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ access_mail_notification_system,mail.notification.system,model_mail_notification
access_mail_group_all,mail.group.all,model_mail_group,,1,0,0,0
access_mail_group_user,mail.group.user,model_mail_group,base.group_user,1,1,1,1
access_mail_alias_all,mail.alias.all,model_mail_alias,,1,0,0,0
access_mail_alias_user,mail.alias.user,model_mail_alias,base.group_user,1,1,1,0
access_mail_alias_user,mail.alias.user,model_mail_alias,base.group_user,1,1,1,1
access_mail_alias_system,mail.alias.system,model_mail_alias,base.group_system,1,1,1,1
access_mail_message_subtype_all,mail.message.subtype.all,model_mail_message_subtype,,1,0,0,0
access_mail_message_subtype_system,mail.message.subtype.system,model_mail_message_subtype,base.group_system,1,1,1,1
Expand Down
2 changes: 1 addition & 1 deletion addons/membership/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def _membership_state(self, cr, uid, ids, name, args, context=None):
s = 4
if partner_data.member_lines:
for mline in partner_data.member_lines:
if mline.date_to >= today:
if mline.date_to >= today and mline.date_from < today:
if mline.account_invoice_line and mline.account_invoice_line.invoice_id:
mstate = mline.account_invoice_line.invoice_id.state
if mstate == 'paid':
Expand Down
26 changes: 26 additions & 0 deletions addons/payment/models/payment_acquirer.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,32 @@ def create(self, cr, uid, values, context=None):

return super(PaymentTransaction, self).create(cr, uid, values, context=context)

def write(self, cr, uid, ids, values, context=None):
Acquirer = self.pool['payment.acquirer']
if ('acquirer_id' in values or 'amount' in values) and 'fees' not in values:
# The acquirer or the amount has changed, and the fees are not explicitely forced. Fees must be recomputed.
if isinstance(ids, (int, long)):
ids = [ids]
for txn_id in ids:
vals = dict(values)
vals['fees'] = 0.0
transaction = self.browse(cr, uid, txn_id, context=context)
if 'acquirer_id' in values:
acquirer = Acquirer.browse(cr, uid, values['acquirer_id'], context=context) if values['acquirer_id'] else None
else:
acquirer = transaction.acquirer_id
if acquirer:
custom_method_name = '%s_compute_fees' % acquirer.provider
if hasattr(Acquirer, custom_method_name):
amount = (values['amount'] if 'amount' in values else transaction.amount) or 0.0
currency_id = values.get('currency_id') or transaction.currency_id.id
country_id = values.get('partner_country_id') or transaction.partner_country_id.id
fees = getattr(Acquirer, custom_method_name)(cr, uid, acquirer.id, amount, currency_id, country_id, context=None)
vals['fees'] = float_round(fees, 2)
res = super(PaymentTransaction, self).write(cr, uid, txn_id, vals, context=context)
return res
return super(PaymentTransaction, self).write(cr, uid, ids, values, context=context)

def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
partner = None
if partner_id:
Expand Down
2 changes: 1 addition & 1 deletion addons/payment_ogone/models/ogone.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def _ogone_form_validate(self, cr, uid, tx, data, context=None):
'state': 'cancel',
'acquirer_reference': data.get('PAYID'),
})
elif status in self._ogone_pending_tx_status:
elif status in self._ogone_pending_tx_status or status in self._ogone_wait_tx_status:
tx.write({
'state': 'pending',
'acquirer_reference': data.get('PAYID'),
Expand Down
3 changes: 2 additions & 1 deletion addons/stock_account/wizard/stock_valuation_history.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

from datetime import datetime
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
Expand Down Expand Up @@ -45,7 +46,7 @@ def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, con
res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby, lazy=lazy)
if context is None:
context = {}
date = context.get('history_date')
date = context.get('history_date', datetime.now())
if 'inventory_value' in fields:
group_lines = {}
for line in res:
Expand Down
4 changes: 2 additions & 2 deletions addons/web/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ def content_disposition(filename):
version = int((request.httprequest.user_agent.version or '0').split('.')[0])
if browser == 'msie' and version < 9:
return "attachment; filename=%s" % escaped
elif browser == 'safari':
return u"attachment; filename=%s" % filename
elif browser == 'safari' and version < 537:
return u"attachment; filename=%s" % filename.encode('ascii', 'replace')
else:
return "attachment; filename*=UTF-8''%s" % escaped

Expand Down
54 changes: 43 additions & 11 deletions addons/web/static/test/fulltest.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,33 @@
<script src="/web/static/lib/qunit/qunit.js" type="text/javascript"></script>

<script src="/web/static/lib/underscore/underscore.js" type="text/javascript"></script>
<script src="/web/static/lib/underscore/underscore.string.js" type="text/javascript"></script>
<script src="/web/static/lib/underscore.string/lib/underscore.string.js" type="text/javascript"></script>

<!-- jquery -->
<script src="/web/static/lib/jquery/jquery-1.7.2.js"></script>
<script src="/web/static/lib/jquery.ui/js/jquery-ui-1.8.17.custom.min.js"></script>
<script src="/web/static/lib/jquery/jquery.js"></script>


<link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css"/>
<script type="text/javascript" src="/web/static/lib/bootstrap/js/bootstrap.js"></script>

<script type="text/javascript" charset="utf-8">
$.fn.bstooltip = $.fn.tooltip;
$.fn.bsbutton = $.fn.button;
</script>

<script type="text/javascript" src="/web/static/lib/jquery.ui/js/jquery-ui-1.9.1.custom.js"></script>

<script type="text/javascript" charset="utf-8">
$.fn.tooltip = $.fn.bstooltip;
$.fn.button = $.fn.bsbutton;
</script>

<link rel="stylesheet" href="/web/static/lib/jquery.ui.timepicker/css/jquery-ui-timepicker-addon.css"/>
<script type="text/javascript" src="/web/static/lib/jquery.ui.timepicker/js/jquery-ui-timepicker-addon.js"></script>

<link rel="stylesheet" href="/web/static/lib/jquery.ui.notify/css/ui.notify.css"/>
<script type="text/javascript" src="/web/static/lib/jquery.ui.notify/js/jquery.notify.js"></script>

<script src="/web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js"></script>

<script src="/web/static/lib/datejs/globalization/en-US.js"></script>
Expand All @@ -23,15 +45,25 @@
<script src="/web/static/lib/datejs/extras.js"></script>

<script src="/web/static/lib/qweb/qweb2.js"></script>
<script type="text/javascript" src="/web/static/src/js/openerpframework.js"></script>
<script type="text/javascript" src="/web/static/lib/backbone/backbone.js"></script>

<script src="/web/static/lib/py.js/lib/py.js"></script>

<script src="/web/static/src/js/boot.js"></script>
<script src="/web/static/src/js/core.js"></script>
<script src="/web/static/src/js/dates.js"></script>
<script src="/web/static/src/js/formats.js"></script>
<script src="/web/static/src/js/chrome.js"></script>
<script src="/web/static/src/js/data.js"></script>
<script type="text/javascript" src="/web/static/lib/py.js/lib/py.js"></script>
<script type="text/javascript" src="/web/static/src/js/boot.js"></script>
<script type="text/javascript" src="/web/static/src/js/testing.js"></script>
<script type="text/javascript" src="/web/static/src/js/pyeval.js"></script>
<script type="text/javascript" src="/web/static/src/js/core.js"></script>
<script type="text/javascript" src="/web/static/src/js/formats.js"></script>
<script type="text/javascript" src="/web/static/src/js/chrome.js"></script>
<script type="text/javascript" src="/web/static/src/js/views.js"></script>
<script type="text/javascript" src="/web/static/src/js/data.js"></script>
<script type="text/javascript" src="/web/static/src/js/data_export.js"></script>
<script type="text/javascript" src="/web/static/src/js/search.js"></script>
<script type="text/javascript" src="/web/static/src/js/view_list.js"></script>
<script type="text/javascript" src="/web/static/src/js/view_form.js"></script>
<script type="text/javascript" src="/web/static/src/js/view_list_editable.js"></script>
<script type="text/javascript" src="/web/static/src/js/view_tree.js"></script>
<script type="text/javascript" src="/base/static/src/js/apps.js"></script>

<script src="/web/static/src/js/test_support.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion addons/website/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def placeholder(self, response):
'/website/image/<xmlid>/<field>/<int:max_width>x<int:max_height>',
'/website/image/<model>/<id>/<field>',
'/website/image/<model>/<id>/<field>/<int:max_width>x<int:max_height>'
], auth="public", website=True)
], auth="public", website=True, multilang=False)
def website_image(self, model=None, id=None, field=None, xmlid=None, max_width=None, max_height=None):
""" Fetches the requested field and ensures it does not go above
(max_width, max_height), resizing it if necessary.
Expand Down
2 changes: 1 addition & 1 deletion addons/website/static/src/js/website.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ define(['summernote/summernote'], function () {
// escape text nodes for xml saving
var escaped_el = $el.clone();
var to_escape = escaped_el.find('*').addBack();
to_escape = to_escape.not(to_escape.filter('script,style,[data-oe-model][data-oe-model!="ir.ui.view"]').find('*').addBack());
to_escape = to_escape.not(to_escape.filter('object,iframe,script,style,[data-oe-model][data-oe-model!="ir.ui.view"]').find('*').addBack());
to_escape.contents().each(function(){
if(this.nodeType == 3) {
this.nodeValue = $('<div />').text(this.nodeValue).html();
Expand Down
2 changes: 1 addition & 1 deletion addons/website/static/src/xml/website.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h3 class="modal-title">Mobile preview</h3>
</div>
<div class="modal-body">
<iframe id="mobile-viewport" class="oe_mobile_viewport" src="?mobile-preview=true" style="width: 326px"></iframe>
<iframe id="mobile-viewport" class="oe_mobile_viewport" style="width: 326px"></iframe>
</div>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion addons/website_membership/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.addons.website.models.website import unslug
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp.tools.translate import _

import time
import werkzeug.urls


Expand Down Expand Up @@ -40,7 +42,11 @@ def members(self, membership_id=None, country_name=None, country_id=0, page=1, *
base_line_domain = [("partner.website_published", "=", True), ('state', 'in', ['free', 'paid'])]
if membership_id and membership_id != 'free':
membership_id = int(membership_id)
base_line_domain.append(('membership_id', '=', membership_id))
today = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
base_line_domain += [
('membership_id', '=', membership_id), ('date_to', '>=', today),
('date_from', '<', today), ('state', '=', 'paid')
]
membership = product_obj.browse(cr, uid, membership_id, context=context)
else:
membership = None
Expand Down
Loading

0 comments on commit a3648fd

Please sign in to comment.