|
|
@ -13,26 +13,30 @@ odoo.define('website_hide_variants.VariantMixin', function (require) { |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
var session = require('web.session'); |
|
|
|
var VariantMixin = require('sale.VariantMixin') |
|
|
|
var core = require('web.core') |
|
|
|
var rpc = require('web.rpc') |
|
|
|
var ajax = require('web.ajax'); |
|
|
|
VariantMixin._onChangeCombination = async function(ev, $parent, combination) { |
|
|
|
var count = false |
|
|
|
// Check if the selected combination has a valid product ID
|
|
|
|
var product = combination.product_id |
|
|
|
if (combination.product_id) { |
|
|
|
var data = { |
|
|
|
'id': combination.product_id |
|
|
|
} |
|
|
|
await rpc.query({ |
|
|
|
model: 'product.product', |
|
|
|
method: 'search_read', |
|
|
|
args: [[['id','=',parseInt(combination.product_id)]]], |
|
|
|
|
|
|
|
method: 'product_read', |
|
|
|
args: [ |
|
|
|
[], data |
|
|
|
], |
|
|
|
}).then(function(res) { |
|
|
|
// Check if the product is marked as "website_hide_variants"
|
|
|
|
|
|
|
|
if (res[0].website_hide_variants) { |
|
|
|
// Disable the combination and display an appropriate message to the user
|
|
|
|
|
|
|
|
combination.is_combination_possible = false |
|
|
|
|
|
|
|
count = true |
|
|
|
} |
|
|
|
}); |
|
|
|