Hi ERPNext community.
I want to show the non-default quantity and unit of measure(UOM) that entered the warehouse, out quantity, and the reserved quantity, and the reserved quantity (number 1 in the attachment)
To confirm to my information, the screens that affect the inventory quantity are: (Stock Entry, Delivery Note and Sales invoice)?
by report
Because I have very little experience with python, JavaScript
I do the following:
1- Create a table that contains the changes that occur in the tables(Stock Entry, Delivery Note and Sales invoice).
2- Create a trigger when (insert, update, delete).
But when docstates = 1 (submitted status) trigger not fired
And when docstates = 0 (saved status) trigger fired
Example :
(AFTER INSERT
ON tabStock Entry Detail
FOR EACH ROW
BEGIN
DECLARE CUR2 CURSOR FOR SELECT purpose,docstatus,parent FROM tabStock Entry
where name =new.parent ;
BEGIN
DECLARE V_STOCK_ENTRY2 ROW TYPE OF CUR2;
OPEN CUR2 ;
FETCH CUR2 INTO V_STOCK_ENTRY2;
#IF V_STOCK_ENTRY2.docstatus =1 THEN
IF V_STOCK_ENTRY2.purpose=‘Material Issue’ and V_STOCK_ENTRY2.docstatus =1 THEN
INSERT INTO tabstock qty
(name, item_code,uom,internal_qty,store_name,creation,drum_no,modified,modified_by,owner,docstatus,parent)
VALUES (new.name, new.item_code,new.uom,new.qty,new.s_warehouse,new.creation,new.batch_no,new.modified,new.modified_by,new.owner,new.docstatus,new.parent);
#select new.name,new.item_code,new.uom,new.qty,new.t_warehouse,new.creation,new.batch_no,new.modified,new.modified_by,new.owner,new.docstatus,new.parent
#from tabStock Entry Detail
#where NEW.docstatus =1;
ELSEIF V_STOCK_ENTRY2.purpose=‘Material Receipt’ THEN
INSERT INTO tabstock qty
(name, item_code,uom,in_qty,store_name,creation,drum_no,modified,modified_by,owner,docstatus,parent)
VALUES (new.name, new.item_code,new.uom,new.qty,new.t_warehouse,new.creation,new.batch_no,new.modified,new.modified_by,new.owner,new.docstatus,new.parent);
#END IF;
END IF;
CLOSE CUR2;
END;
END)
I can’t understand what exactly is the problem
I apologize that the translation has lost some details.
I appreciate your help.