mirror of
https://github.com/frappe/books.git
synced 2024-11-08 06:44:06 +00:00
fix: allow location to be common
This commit is contained in:
parent
d394db817e
commit
6805ebcaba
@ -484,6 +484,14 @@ export default class DatabaseCore extends DatabaseBase {
|
|||||||
|
|
||||||
if (operator === '=') {
|
if (operator === '=') {
|
||||||
builder.where(field, comparisonValue);
|
builder.where(field, comparisonValue);
|
||||||
|
} else if (
|
||||||
|
operator === 'in' &&
|
||||||
|
(comparisonValue as (string | null)[]).includes(null)
|
||||||
|
) {
|
||||||
|
const nonNulls = (comparisonValue as (string | null)[]).filter(
|
||||||
|
Boolean
|
||||||
|
) as string[];
|
||||||
|
builder.where(field, operator, nonNulls).orWhere(field, null);
|
||||||
} else {
|
} else {
|
||||||
builder.where(field, operator as string, comparisonValue as string);
|
builder.where(field, operator as string, comparisonValue as string);
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@ import { StockMovement } from './StockMovement';
|
|||||||
const locationFilter: FilterFunction = (doc: Doc) => {
|
const locationFilter: FilterFunction = (doc: Doc) => {
|
||||||
const item = doc.item;
|
const item = doc.item;
|
||||||
if (!doc.item) {
|
if (!doc.item) {
|
||||||
return {};
|
return { item: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { item } as QueryFilter;
|
return { item: ['in', [null, item]] } as QueryFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class StockMovementItem extends Doc {
|
export class StockMovementItem extends Doc {
|
||||||
@ -38,7 +38,6 @@ export class StockMovementItem extends Doc {
|
|||||||
formulas: FormulaMap = {
|
formulas: FormulaMap = {
|
||||||
rate: {
|
rate: {
|
||||||
formula: async () => {
|
formula: async () => {
|
||||||
console.log('called', this.item);
|
|
||||||
if (!this.item) {
|
if (!this.item) {
|
||||||
return this.rate;
|
return this.rate;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { Money } from 'pesa';
|
import { Money } from 'pesa';
|
||||||
|
|
||||||
export type MovementType =
|
export enum MovementType {
|
||||||
| 'MaterialIssue'
|
'MaterialIssue' = 'MaterialIssue',
|
||||||
| 'MaterialReceipt'
|
'MaterialReceipt' = 'MaterialReceipt',
|
||||||
| 'MaterialTransfer';
|
'MaterialTransfer' = 'MaterialTransfer',
|
||||||
|
}
|
||||||
|
|
||||||
export interface SMDetails {
|
export interface SMDetails {
|
||||||
date: Date;
|
date: Date;
|
||||||
@ -20,5 +21,3 @@ export interface SMTransferDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SMIDetails extends SMDetails, SMTransferDetails {}
|
export interface SMIDetails extends SMDetails, SMTransferDetails {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
"fieldname": "item",
|
"fieldname": "item",
|
||||||
"label": "Item",
|
"label": "Item",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Item",
|
"target": "Item"
|
||||||
"required": true,
|
|
||||||
"readOnly": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quickEditFields": ["item"]
|
"quickEditFields": ["item"]
|
||||||
|
@ -64,7 +64,7 @@ export interface GetAllOptions {
|
|||||||
|
|
||||||
export type QueryFilter = Record<
|
export type QueryFilter = Record<
|
||||||
string,
|
string,
|
||||||
boolean | string | (string | number | (string | number)[])[]
|
boolean | string | null | (string | number | (string | number | null)[])[]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user