diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-11-22 12:39:02 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-11-22 12:39:02 +0100 |
| commit | 64e73b8352094f805cd3cdf2fcc2b617ee2bab48 (patch) | |
| tree | 6713d9619c567226b6695cfe251574e35265cc8a | |
| parent | 1adedfa977761a5384b697e19b3d3525d77ba783 (diff) | |
| parent | 290601e28f1056d1d529374fbe65751900ab4974 (diff) | |
[MERGE] forward port branch 9.0 up to 290601e
| -rw-r--r-- | addons/account/models/account_analytic_line.py | 5 | ||||
| -rw-r--r-- | addons/account/models/account_move.py | 2 | ||||
| -rw-r--r-- | addons/account/views/account_analytic_view.xml | 3 | ||||
| -rw-r--r-- | addons/stock/views/stock_picking_views.xml | 1 | ||||
| -rw-r--r-- | addons/stock_account/stock_account.py | 1 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/backend.js | 10 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/rte.summernote.js | 2 | ||||
| -rw-r--r-- | openerp/addons/base/ir/ir_translation.py | 22 |
8 files changed, 26 insertions, 20 deletions
diff --git a/addons/account/models/account_analytic_line.py b/addons/account/models/account_analytic_line.py index 83faccaa15c..c5c0d5ed746 100644 --- a/addons/account/models/account_analytic_line.py +++ b/addons/account/models/account_analytic_line.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from openerp import api, fields, models, _ +from math import copysign class AccountAnalyticLine(models.Model): @@ -20,8 +21,12 @@ class AccountAnalyticLine(models.Model): help='Utility field to express amount currency') currency_id = fields.Many2one('res.currency', related='move_id.currency_id', string='Account Currency', store=True, help="The related account currency if not equal to the company one.", readonly=True) amount_currency = fields.Monetary(related='move_id.amount_currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True) + analytic_amount_currency = fields.Monetary(string='Amount Currency', compute="_get_analytic_amount_currency", help="The amount expressed in the related account currency if not equal to the company one.", readonly=True) partner_id = fields.Many2one('res.partner', related='account_id.partner_id', string='Partner', store=True, readonly=True) + def _get_analytic_amount_currency(self): + self.analytic_amount_currency = abs(self.amount_currency) * copysign(1, self.amount) + @api.v8 @api.onchange('product_id', 'product_uom_id', 'unit_amount', 'currency_id') def on_change_unit_amount(self): diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 3606cc8500c..21881e22e9f 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1254,7 +1254,7 @@ class AccountMoveLine(models.Model): """ Prepare the values used to create() an account.analytic.line upon validation of an account.move.line having an analytic account. This method is intended to be extended in other modules. """ - amount = (self.debit or 0.0) - (self.credit or 0.0) + amount = (self.credit or 0.0) - (self.debit or 0.0) return { 'name': self.name, 'date': self.date, diff --git a/addons/account/views/account_analytic_view.xml b/addons/account/views/account_analytic_view.xml index f28115eedce..4c002c3a3fd 100644 --- a/addons/account/views/account_analytic_view.xml +++ b/addons/account/views/account_analytic_view.xml @@ -15,7 +15,8 @@ </xpath> <xpath expr="//field[@name='amount']" position="after"> <field name="company_currency_id" invisible="1"/> - <field name="amount_currency"/> + <field name="amount_currency" invisible="1"/> + <field name="analytic_amount_currency"/> <field name="product_id"/> <field name="product_uom_id" class="oe_inline"/> </xpath> diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index da4132b803c..f5881179cc5 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -202,6 +202,7 @@ <header> <button name="action_confirm" states="draft" string="Mark as Todo" type="object" class="oe_highlight" groups="base.group_user"/> <button name="action_assign" states="confirmed,waiting" string="Reserve" type="object" class="oe_highlight" groups="base.group_user"/> + <button name="action_assign" states="partially_available" string="Recheck Availability" type="object" groups="base.group_user"/> <button name="force_assign" states="confirmed,waiting,partially_available" string="Force Availability" type="object" groups="base.group_user"/> <button name="do_new_transfer" states="draft,partially_available,assigned" string="Validate" groups="stock.group_stock_user" type="object" class="oe_highlight"/> <button name="do_print_picking" string="Print" groups="stock.group_stock_user" type="object" attrs="{'invisible': [('state', 'not in', ('assigned', 'partially_available'))]}"/> diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index a85712960eb..2e837a2c918 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -111,7 +111,6 @@ class account_invoice(osv.osv): ] return [] - #---------------------------------------------------------- # Stock Location #---------------------------------------------------------- diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 3b414d45cb5..17ce8c3c1a1 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -161,11 +161,6 @@ var FieldTextHtmlSimple = widget.extend({ return !this.get('value') || this.get('value') === "<p><br/></p>" || !this.get('value').match(/\S/); }, commit_value: function () { - // leave code view before saving - if (this.$content.prev('textarea').length === 1) { - var layoutInfo = { 'editor': function() { return this.$content; }.bind(this) }; - $.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo); - } if (this.options['style-inline']) { transcoder.class_to_style(this.$content); transcoder.font_to_img(this.$content); @@ -379,11 +374,6 @@ var FieldTextHtml = widget.extend({ this._dirty_flag = false; return this.editor.save(); } else if (this._dirty_flag && this.editor && this.editor.buildingBlock) { - // leave code view before saving - if (this.$content.prev('textarea').length === 1) { - var layoutInfo = { 'editor': function() { return this.$content; }.bind(this) }; - $.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo); - } this.editor.buildingBlock.clean_for_save(); this.internal_set_value( this.$content.html() ); } diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js index 4483dbcf617..73565e19743 100644 --- a/addons/web_editor/static/src/js/rte.summernote.js +++ b/addons/web_editor/static/src/js/rte.summernote.js @@ -539,8 +539,6 @@ function prettify_html(html) { } return result; } - -// Change Warning: called with dummy arguments to quit code view before saving $.summernote.pluginEvents.codeview = function (event, editor, layoutInfo) { if (layoutInfo.toolbar) { return eventHandler.modules.codeview.toggle(layoutInfo); diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index a34e5ce2b8f..67e48ec8801 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -5,7 +5,7 @@ import logging from collections import defaultdict from difflib import get_close_matches -from odoo import api, fields, models, tools, _ +from odoo import api, fields, models, tools, SUPERUSER_ID, _ from odoo.exceptions import AccessError, UserError, ValidationError from odoo.modules import get_module_path, get_module_resource @@ -121,12 +121,21 @@ class IrTranslationImport(object): # referencing non-existent data. cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % self._table) + # detect the xml_translate fields, where the src must be the same + env = api.Environment(cr, SUPERUSER_ID, {}) + src_relevant_fields = [] + for model in env: + for field_name, field in env[model]._fields.items(): + if hasattr(field, 'translate') and callable(field.translate): + src_relevant_fields.append("%s,%s" % (model, field_name)) + find_expr = """ irt.lang = ti.lang AND irt.type = ti.type AND irt.name = ti.name AND ( - (ti.type = 'model' AND ti.res_id = irt.res_id AND irt.src = ti.src) + (ti.type = 'model' AND ti.res_id = irt.res_id AND ti.name IN %s AND irt.src = ti.src) + OR (ti.type = 'model' AND ti.res_id = irt.res_id AND ti.name NOT IN %s) OR (ti.type = 'view' AND (irt.res_id IS NULL OR ti.res_id = irt.res_id) AND irt.src = ti.src) OR (ti.type = 'field') OR (ti.type = 'help') @@ -142,20 +151,23 @@ class IrTranslationImport(object): state = 'translated' FROM %s AS ti WHERE %s AND ti.value IS NOT NULL AND ti.value != '' - """ % (self._model_table, self._table, find_expr)) + """ % (self._model_table, self._table, find_expr), + (tuple(src_relevant_fields), tuple(src_relevant_fields))) # Step 3: insert new translations cr.execute(""" INSERT INTO %s(name, lang, res_id, src, type, value, module, state, comments) SELECT name, lang, res_id, src, type, value, module, state, comments FROM %s AS ti WHERE NOT EXISTS(SELECT 1 FROM ONLY %s AS irt WHERE %s); - """ % (self._model_table, self._table, self._model_table, find_expr)) + """ % (self._model_table, self._table, self._model_table, find_expr), + (tuple(src_relevant_fields), tuple(src_relevant_fields))) if self._debug: cr.execute("SELECT COUNT(*) FROM ONLY %s" % self._model_table) total = cr.fetchone()[0] cr.execute("SELECT COUNT(*) FROM ONLY %s AS irt, %s AS ti WHERE %s" % \ - (self._model_table, self._table, find_expr)) + (self._model_table, self._table, find_expr), + (tuple(src_relevant_fields), tuple(src_relevant_fields))) count = cr.fetchone()[0] _logger.debug("ir.translation.cursor: %d entries now in ir.translation, %d common entries with tmp", total, count) |
