mirror of
https://github.com/frappe/books.git
synced 2026-08-24 02:24:17 -05:00
fix: added filter in item visibility
This commit is contained in:
@@ -667,8 +667,16 @@ export abstract class InvoiceItem extends Doc {
|
||||
if (enableERPNextSync) {
|
||||
const itemVisibility = await getItemVisibility(doc.fyo);
|
||||
|
||||
if (itemVisibility === 'ERP Sync Items') {
|
||||
if (itemVisibility === 'Inventory Items') {
|
||||
filters.trackItem = true;
|
||||
} else if (itemVisibility === 'ERP Sync Items') {
|
||||
filters.datafromErp = true;
|
||||
} else if (itemVisibility === 'Non-Inventory Items') {
|
||||
filters.trackItem = false;
|
||||
filters.datafromErp = false;
|
||||
} else {
|
||||
filters.trackItem = false;
|
||||
filters.datafromErp = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -703,6 +703,9 @@ export default defineComponent({
|
||||
filters.trackItem = true;
|
||||
} else if (itemVisibility === 'ERP Sync Items') {
|
||||
filters.datafromErp = true;
|
||||
} else if (itemVisibility === 'Non-Inventory Items') {
|
||||
filters.trackItem = false;
|
||||
filters.datafromErp = false;
|
||||
} else {
|
||||
filters.trackItem = false;
|
||||
filters.datafromErp = false;
|
||||
|
||||
@@ -243,6 +243,10 @@ async function createNewDocument(
|
||||
token: string,
|
||||
deviceID: string
|
||||
) {
|
||||
if (getDocTypeName(doc) === ModelNameEnum.Item) {
|
||||
doc.datafromErp = true;
|
||||
}
|
||||
|
||||
const newDoc = fyo.doc.getNewDoc(getDocTypeName(doc), doc);
|
||||
await performPreSync(fyo, doc);
|
||||
await appendDocValues(newDoc as DocValueMap, doc);
|
||||
@@ -451,8 +455,13 @@ async function updateExistingDocument(
|
||||
token: string,
|
||||
deviceID: string
|
||||
) {
|
||||
const docType = getDocTypeName(doc);
|
||||
|
||||
if (docType === ModelNameEnum.Item) {
|
||||
}
|
||||
|
||||
const existingDoc = await fyo.doc.getDoc(
|
||||
getDocTypeName(doc),
|
||||
docType,
|
||||
(doc.fbooksDocName as string) || (doc.name as string)
|
||||
);
|
||||
|
||||
@@ -537,6 +546,10 @@ export async function performInitialFullSync(fyo: Fyo) {
|
||||
if (docsByType[docType] && docsByType[docType].length > 0) {
|
||||
for (const doc of docsByType[docType]) {
|
||||
try {
|
||||
if (docType === ModelNameEnum.Item) {
|
||||
doc.datafromErp = true;
|
||||
}
|
||||
|
||||
const isDocExists = await fyo.db.exists(
|
||||
docType,
|
||||
(doc.fbooksDocName as string) || (doc.name as string)
|
||||
|
||||
Reference in New Issue
Block a user