I wrote a module to store date and note for each row in the shopping cart: brautmode-shop24.de
but always get the errors:
web.assets_frontend_minimal.min.js:31 The following modules are needed by other modules but have not been defined, they may not be present in the correct asset bundle: Array(1)
reportErrors @ web.assets_frontend_minimal.min.js:31
web.assets_frontend_minimal.min.js:33 The following modules could not be loaded because they have unmet dependencies, this is a secondary error which is likely caused by one of the above problems: Array(1)
hier sind die manifest:
{
'name': 'Custom Wedding Date and Note Fields',
'version': '4.0',
'category': 'Website',
'summary': 'Add wedding date and note fields to cart lines',
'description': 'Allows users to enter a wedding date and note per cart line on the website.',
'depends': ['website_sale', 'web'],
'data': [
'views/cart_templates.xml',
],
'assets': {
'web.assets_frontend': [
'web.rpc',
'custom_feld_wd_notiz_ready/static/src/js/md_cart_fields.js', # ← korrigiert!
],
},
'installable': True,
'application': False,
}
js:
/** @odoo-module **/
import publicWidget from "@web/legacy/js/public/public_widget";
import rpc from 'web.rpc';
publicWidget.registry.MDCartFields = publicWidget.Widget.extend({
selector: '.js_cart_lines',
events: {
'click .save-md-fields': '_onSaveMDFields',
},
_onSaveMDFields: function (ev) {
ev.preventDefault();
const lineId = ev.currentTarget.dataset.lineId;
const dateInput = document.querySelector(`.md_wd_input[data-line-id="${lineId}"]`);
const noteInput = document.querySelector(`.md_note_input[data-line-id="${lineId}"]`);
const date = dateInput ? dateInput.value : '';
const note = noteInput ? noteInput.value : '';
rpc.query({
route: '/shop/cart/update_md_fields',
params: {
line_id: parseInt(lineId),
x_studio_md_wd: date,
x_studio_md_notiz: note,
},
}).then(function (result) {
if (result.success) {
alert("Gespeichert!");
} else {
alert("Fehler beim Speichern.");
}
});
},
});
can anyone help?