mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
fix: display availableQty according to item visibility
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<p
|
||||
v-if="!isErpSync"
|
||||
v-if="itemVisibility !== 'ERP Sync Items'"
|
||||
class="
|
||||
absolute
|
||||
top-1
|
||||
@@ -112,9 +112,9 @@ export default defineComponent({
|
||||
itemQtyMap: {
|
||||
type: Object,
|
||||
},
|
||||
isErpSync: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
itemVisibility: {
|
||||
type: String,
|
||||
default: 'Inventory Items',
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
size="large"
|
||||
class=""
|
||||
:df="df"
|
||||
:value="row[df.fieldname]"
|
||||
:value="(row as POSItem)[df.fieldname as keyof POSItem]"
|
||||
:readOnly="true"
|
||||
/>
|
||||
</Row>
|
||||
@@ -81,14 +81,14 @@ export default defineComponent({
|
||||
props: {
|
||||
items: Array,
|
||||
itemQtyMap: Object,
|
||||
isErpSync: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
itemVisibility: {
|
||||
type: String,
|
||||
default: 'Inventory Items',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
ratio() {
|
||||
if (this.isErpSync) {
|
||||
if (this.itemVisibility === 'ERP Sync Items') {
|
||||
return [1, 1.5, 0.8];
|
||||
}
|
||||
return [1, 1, 1, 0.7];
|
||||
@@ -119,7 +119,7 @@ export default defineComponent({
|
||||
},
|
||||
] as Field[];
|
||||
|
||||
if (!this.isErpSync) {
|
||||
if (this.itemVisibility !== 'ERP Sync Items') {
|
||||
fields.splice(2, 0, {
|
||||
fieldname: 'availableQty',
|
||||
label: 'Qty',
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<p
|
||||
v-if="!isErpSync"
|
||||
v-if="itemVisibility !== 'ERP Sync Items'"
|
||||
class="
|
||||
w-6
|
||||
h-6
|
||||
@@ -115,9 +115,9 @@ export default defineComponent({
|
||||
itemQtyMap: {
|
||||
type: Object,
|
||||
},
|
||||
isErpSync: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
itemVisibility: {
|
||||
type: String,
|
||||
default: 'Inventory Items',
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
:key="df.fieldname"
|
||||
size="large"
|
||||
:df="df"
|
||||
:value="row[df.fieldname]"
|
||||
:value="(row as POSItem)[df.fieldname as keyof POSItem]"
|
||||
:readOnly="true"
|
||||
/>
|
||||
</Row>
|
||||
@@ -113,7 +113,7 @@
|
||||
:key="df.fieldname"
|
||||
size="large"
|
||||
:df="df"
|
||||
:value="row[df.fieldname]"
|
||||
:value="(row as POSItem)[df.fieldname as keyof POSItem]"
|
||||
:readOnly="true"
|
||||
/>
|
||||
</Row>
|
||||
@@ -137,14 +137,14 @@ export default defineComponent({
|
||||
props: {
|
||||
items: Array,
|
||||
itemQtyMap: Object,
|
||||
isErpSync: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
itemVisibility: {
|
||||
type: String,
|
||||
default: 'Inventory Items',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
ratio() {
|
||||
if (this.isErpSync) {
|
||||
if (this.itemVisibility === 'ERP Sync Items') {
|
||||
return [1, 1.5, 0.8];
|
||||
}
|
||||
return [1, 1, 1, 0.7];
|
||||
@@ -175,7 +175,7 @@ export default defineComponent({
|
||||
},
|
||||
] as Field[];
|
||||
|
||||
if (!this.isErpSync) {
|
||||
if (this.itemVisibility !== 'ERP Sync Items') {
|
||||
fields.splice(2, 0, {
|
||||
fieldname: 'availableQty',
|
||||
label: t`Qty`,
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
v-if="tableView"
|
||||
:items="items"
|
||||
:item-qty-map="itemQuantityMap as ItemQtyMap"
|
||||
:is-erp-sync="isErpSync"
|
||||
:item-visibility="itemVisibility"
|
||||
@add-item="(item) => emitEvent('addItem', item)"
|
||||
/>
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
v-else
|
||||
:items="items"
|
||||
:item-qty-map="itemQuantityMap as ItemQtyMap"
|
||||
:is-erp-sync="isErpSync"
|
||||
:item-visibility="itemVisibility"
|
||||
@add-item="(item) => emitEvent('addItem', item)"
|
||||
/>
|
||||
|
||||
@@ -485,9 +485,9 @@ export default defineComponent({
|
||||
type: Array as PropType<POSItem[] | undefined>,
|
||||
default: () => [],
|
||||
},
|
||||
isErpSync: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
itemVisibility: {
|
||||
type: String,
|
||||
default: 'Inventory Items',
|
||||
},
|
||||
profile: {
|
||||
type: Object as PropType<POSProfile>,
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
v-if="tableView"
|
||||
:items="items"
|
||||
:item-qty-map="itemQuantityMap as ItemQtyMap"
|
||||
:is-erp-sync="isErpSync"
|
||||
:item-visibility="itemVisibility"
|
||||
@add-item="(item:string) => emitEvent('addItem', item)"
|
||||
/>
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
v-else
|
||||
:items="items"
|
||||
:item-qty-map="itemQuantityMap as ItemQtyMap"
|
||||
:is-erp-sync="isErpSync"
|
||||
:item-visibility="itemVisibility"
|
||||
@add-item="(item:string) => emitEvent('addItem', item)"
|
||||
/>
|
||||
|
||||
@@ -491,9 +491,9 @@ export default defineComponent({
|
||||
type: Array as PropType<POSItem[] | undefined>,
|
||||
default: () => [],
|
||||
},
|
||||
isErpSync: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
itemVisibility: {
|
||||
type: String,
|
||||
default: 'Inventory Items',
|
||||
},
|
||||
profile: {
|
||||
type: Object as PropType<POSProfile>,
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
:selected-item-group="selectedItemGroup"
|
||||
:is-pos-shift-open="isPosShiftOpen"
|
||||
:items="(items as [] as POSItem[])"
|
||||
:is-erp-sync="isErpSync"
|
||||
:item-visibility="itemVisibility"
|
||||
:sinv-doc="(sinvDoc as SalesInvoice)"
|
||||
:disable-pay-button="disablePayButton"
|
||||
:open-payment-modal="openPaymentModal"
|
||||
@@ -84,7 +84,7 @@
|
||||
:selected-item-group="selectedItemGroup"
|
||||
:is-pos-shift-open="isPosShiftOpen"
|
||||
:items="(items as [] as POSItem[])"
|
||||
:is-erp-sync="isErpSync"
|
||||
:item-visibility="itemVisibility"
|
||||
:sinv-doc="(sinvDoc as SalesInvoice)"
|
||||
:disable-pay-button="disablePayButton"
|
||||
:open-payment-modal="openPaymentModal"
|
||||
@@ -169,6 +169,7 @@ import {
|
||||
getItemRateFromPriceList,
|
||||
getItemVisibility,
|
||||
} from 'models/helpers';
|
||||
import { ItemVisibility } from 'src/components/POS/types';
|
||||
import {
|
||||
POSItem,
|
||||
ItemQtyMap,
|
||||
@@ -264,7 +265,7 @@ export default defineComponent({
|
||||
quickQtyKeyUpHandler: null as ((e: KeyboardEvent) => void) | null,
|
||||
selectedItemForBatch: '' as string,
|
||||
pendingBatchItem: null as { item: POSItem; quantity: number } | null,
|
||||
isErpSyncValue: false,
|
||||
itemVisibilityValue: 'Inventory Items' as ItemVisibility,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -274,8 +275,8 @@ export default defineComponent({
|
||||
return !!fyo.singles.AccountingSettings?.enableDiscounting;
|
||||
},
|
||||
isPosShiftOpen: () => !!fyo.singles.POSSettings?.isShiftOpen,
|
||||
isErpSync() {
|
||||
return this.isErpSyncValue;
|
||||
itemVisibility() {
|
||||
return this.itemVisibilityValue;
|
||||
},
|
||||
disablePayButton(): boolean {
|
||||
if (!this.sinvDoc.items?.length || !this.sinvDoc.party) {
|
||||
@@ -301,7 +302,7 @@ export default defineComponent({
|
||||
async mounted() {
|
||||
await this.setItems();
|
||||
await this.loadPOSProfile();
|
||||
this.isErpSyncValue = !!fyo.singles.AccountingSettings?.enableERPNextSync;
|
||||
this.itemVisibilityValue = await getItemVisibility(this.fyo);
|
||||
},
|
||||
async activated() {
|
||||
toggleSidebar(false);
|
||||
|
||||
Reference in New Issue
Block a user