How to use "Saler Order Item " Form in our custom Form

I have a custom doctype “Contract” in which I am usig the “Sale order item” Doc type
as table data type but problem is that when i am selecting any item code from the drop down then textboxes or readonlt fileds are not automatically fill .
But in Sale Order Form same thing is working when user Selecting any item_code from the drop down.
help me Please.
Thanks

@Baljeetsingh, the things in Frappe framework, are not too silly than copy and paste, do you need create a controller to manage the events, when a field is filled! Don’t matter if you are reusing a Child Table in another place, it dont will work, how it’s work by desine in the standard doctype!

Take a look into the code of Sales Order it will help you to understand where are you failling!

@max_morais_dmm
can you help me little more I want to show the same structure of sale order item table in our custom form Contract which user are able to show in sale order form

results of my cuatom form
my custom Form Shown the result of Items table like this but


but i want as under flow so please suggest me what i will do to achieve this

If anybody have answer of it please reply Thanks
Baljeet Singh

@Baljeetsingh in the Sales Order python controller, has a section form_grid_templates, it solve your issue!

1 Like

@max_morais_dmm how i will use it If you dont mind need more info like where i will use that code and how I will get And is it possible to use in custom script like js

Again @Baljeetsingh, certain things are not silly in frappe!

By design, you are not allowed to customize a grid in the client side! Do you need create a grid template in your backed use the form_grid_templates to register it.

So, when the client side loads the content from the backend it will be rendered!

so need little help more can you tell me where i will find all the the things like where i will create custom template and regiter part ?
thanks

@Baljeetsingh

You should create the template in the templates/form-grid/ folder of your app

To do the register, just open your doctype Python controler, inside the module into your app, and add

form_grid_templates = {
  "my_fieldname": "myapp/templates/form-grid/my-form-grid.html"
} 

@max_morais_dmm I have crated the html part at required place
see un the screen shot

but not able to find py file in structure can you help me where i will get dpctype controller py file

@Baljeetsingh

It would be in contract folder, contract.py

@Nick see its also empty
any thing else which help me