summaryrefslogtreecommitdiff
path: root/addons/account/static/src/js/section_and_note_fields_backend.js
diff options
context:
space:
mode:
authorAurélien Warnon <awa@odoo.com>2018-09-28 09:09:51 +0200
committerAurélien Warnon <awa@odoo.com>2018-10-01 13:29:09 +0200
commit154fc7d9dd550d35b7266af024e54c20e18938fc (patch)
tree5e50d14c454e8d1ffb02e926d4ce99161a39113f /addons/account/static/src/js/section_and_note_fields_backend.js
parent27a739385249cff8c8779cb0d7be140e0b89226a (diff)
[IMP] product,(website_)sale: Product configurator bug fix
Targets commit d3530eb07e24278117ab396ecb86a59deecc312d Purpose ======= [Follow up JCR testing] Various bug fixes including: - optional products dont show when they have variants configured on them - when no variant is created, you cant choose the product one first time in the ecommerce - when in debug, attribute and attribute value menu is double - fix design of default picture in cart summary / product comparison - fix missing href tag on product comparison "add to cart" buttons - products with the "Can be sold" box unchecked should not appear in the product configurator
Diffstat (limited to 'addons/account/static/src/js/section_and_note_fields_backend.js')
-rw-r--r--addons/account/static/src/js/section_and_note_fields_backend.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/addons/account/static/src/js/section_and_note_fields_backend.js b/addons/account/static/src/js/section_and_note_fields_backend.js
index bd3cb3e563a..8880c0b137c 100644
--- a/addons/account/static/src/js/section_and_note_fields_backend.js
+++ b/addons/account/static/src/js/section_and_note_fields_backend.js
@@ -91,6 +91,7 @@ var SectionAndNoteListRenderer = ListRenderer.extend({
this.unselectRow().then(function () {
var context = ev.currentTarget.dataset.context;
+ var pricelistId = self._getPricelistId();
if (context && pyUtils.py_eval(context).open_product_configurator){
self._rpc({
model: 'ir.model.data',
@@ -102,7 +103,10 @@ var SectionAndNoteListRenderer = ListRenderer.extend({
type: 'ir.actions.act_window',
res_model: 'sale.product.configurator',
views: [[res_id, 'form']],
- target: 'new'
+ target: 'new',
+ context: {
+ 'default_pricelist_id': pricelistId
+ }
}, {
on_close: function (products) {
if (products && products !== 'special'){
@@ -125,6 +129,20 @@ var SectionAndNoteListRenderer = ListRenderer.extend({
},
/**
+ * Will try to get the pricelist_id value from the parent sale_order form
+ *
+ * @private
+ * @returns {integer} pricelist_id's id
+ */
+ _getPricelistId: function () {
+ var saleOrderForm = this.getParent() && this.getParent().getParent();
+ var stateData = saleOrderForm && saleOrderForm.state && saleOrderForm.state.data;
+ var pricelist_id = stateData.pricelist_id && stateData.pricelist_id.data;
+
+ return pricelist_id.id;
+ },
+
+ /**
* Will map the products to appropriate record objects that are
* ready for the default_get
*