summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-18 18:53:56 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-18 18:53:56 +0200
commitcabe0951af2e0a0fcad47fa7a9fe2ffa5e8701cf (patch)
tree4932769edceb7c93eeb15ded48937acaea5bb046 /addons
parenta1a03792b6fb7a029a805976512f13ed13c2c6b9 (diff)
parent9001a75f23c014e744fc1853190297eed4c47438 (diff)
[MERGE] forward port branch 10.0 up to 9001a75f23c
Diffstat (limited to 'addons')
-rw-r--r--addons/analytic/models/analytic_account.py23
-rw-r--r--addons/l10n_fr_fec/wizard/account_fr_fec.py4
-rw-r--r--addons/mrp/i18n/mrp.pot5
-rw-r--r--addons/mrp/models/stock_move.py2
-rw-r--r--addons/point_of_sale/static/src/js/models.js3
-rw-r--r--addons/web/static/src/js/framework/ajax.js20
6 files changed, 39 insertions, 18 deletions
diff --git a/addons/analytic/models/analytic_account.py b/addons/analytic/models/analytic_account.py
index 0a35ec1fc2a..8350e1a52fa 100644
--- a/addons/analytic/models/analytic_account.py
+++ b/addons/analytic/models/analytic_account.py
@@ -20,21 +20,24 @@ class AccountAnalyticAccount(models.Model):
@api.multi
def _compute_debit_credit_balance(self):
analytic_line_obj = self.env['account.analytic.line']
- domain = [('account_id', 'in', self.mapped('id'))]
+ domain = [('account_id', 'in', self.ids)]
if self._context.get('from_date', False):
domain.append(('date', '>=', self._context['from_date']))
if self._context.get('to_date', False):
domain.append(('date', '<=', self._context['to_date']))
- account_amounts = analytic_line_obj.search_read(domain, ['account_id', 'amount'])
- account_ids = set([line['account_id'][0] for line in account_amounts])
- data_debit = {account_id: 0.0 for account_id in account_ids}
- data_credit = {account_id: 0.0 for account_id in account_ids}
- for account_amount in account_amounts:
- if account_amount['amount'] < 0.0:
- data_debit[account_amount['account_id'][0]] += account_amount['amount']
- else:
- data_credit[account_amount['account_id'][0]] += account_amount['amount']
+ credit_groups = analytic_line_obj.read_group(
+ domain=domain + [('amount', '>=', 0.0)],
+ fields=['account_id', 'amount'],
+ groupby=['account_id']
+ )
+ data_credit = {l['account_id'][0]: l['amount'] for l in credit_groups}
+ debit_groups = analytic_line_obj.read_group(
+ domain=domain + [('amount', '<', 0.0)],
+ fields=['account_id', 'amount'],
+ groupby=['account_id']
+ )
+ data_debit = {l['account_id'][0]: l['amount'] for l in debit_groups}
for account in self:
account.debit = abs(data_debit.get(account.id, 0.0))
diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py
index 3b8ed12851f..42c21c4f675 100644
--- a/addons/l10n_fr_fec/wizard/account_fr_fec.py
+++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py
@@ -289,7 +289,9 @@ class AccountFrFec(models.TransientModel):
END
AS PieceRef,
TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate,
- CASE WHEN aml.name IS NULL THEN '/' ELSE replace(aml.name, '|', '/') END AS EcritureLib,
+ CASE WHEN aml.name IS NULL THEN '/'
+ WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/'
+ ELSE replace(aml.name, '|', '/') END AS EcritureLib,
replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit,
replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit,
CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet,
diff --git a/addons/mrp/i18n/mrp.pot b/addons/mrp/i18n/mrp.pot
index be8d2e5b1f0..e185da7ea8e 100644
--- a/addons/mrp/i18n/mrp.pot
+++ b/addons/mrp/i18n/mrp.pot
@@ -2104,6 +2104,11 @@ msgid "Quantity To Produce"
msgstr ""
#. module: mrp
+#: model:ir.model.fields,field_description:mrp.field_stock_move_quantity_done_store
+msgid "Quantity done store"
+msgstr ""
+
+#. module: mrp
#: model:ir.model.fields,field_description:mrp.field_mrp_routing_workcenter_batch_size
msgid "Quantity to Process"
msgstr ""
diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py
index ceef7f37cfa..293220d1ed0 100644
--- a/addons/mrp/models/stock_move.py
+++ b/addons/mrp/models/stock_move.py
@@ -91,7 +91,7 @@ class StockMove(models.Model):
quantity_available = fields.Float(
'Quantity Available', compute="_qty_available",
digits=dp.get_precision('Product Unit of Measure'))
- quantity_done_store = fields.Float('Quantity', digits=0)
+ quantity_done_store = fields.Float('Quantity done store', digits=0)
quantity_done = fields.Float(
'Quantity', compute='_qty_done_compute', inverse='_qty_done_set',
digits=dp.get_precision('Product Unit of Measure'))
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 37c115973c4..7cbef6c99dc 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -255,6 +255,7 @@ exports.PosModel = Backbone.Model.extend({
// we attribute a role to the user, 'cashier' or 'manager', depending
// on the group the user belongs.
var pos_users = [];
+ var current_cashier = self.get_cashier();
for (var i = 0; i < users.length; i++) {
var user = users[i];
for (var j = 0; j < user.groups_id.length; j++) {
@@ -272,6 +273,8 @@ exports.PosModel = Backbone.Model.extend({
// replace the current user with its updated version
if (user.id === self.user.id) {
self.user = user;
+ }
+ if (user.id === current_cashier.id) {
self.set_cashier(user);
}
}
diff --git a/addons/web/static/src/js/framework/ajax.js b/addons/web/static/src/js/framework/ajax.js
index e74ae67dc04..d6241974d79 100644
--- a/addons/web/static/src/js/framework/ajax.js
+++ b/addons/web/static/src/js/framework/ajax.js
@@ -252,12 +252,20 @@ function get_file(options) {
if (options.error) {
var body = this.contentDocument.body;
var nodes = body.children.length === 0 ? body.childNodes : body.children;
- options.error({
- message: nodes.length > 1 ? nodes[1].textContent : '',
- data: {
- title: nodes.length > 0 ? nodes[0].textContent : '',
- },
- });
+ var errorParams = {};
+
+ try { // Case of a serialized Odoo Exception: It is Json Parsable
+ var node = nodes[1] || nodes[0];
+ errorParams = JSON.parse(node.textContent);
+ } catch (e) { // Arbitrary uncaught python side exception
+ errorParams = {
+ message: nodes.length > 1 ? nodes[1].textContent : '',
+ data: {
+ title: nodes.length > 0 ? nodes[0].textContent : '',
+ }
+ }
+ }
+ options.error(errorParams);
}
} finally {
complete();