Hello friends, when writing a sales invoice, I have to go to the next row with the mouse or press the tab button a few times, which slows down the work. Is there a shortcut to go to the next row?
There is not, you already gave the options indicated.
Please paste this code into a new extension.
document.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.key === '/') {
const url = window.location.href;
if (url.includes('sales-invoice-form')) {
const element = document.querySelector('.fas.fa-table-rows');
if (element) {
element.click();
}
}
}
});
This code functions within the sales invoice form, enabling the creation of a new line when the “Ctrl + /” combination is pressed.
1 Like
thanks.
i did but does’nt work
the extension only work if the Country set to blank like this :
Another approach involves creating a Text Custom Field named “newRow” and setting its Placement to “Sales invoice” (or its equivalent in your language). Then, paste the following script into the Description section:
<div id="newRow" style="display: none;">
<script>
document.addEventListener('DOMContentLoaded', () => {
const labelText = 'newRow';
document.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.key === '/') {
const element = document.querySelector('.fas.fa-table-rows');
if (element) {
element.click();
}
}
});
const vModelForm = document.getElementById('v-model-form');
if (vModelForm) {
const labels = vModelForm.querySelectorAll('label');
labels.forEach(label => {
if (label.textContent.trim() === labelText) {
const formGroup = label.closest('.form-group');
if (formGroup) {
formGroup.style.display = 'none';
formGroup.style.readonly = true;
}
}
});
}
const newRowElement = document.getElementById('newRow');
if (newRowElement) {
newRowElement.remove();
}
});
</script>
</div>
Sorry, I don’t mean to create a new row. I mean scrolling between rows, that is, when setting the invoice, scroll and change the cursor from the current row to the new row.