[MERGE] forward port branch saas-15 up to cae950e826

This commit is contained in:
Christophe Simonis
2018-04-23 17:59:59 +02:00
12 changed files with 53 additions and 33 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ from ${object.company_id.name}.
<field name="body_html" type="html">
<div>
% set record = ctx.get('record')
% set company = record and record.company_id or user.company_id
% set company = record and record.company_id or ctx.get('company')
<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed; border-collapse:separate;" summary="o_mail_notification">
<tbody>
<!-- HEADER -->
@@ -9,7 +9,7 @@ class AccountRegisterPayments(models.TransientModel):
_inherit = "account.register.payments"
check_amount_in_words = fields.Char(string="Amount in Words")
check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing')
check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing', readonly=1)
# Note: a check_number == 0 means that it will be attributed when the check is printed
check_number = fields.Integer(string="Check Number", readonly=True, copy=False, default=0,
help="Number of the check corresponding to this payment. If your pre-printed check are not already numbered, "
@@ -32,7 +32,6 @@ class AccountRegisterPayments(models.TransientModel):
res = super(AccountRegisterPayments, self)._prepare_payment_vals(invoices)
if self.payment_method_id == self.env.ref('account_check_printing.account_payment_method_check'):
res.update({
'check_amount_in_words': self.currency_id.amount_to_text(res['amount']) if self.multi else self.check_amount_in_words,
'check_manual_sequencing': self.check_manual_sequencing,
})
return res
+1 -1
View File
@@ -253,7 +253,7 @@ class Holidays(models.Model):
if nholidays:
raise ValidationError(_('You can not have 2 leaves that overlaps on same day!'))
@api.constrains('state', 'number_of_days_temp')
@api.constrains('state', 'number_of_days_temp', 'holiday_status_id')
def _check_holidays(self):
for holiday in self:
if holiday.holiday_type != 'employee' or holiday.type != 'remove' or not holiday.employee_id or holiday.holiday_status_id.limit:
+1 -1
View File
@@ -5399,7 +5399,7 @@
<field name='name'>802.02 Contra cuenta CUFIN</field>
<field name='color'>4</field>
<field name='applicability'>accounts</field>
<field name='nature'>D</field>
<field name='nature'>A</field>
</record>
<record id='account_tag_803_01' model='account.account.tag'>
<field name='name'>803.01 CUFIN de ejercicios anteriores</field>
+1 -1
View File
@@ -389,7 +389,7 @@ class MrpProduction(models.Model):
source_location = routing.location_id
else:
source_location = self.location_src_id
original_quantity = self.product_qty - self.qty_produced
original_quantity = (self.product_qty - self.qty_produced) or 1.0
data = {
'sequence': bom_line.sequence,
'name': self.name,
+9 -8
View File
@@ -86,6 +86,7 @@ from ${object.company_id.name}.
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[<html>
<head></head>
% set company = record and record.company_id or ctx.get('company')
<body style="margin: 0; padding: 0;">
<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed" summary="o_mail_notification">
<tbody>
@@ -101,7 +102,7 @@ from ${object.company_id.name}.
</span>
</td>
<td valign="middle" align="right">
<img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
<img src="/logo.png?company=${company.id}" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${company.name}">
</td>
</tr>
</table>
@@ -127,16 +128,16 @@ from ${object.company_id.name}.
<table width="590" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;">
<tr>
<td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;">
${user.company_id.name}<br/>
${user.company_id.phone or ''}
${company.name}<br/>
${company.phone or ''}
</td>
<td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;">
% if user.company_id.email:
<a href="mailto:${user.company_id.email}" style="text-decoration:none; color: white;">${user.company_id.email}</a><br/>
% if company.email:
<a href="mailto:${company.email}" style="text-decoration:none; color: white;">${company.email}</a><br/>
% endif
% if user.company_id.website:
<a href="${user.company_id.website}" style="text-decoration:none; color: white;">
${user.company_id.website}
% if company.website:
<a href="${company.website}" style="text-decoration:none; color: white;">
${company.website}
</a>
% endif
</td>
+9 -8
View File
@@ -130,6 +130,7 @@ msgstr ""
#: model:mail.template,body_html:purchase.mail_template_data_notification_email_purchase_order
msgid "<html>\n"
" <head></head>\n"
" % set company = record and record.company_id or or ctx.get('company')\n"
" <body style=\"margin: 0; padding: 0;\">\n"
" <table border=\"0\" width=\"100%\" cellpadding=\"0\" bgcolor=\"#ededed\" style=\"padding: 20px; background-color: #ededed\" summary=\"o_mail_notification\">\n"
" <tbody>\n"
@@ -145,7 +146,7 @@ msgid "<html>\n"
" </span>\n"
" </td>\n"
" <td valign=\"middle\" align=\"right\">\n"
" <img src=\"/logo.png\" style=\"padding: 0px; margin: 0px; height: auto; width: 80px;\" alt=\"${user.company_id.name}\">\n"
" <img src=\"/logo.png?company=${company.id}\" style=\"padding: 0px; margin: 0px; height: auto; width: 80px;\" alt=\"${company.name}\">\n"
" </td>\n"
" </tr>\n"
" </table>\n"
@@ -171,16 +172,16 @@ msgid "<html>\n"
" <table width=\"590\" border=\"0\" cellpadding=\"0\" bgcolor=\"#875A7B\" style=\"min-width: 590px; background-color: rgb(135,90,123); padding: 20px;\">\n"
" <tr>\n"
" <td valign=\"middle\" align=\"left\" style=\"color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;\">\n"
" ${user.company_id.name}<br/>\n"
" ${user.company_id.phone or ''}\n"
" ${company.name}<br/>\n"
" ${company.phone or ''}\n"
" </td>\n"
" <td valign=\"middle\" align=\"right\" style=\"color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;\">\n"
" % if user.company_id.email:\n"
" <a href=\"mailto:${user.company_id.email}\" style=\"text-decoration:none; color: white;\">${user.company_id.email}</a><br/>\n"
" % if company.email:\n"
" <a href=\"mailto:${company.email}\" style=\"text-decoration:none; color: white;\">${company.email}</a><br/>\n"
" % endif\n"
" % if user.company_id.website:\n"
" <a href=\"${user.company_id.website}\" style=\"text-decoration:none; color: white;\">\n"
" ${user.company_id.website}\n"
" % if company.website:\n"
" <a href=\"${company.website}\" style=\"text-decoration:none; color: white;\">\n"
" ${company.website}\n"
" </a>\n"
" % endif\n"
" </td>\n"
+1 -1
View File
@@ -70,7 +70,7 @@ from ${object.company_id.name}.
<field name="body_html"><![CDATA[<html>
<head></head>
% set record = ctx.get('record')
% set company = record and record.company_id or user.company_id
% set company = record and record.company_id or ctx.get('company')
<body style="margin: 0; padding: 0;">
<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed; border-collapse:separate;" summary="o_mail_notification">
<tbody>
+12 -4
View File
@@ -28,6 +28,7 @@ import werkzeug.wsgi
from collections import OrderedDict
from werkzeug.urls import url_decode, iri_to_uri
from xml.etree import ElementTree
import unicodedata
import odoo
@@ -1110,20 +1111,27 @@ class Binary(http.Controller):
</script>"""
args = []
for ufile in files:
filename = ufile.filename
if request.httprequest.user_agent.browser == 'safari':
# Safari sends NFD UTF-8 (where é is composed by 'e' and [accent])
# we need to send it the same stuff, otherwise it'll fail
filename = unicodedata.normalize('NFD', ufile.filename).encode('UTF-8')
try:
attachment = Model.create({
'name': ufile.filename,
'name': filename,
'datas': base64.encodestring(ufile.read()),
'datas_fname': ufile.filename,
'datas_fname': filename,
'res_model': model,
'res_id': int(id)
})
except Exception:
args = args.append({'error': _("Something horrible happened")})
args.append({'error': _("Something horrible happened")})
_logger.exception("Fail to upload attachment %s" % ufile.filename)
else:
args.append({
'filename': ufile.filename,
'filename': filename,
'mimetype': ufile.content_type,
'id': attachment.id
})
@@ -663,7 +663,15 @@ function summernote_mousedown(event) {
}
// restore range if range lost after clicking on non-editable area
r = range.create();
try {
r = range.create();
} catch (e) {
// If this code is running inside an iframe-editor and that the range
// is outside of this iframe, this will fail as the iframe does not have
// the permission to check the outside content this way. In that case,
// we simply ignore the exception as it is as if there was no range.
return;
}
var editables = $(".o_editable[contenteditable], .note-editable[contenteditable]");
var r_editable = editables.has((r||{}).sc);
if (!r_editable.closest('.note-editor').is($editable) && !r_editable.filter('.o_editable').is(editables)) {
+7 -4
View File
@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
import logging
from werkzeug.exceptions import Forbidden
from werkzeug.exceptions import Forbidden, NotFound
from odoo import http, tools, _
from odoo.http import request
@@ -217,6 +217,11 @@ class WebsiteSale(http.Controller):
else:
ppg = PPG
if category:
category = request.env['product.public.category'].search([('id', '=', int(category))], limit=1)
if not category:
raise NotFound()
attrib_list = request.httprequest.args.getlist('attrib')
attrib_values = [[int(x) for x in v.split("-")] for v in attrib_list if v]
attributes_ids = {v[0] for v in attrib_values}
@@ -233,9 +238,6 @@ class WebsiteSale(http.Controller):
url = "/shop"
if search:
post["search"] = search
if category:
category = request.env['product.public.category'].browse(int(category))
url = "/shop/category/%s" % slug(category)
if attrib_list:
post['attrib'] = attrib_list
@@ -244,6 +246,7 @@ class WebsiteSale(http.Controller):
parent_category_ids = []
if category:
url = "/shop/category/%s" % slug(category)
parent_category_ids = [category.id]
current_category = category
while current_category.parent_id:
+1 -1
View File
@@ -1309,7 +1309,7 @@ actual arch.
query = """SELECT max(v.id)
FROM ir_ui_view v
LEFT JOIN ir_model_data md ON (md.model = 'ir.ui.view' AND md.res_id = v.id)
WHERE md.module NOT IN (SELECT name FROM ir_module_module)
WHERE md.module IN (SELECT name FROM ir_module_module) IS NOT TRUE
AND v.model = %s
AND v.active = true
GROUP BY coalesce(v.inherit_id, v.id)"""