Hi I’d like to call a method which is located inside a class from js. The method is located in stock_entry.py (apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py)
@ccfiel
In your previous comment, I clearly understood that I need to supply StockController for StockEntry class. Similarly, for this StockController, there needs to be AccountsController. And for AccountsController there’s TransactionBase and for TransactionBase there’s StatusUpdater and for StatusUpdater there’s Document parameter and finally for Document there should be BaseDocument. I tried all those before posting this question here.
The code what I’ve tried is in the below screenshot, which didn’t work either. I know that object parameter should be passed in BaseDocument (highlighted in the image)… but don’t know what should be that object.
What object should be passed to this BaseDocument??
I really appreciate your replies to my question, but as I feel this conversation is becoming lengthy without actual solution, It would be excellent if you can help me by telling HOW EXACTLY WE CAN MAKE A CALL TO THAT StockEntry() FUNCTION
Sorry if I’m giving you pain but I’d be extremely thankful to you if you can provide me a simple example (a working piece of code) which can call that function.
I think the question is what are trying to do? Do you want to add record in stock entry doctype? If it is the case you are doing it wrong. You can use frappe.get_doc or use. save()
I’ve another new doctype where repack in StockEntry is simplified. I’m using that new doctype for people who are not aware of how to use Stock Entry doctype to do repack of goods. Now I need to call the same submit action of StockEntry after clicking on Submit in new doctype. I’ll be sending data to that on_submit of Stock Entry.
As an example,
I created EasyRepack doctype.
Users will input Items Taken, Taken From Warehouse, Items Given and Given To Warehouse field.
Mapping will be done in backend like Taken From Warehouse maps to Source Warehouse and Given To Warehouse maps to Target Warehouse and also other fields will be mapped accordingly.
And then finally call submit method of Stock Entry
Hope you get what I’m trying to do. Please let me know if it still not clear.
Thanks @ccfiel,
We are using what you have said earlier but with a small problem in it. So trying in other way to overcome. But anyways got the solution by this approach (the approach you said in the previous post).
Document mapping to create a necessary Stock Entry DocType is the best approach.