mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[ADD] website_sale: new module
This module adds a website form to allows to create an RMA from scratch
This commit is contained in:
committed by
Nikolaus Weingartmair
parent
fe7f66a530
commit
1d84cdca60
45
website_rma/static/src/js/website_rma.js
Normal file
45
website_rma/static/src/js/website_rma.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/* Copyright 2020 Tecnativa - Ernesto Tejeda
|
||||
/* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
*/
|
||||
odoo.define('website_rma.website_rma', function(require) {
|
||||
"use strict";
|
||||
|
||||
require('web.dom_ready');
|
||||
|
||||
$("#rma_request_form input[name='product_id']").select2({
|
||||
width: '100%',
|
||||
placeholder: 'Select a product',
|
||||
allowClear: true,
|
||||
selection_data: false,
|
||||
ajax: {
|
||||
url: '/website_rma/get_products',
|
||||
dataType: 'json',
|
||||
data: function(term) {
|
||||
return {
|
||||
q: term,
|
||||
l: 50
|
||||
};
|
||||
},
|
||||
results: function(data) {
|
||||
var res = [];
|
||||
_.each(data, function(x) {
|
||||
res.push({
|
||||
id: x.id,
|
||||
text: x.display_name,
|
||||
uom_id: x.uom_id[0],
|
||||
uom_name: x.uom_id[1]
|
||||
});
|
||||
});
|
||||
return {results: res};
|
||||
}
|
||||
},
|
||||
});
|
||||
// Set UoM on selected onchange
|
||||
$("#rma_request_form input[name='product_id']").change(function(){
|
||||
var select2_data = $(this).select2('data');
|
||||
var uom_id = select2_data ? select2_data['uom_id'] : ''
|
||||
var uom_name = select2_data ? select2_data['uom_name'] : ''
|
||||
$("input[name='product_uom']").val(uom_id);
|
||||
$("input[name='product_uom_name']").val(uom_name);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user