[MERGE] forward port branch 9.0 up to 2662739187

This commit is contained in:
Christophe Simonis
2017-06-21 18:06:45 +02:00
8 changed files with 39 additions and 7 deletions
+1 -1
View File
@@ -479,7 +479,7 @@ class MassMailing(osv.Model):
'create_date': fields.datetime('Creation Date'),
'sent_date': fields.datetime('Sent Date', oldname='date', copy=False),
'schedule_date': fields.datetime('Schedule in the Future'),
'body_html': fields.html('Body', translate=html_translate, sanitize=False),
'body_html': fields.html('Body', sanitize=False),
'attachment_ids': fields.many2many(
'ir.attachment', 'mass_mailing_ir_attachments_rel',
'mass_mailing_id', 'attachment_id', 'Attachments'
+2 -1
View File
@@ -761,7 +761,8 @@ class PosOrderLine(models.Model):
fiscal_position_id = line.order_id.fiscal_position_id
if fiscal_position_id:
taxes = fiscal_position_id.map_tax(taxes)
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
price = self.env['account.tax']._fix_tax_included_price(
line.price_unit * (1 - (line.discount or 0.0) / 100.0), line.product_id.taxes_id, taxes)
line.price_subtotal = line.price_subtotal_incl = price * line.qty
if taxes:
taxes = taxes.compute_all(price, currency, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)
@@ -2329,7 +2329,6 @@ td {
}
.pos .popup-password .popup-input {
width: 70%;
-webkit-text-security: disc;
}
.pos .popup .body ul,
@@ -238,6 +238,11 @@ var PasswordPopupWidget = NumberPopupWidget.extend({
this._super();
this.$('.popup').addClass('popup-password');
},
click_numpad: function(event){
this._super.apply(this, arguments);
var $value = this.$('.value');
$value.text($value.text().replace(/./g, '•'));
},
});
gui.define_popup({name:'password', widget: PasswordPopupWidget});
@@ -183,6 +183,11 @@ var FieldTextHtml = widget.extend({
template: 'web_editor.FieldTextHtml',
willStart: function () {
var self = this;
if (this.field.translate === false) {
this.languages = [];
return $.when();
}
return new Model('res.lang').call("search_read", [[['code', '!=', 'en_US']], ["name", "code"]]).then(function (res) {
self.languages = res;
});
+8 -3
View File
@@ -47,7 +47,8 @@ class IrTranslationImport(object):
# of ir_translation, so this copy will be much faster.
query = """ CREATE TEMP TABLE %s (
imd_model VARCHAR(64),
imd_name VARCHAR(128)
imd_name VARCHAR(128),
noupdate BOOLEAN
) INHERITS (%s) """ % (self._table, self._model_table)
self._cr.execute(query)
@@ -104,7 +105,8 @@ class IrTranslationImport(object):
# Step 1: resolve ir.model.data references to res_ids
cr.execute(""" UPDATE %s AS ti
SET res_id = imd.res_id
SET res_id = imd.res_id,
noupdate = imd.noupdate
FROM ir_model_data AS imd
WHERE ti.res_id IS NULL
AND ti.module IS NOT NULL AND ti.imd_name IS NOT NULL
@@ -150,7 +152,10 @@ class IrTranslationImport(object):
src = ti.src,
state = 'translated'
FROM %s AS ti
WHERE %s AND ti.value IS NOT NULL AND ti.value != ''
WHERE %s
AND ti.value IS NOT NULL
AND ti.value != ''
AND noupdate IS NOT TRUE
""" % (self._model_table, self._table, find_expr),
(tuple(src_relevant_fields), tuple(src_relevant_fields)))
@@ -13,3 +13,20 @@ class TestTermCount(common.TransactionCase):
ids = self.registry('ir.translation').search(self.cr, self.uid,
[('src', '=', '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB')])
self.assertEqual(len(ids), 2)
def test_noupdate(self):
"""
Make sure no update do not overwrite translations
"""
menu = self.env.ref('test_translation_import.menu_test_translation_import')
menu.name = "New Name"
# install french and change translation content
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
menu.with_context(lang='fr_FR').name = "Nouveau nom"
# reload with overwrite
odoo.tools.trans_load(self.cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False, context={'overwrite': True})
# trans_load invalidates ormcache but not record cache
menu.refresh()
self.assertEqual(menu.name, "New Name")
self.assertEqual(menu.with_context(lang='fr_FR').name, "Nouveau nom")
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data noupdate="1">
<record id="action_test_translation_import" model="ir.actions.act_window">
<field name="name">Test translation import</field>