summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-04 13:19:12 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-04 13:19:12 +0200
commit4e90a676da47ccbeacb3d5d2760b94a0f53bafc3 (patch)
tree6363f2d8dd9019caaa667ba9000f619f0ced26fe
parent55ce6aff10b7b65650cfa114222333b86b4ef8d5 (diff)
parent4b7f4f32ea6ec0d9a0a770d3095c8c2f2e112827 (diff)
[MERGE] forward port branch 10.0 up to 4b7f4f32ea6
-rw-r--r--addons/account/models/account_move.py2
-rw-r--r--addons/stock/models/stock_warehouse.py5
-rw-r--r--addons/web/static/src/js/views/list_view.js8
-rw-r--r--addons/web/static/src/js/views/list_view_editable.js11
4 files changed, 21 insertions, 5 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 74edcddb5b3..6dcf73892e5 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -914,8 +914,6 @@ class AccountMoveLine(models.Model):
raise UserError(_('Entries are not of the same account!'))
if not (all_accounts[0].reconcile or all_accounts[0].internal_type == 'liquidity'):
raise UserError(_('The account %s (%s) is not marked as reconciliable !') % (all_accounts[0].name, all_accounts[0].code))
- if len(partners) > 1:
- raise UserError(_('The partner has to be the same on all lines for receivable and payable accounts!'))
#reconcile everything that can be
remaining_moves = self.auto_reconcile_lines()
diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py
index 48dcf54d24f..aeff7ce574a 100644
--- a/addons/stock/models/stock_warehouse.py
+++ b/addons/stock/models/stock_warehouse.py
@@ -808,7 +808,8 @@ class Orderpoint(models.Model):
days = self.lead_days or 0.0
if self.lead_type == 'supplier':
# These days will be substracted when creating the PO
- days += self.product_id._select_seller().delay or 0.0
+ qty = self.env.context.get('product_qty', 0.0)
+ days += self.product_id._select_seller(quantity=qty).delay or 0.0
date_planned = start_date + relativedelta.relativedelta(days=days)
return date_planned.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
@@ -816,7 +817,7 @@ class Orderpoint(models.Model):
def _prepare_procurement_values(self, product_qty, date=False, group=False):
return {
'name': self.name,
- 'date_planned': date or self._get_date_planned(datetime.today()),
+ 'date_planned': date or self.with_context(product_qty=product_qty)._get_date_planned(datetime.today()),
'product_id': self.product_id.id,
'product_qty': product_qty,
'company_id': self.company_id.id,
diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js
index d875714afd2..1a60911845b 100644
--- a/addons/web/static/src/js/views/list_view.js
+++ b/addons/web/static/src/js/views/list_view.js
@@ -315,7 +315,7 @@ var ListView = View.extend({
this._limit = new_state.limit;
this.current_min = new_state.current_min;
- this.reload_content().then(function() {
+ this.reload_content_when_ready().then(function() {
// Reset the scroll position to the top on page changed only
if (!limit_changed) {
self.set_scrollTop(0);
@@ -452,6 +452,12 @@ var ListView = View.extend({
});
return reloaded.promise();
}),
+ /**
+ * Proxy allowing override when reload_content can't be called directly
+ */
+ reload_content_when_ready: function() {
+ return this.reload_content.apply(this, arguments);
+ },
reload: function () {
return this.reload_content();
},
diff --git a/addons/web/static/src/js/views/list_view_editable.js b/addons/web/static/src/js/views/list_view_editable.js
index 42987a64af1..8b00fc87ead 100644
--- a/addons/web/static/src/js/views/list_view_editable.js
+++ b/addons/web/static/src/js/views/list_view_editable.js
@@ -401,6 +401,17 @@ ListView.include(/** @lends instance.web.ListView# */{
return cells;
},
/**
+ * Prevent reloading content while an ongoing save
+ */
+ reload_content_when_ready: function() {
+ var self = this;
+ var self_super = this._super;
+ var original_arguments = arguments;
+ return this.saving_mutex.exec(function() {
+ return self_super.apply(self, original_arguments);
+ });
+ },
+ /**
* If currently editing a row, resizes all registered form fields based
* on the corresponding row cell
*/