2
0
mirror of https://github.com/frappe/books.git synced 2025-02-13 09:29:18 +00:00

Merge pull request #1106 from AbleKSaju/fix-hsncode

fix: include HSN code when adding an item in POS
This commit is contained in:
Akshay 2025-01-30 11:00:17 +05:30 committed by GitHub
commit 677db1baaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -528,6 +528,12 @@ export default defineComponent({
invoiceItem.item === item.name && !invoiceItem.isFreeItem invoiceItem.item === item.name && !invoiceItem.isFreeItem
) ?? []; ) ?? [];
const itemsHsncode = (await this.fyo.getValue(
'Item',
item?.name as string,
'hsnCode'
)) as number;
if (item.hasBatch) { if (item.hasBatch) {
for (const invItem of existingItems) { for (const invItem of existingItems) {
const itemQty = invItem.quantity ?? 0; const itemQty = invItem.quantity ?? 0;
@ -557,6 +563,7 @@ export default defineComponent({
await this.sinvDoc.append('items', { await this.sinvDoc.append('items', {
rate: item.rate as Money, rate: item.rate as Money,
item: item.name, item: item.name,
hsnCode: itemsHsncode,
}); });
return; return;
@ -584,17 +591,11 @@ export default defineComponent({
return; return;
} }
} catch (error) {
return showToast({
type: 'error',
message: t`${error as string}`,
});
}
await this.sinvDoc.append('items', { await this.sinvDoc.append('items', {
rate: item.rate as Money, rate: item.rate as Money,
item: item.name, item: item.name,
quantity: quantity ? quantity : 1, quantity: quantity ? quantity : 1,
hsnCode: itemsHsncode,
}); });
if (this.sinvDoc.priceList) { if (this.sinvDoc.priceList) {
@ -610,6 +611,12 @@ export default defineComponent({
await this.applyPricingRule(); await this.applyPricingRule();
await this.sinvDoc.runFormulas(); await this.sinvDoc.runFormulas();
} catch (error) {
return showToast({
type: 'error',
message: t`${error as string}`,
});
}
}, },
async createTransaction(shouldPrint = false, isPay = false) { async createTransaction(shouldPrint = false, isPay = false) {
try { try {