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 === '=') {
|
||||
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 {
|
||||
builder.where(field, operator as string, comparisonValue as string);
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import { StockMovement } from './StockMovement';
|
||||
const locationFilter: FilterFunction = (doc: Doc) => {
|
||||
const item = 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 {
|
||||
@ -38,7 +38,6 @@ export class StockMovementItem extends Doc {
|
||||
formulas: FormulaMap = {
|
||||
rate: {
|
||||
formula: async () => {
|
||||
console.log('called', this.item);
|
||||
if (!this.item) {
|
||||
return this.rate;
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { Money } from 'pesa';
|
||||
|
||||
export type MovementType =
|
||||
| 'MaterialIssue'
|
||||
| 'MaterialReceipt'
|
||||
| 'MaterialTransfer';
|
||||
export enum MovementType {
|
||||
'MaterialIssue' = 'MaterialIssue',
|
||||
'MaterialReceipt' = 'MaterialReceipt',
|
||||
'MaterialTransfer' = 'MaterialTransfer',
|
||||
}
|
||||
|
||||
export interface SMDetails {
|
||||
date: Date;
|
||||
@ -20,5 +21,3 @@ export interface SMTransferDetails {
|
||||
}
|
||||
|
||||
export interface SMIDetails extends SMDetails, SMTransferDetails {}
|
||||
|
||||
|
||||
|
@ -15,9 +15,7 @@
|
||||
"fieldname": "item",
|
||||
"label": "Item",
|
||||
"fieldtype": "Link",
|
||||
"target": "Item",
|
||||
"required": true,
|
||||
"readOnly": true
|
||||
"target": "Item"
|
||||
}
|
||||
],
|
||||
"quickEditFields": ["item"]
|
||||
|
@ -64,7 +64,7 @@ export interface GetAllOptions {
|
||||
|
||||
export type QueryFilter = Record<
|
||||
string,
|
||||
boolean | string | (string | number | (string | number)[])[]
|
||||
boolean | string | null | (string | number | (string | number | null)[])[]
|
||||
>;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user