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:
commit
677db1baaa
@ -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,32 +591,32 @@ export default defineComponent({
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
await this.sinvDoc.append('items', {
|
||||||
|
rate: item.rate as Money,
|
||||||
|
item: item.name,
|
||||||
|
quantity: quantity ? quantity : 1,
|
||||||
|
hsnCode: itemsHsncode,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.sinvDoc.priceList) {
|
||||||
|
let itemData = this.sinvDoc.items?.filter(
|
||||||
|
(val) => val.item == item.name
|
||||||
|
) as SalesInvoiceItem[];
|
||||||
|
|
||||||
|
itemData[0].rate = await getItemRateFromPriceList(
|
||||||
|
itemData[0],
|
||||||
|
this.sinvDoc.priceList
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.applyPricingRule();
|
||||||
|
await this.sinvDoc.runFormulas();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return showToast({
|
return showToast({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: t`${error as string}`,
|
message: t`${error as string}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.sinvDoc.append('items', {
|
|
||||||
rate: item.rate as Money,
|
|
||||||
item: item.name,
|
|
||||||
quantity: quantity ? quantity : 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.sinvDoc.priceList) {
|
|
||||||
let itemData = this.sinvDoc.items?.filter(
|
|
||||||
(val) => val.item == item.name
|
|
||||||
) as SalesInvoiceItem[];
|
|
||||||
|
|
||||||
itemData[0].rate = await getItemRateFromPriceList(
|
|
||||||
itemData[0],
|
|
||||||
this.sinvDoc.priceList
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.applyPricingRule();
|
|
||||||
await this.sinvDoc.runFormulas();
|
|
||||||
},
|
},
|
||||||
async createTransaction(shouldPrint = false, isPay = false) {
|
async createTransaction(shouldPrint = false, isPay = false) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user