Skip to content

Commit

Permalink
[MERGE] forward port branch saas-11 up to 79dfcde
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Jun 21, 2017
2 parents b21f6e3 + 79dfcde commit 6981320
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addons/mass_mailing/models/mass_mailing.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _get_mailing_model(self):
create_date = fields.Datetime(string='Creation Date')
sent_date = fields.Datetime(string='Sent Date', oldname='date', copy=False)
schedule_date = fields.Datetime(string='Schedule in the Future')
body_html = fields.Html(string='Body', translate=html_translate, sanitize_attributes=False)
body_html = fields.Html(string='Body', sanitize_attributes=False)
attachment_ids = fields.Many2many('ir.attachment', 'mass_mailing_ir_attachments_rel',
'mass_mailing_id', 'attachment_id', string='Attachments')
keep_archives = fields.Boolean(string='Keep Archives')
Expand Down
3 changes: 2 additions & 1 deletion addons/point_of_sale/models/pos_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,8 @@ def _compute_amount_line_all(self):
fiscal_position_id = line.order_id.fiscal_position_id
if fiscal_position_id:
taxes = fiscal_position_id.map_tax(taxes, line.product_id, line.order_id.partner_id)
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)
Expand Down
1 change: 0 additions & 1 deletion addons/point_of_sale/static/src/css/pos.css
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,6 @@ td {
}
.pos .popup-password .popup-input {
width: 70%;
-webkit-text-security: disc;
}

.pos .popup .body ul,
Expand Down
5 changes: 5 additions & 0 deletions addons/point_of_sale/static/src/js/popups.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,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});

Expand Down
9 changes: 8 additions & 1 deletion addons/purchase_requisition/models/purchase_requisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ class PurchaseRequisition(models.Model):
_order = "id desc"

def _get_picking_in(self):
return self.env.ref('stock.picking_type_in')
pick_in = self.env.ref('stock.picking_type_in')
if not pick_in:
company = self.env['res.company']._company_default_get('purchase.requisition')
pick_in = self.env['stock.picking.type'].search(
[('warehouse_id.company_id', '=', company.id), ('code', '=', 'incoming')],
limit=1,
)
return pick_in

def _get_type_id(self):
return self.env['purchase.requisition.type'].search([], limit=1)
Expand Down
5 changes: 5 additions & 0 deletions addons/web_editor/static/src/js/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
11 changes: 8 additions & 3 deletions odoo/addons/base/ir/ir_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def __init__(self, model):
# 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)

Expand Down Expand Up @@ -104,7 +105,8 @@ def finish(self):

# 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
Expand Down Expand Up @@ -150,7 +152,10 @@ def finish(self):
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)))

Expand Down
17 changes: 17 additions & 0 deletions odoo/tests/addons/test_translation_import/tests/test_term_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,20 @@ def test_count_term(self):
ids = self.env['ir.translation'].search(
[('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")
2 changes: 1 addition & 1 deletion odoo/tests/addons/test_translation_import/view.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<data noupdate="1">

<record id="action_test_translation_import" model="ir.actions.act_window">
<field name="name">Test translation import</field>
Expand Down

0 comments on commit 6981320

Please sign in to comment.