How to update child table of a item table

Hi, 


I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command 

webnotes.conn.set_value(“Item Website Specification”, ?? , “label”, “Material”)
webnotes.conn.set_value(“Item Website Specification”, ?? , “description”, self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0f1a9b8-ff56-4e7a-862c-cd1c231b979c%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi, 

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command 

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0f1a9b8-ff56-4e7a-862c-cd1c231b979c%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/D86A13FD-E273-4E7F-84D7-4052F6AF1766%40gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Thanks Nabin for the info.


I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({“parentfield”: “item_website_specification”})]
if “H” not in web_specs:
ch = addchild(self.doc, ‘item_website_specification’, ‘Item Website Specification’, self.doclist)
ch.label = “H”
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

Another couple of queries are:
  • How could I ensure that if “H” exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use “addchild()” function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi, 

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command 

webnotes.conn.set_value(“Item Website Specification”, ?? , “label”, “Material”)
webnotes.conn.set_value(“Item Website Specification”, ?? , “description”, self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-dev…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/e0f1a9b8-ff56-4e7a-862c-cd1c231b979c%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 


I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi,

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CANn8SWJ6qev%3DmjrkaEd5G02EFBKDqdOMF2B4xcd74mAG3H_oag%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi Rushabh,


Seems like the code is running fine. I have checked the report on item website specification and found out that the code is running properly but the field generated by the server script is not showing in the item but it shows up in the report.

Let me know what is to be done by me or is it a bug. 

PS: I have tried to clear cache and refresh but still the filed created by the script is not showing up.

On Monday, May 27, 2013 11:14:21 AM UTC+5:30, rushabh wrote:

I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


 
Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi, 

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command 

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-dev…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/66559587-2858-4822-9c0a-b337f86833b8%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Another thing I have noticed is that the field created by the server script does not show up in the website as well.




On Monday, June 10, 2013 2:51:59 AM UTC+5:30, Addy wrote:
Hi Rushabh,

Seems like the code is running fine. I have checked the report on item website specification and found out that the code is running properly but the field generated by the server script is not showing in the item but it shows up in the report.

Let me know what is to be done by me or is it a bug. 

PS: I have tried to clear cache and refresh but still the filed created by the script is not showing up.

On Monday, May 27, 2013 11:14:21 AM UTC+5:30, rushabh wrote:

I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


 
Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi, 

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command 

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/273ac72c-f8f6-44f2-9ed7-4e89bff8af6b%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Are you mis-typing the fieldname? Is it hidden? Can't think of anything else. If its there in the database, it should show up in the form.


On Mon, Jun 10, 2013 at 2:51 AM, Addy <ad...@rigpl.com> wrote:
Hi Rushabh,

Seems like the code is running fine. I have checked the report on item website specification and found out that the code is running properly but the field generated by the server script is not showing in the item but it shows up in the report.

Let me know what is to be done by me or is it a bug.

PS: I have tried to clear cache and refresh but still the filed created by the script is not showing up.

On Monday, May 27, 2013 11:14:21 AM UTC+5:30, rushabh wrote:

I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi,

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-dev…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/66559587-2858-4822-9c0a-b337f86833b8%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.














You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CANn8SW%2BY2xJGW-3VKpOD4bbupFs-dfm0Nn2_kB5n7Q-9P1JTog%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

How could the field be hidden, I am unable to find a reason for not able to view only that field which is created by server script other fields in the table for the same item are showing properly which were created manually.

Here are the screen shots:

For Item
Inline image 1

For Item Website specification Report:

Inline image 2


And Finally the screen shot of the webpage of the item:


Inline image 3



On Mon, Jun 10, 2013 at 10:38 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Are you mis-typing the fieldname? Is it hidden? Can't think of anything else. If its there in the database, it should show up in the form.


On Mon, Jun 10, 2013 at 2:51 AM, Addy <ad…@rigpl.com> wrote:

Hi Rushabh,

Seems like the code is running fine. I have checked the report on item website specification and found out that the code is running properly but the field generated by the server script is not showing in the item but it shows up in the report.

Let me know what is to be done by me or is it a bug.

PS: I have tried to clear cache and refresh but still the filed created by the script is not showing up.

On Monday, May 27, 2013 11:14:21 AM UTC+5:30, rushabh wrote:

I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi,

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-dev…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/66559587-2858-4822-9c0a-b337f86833b8%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.














You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CANn8SW%2BY2xJGW-3VKpOD4bbupFs-dfm0Nn2_kB5n7Q-9P1JTog%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHzxMFjXSfp6Ue1wnAM20C_5B5fGhHt3fHtDp%2B%2B-FASuyg%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi Aditya,

In what function have you written the server script?

Possibly, after adding the children, the Item record is not getting saved.

Thanks,
Anand.

On 10-Jun-2013, at 11:22 AM, Aditya Duggal <ad...@rigpl.com> wrote:

How could the field be hidden, I am unable to find a reason for not able to view only that field which is created by server script other fields in the table for the same item are showing properly which were created manually.

Here are the screen shots:

For Item
<image.png>

For Item Website specification Report:

<image.png>


And Finally the screen shot of the webpage of the item:


<image.png>



On Mon, Jun 10, 2013 at 10:38 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Are you mis-typing the fieldname? Is it hidden? Can't think of anything else. If its there in the database, it should show up in the form.


On Mon, Jun 10, 2013 at 2:51 AM, Addy <ad…@rigpl.com> wrote:

Hi Rushabh,

Seems like the code is running fine. I have checked the report on item website specification and found out that the code is running properly but the field generated by the server script is not showing in the item but it shows up in the report.

Let me know what is to be done by me or is it a bug. 

PS: I have tried to clear cache and refresh but still the filed created by the script is not showing up.

On Monday, May 27, 2013 11:14:21 AM UTC+5:30, rushabh wrote:

I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


 
Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi, 

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command 

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-dev…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/66559587-2858-4822-9c0a-b337f86833b8%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 











You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CANn8SW%2BY2xJGW-3VKpOD4bbupFs-dfm0Nn2_kB5n7Q-9P1JTog%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHzxMFjXSfp6Ue1wnAM20C_5B5fGhHt3fHtDp%2B%2B-FASuyg%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1698082C-4A46-4029-B308-29148FF703D2%40erpnext.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi Anand,

The function for the website specifications is below which is called on line no: 536 of gist

self.fn_add_item_website_specifications()

The function is defined in line no: 377.

Let me know if you find the anomaly.



On Mon, Jun 10, 2013 at 11:26 AM, Anand Doshi <an...@iwebnotes.com> wrote:
Hi Aditya,

In what function have you written the server script?

Possibly, after adding the children, the Item record is not getting saved.

Thanks,
Anand.

On 10-Jun-2013, at 11:22 AM, Aditya Duggal <ad...@rigpl.com> wrote:


How could the field be hidden, I am unable to find a reason for not able to view only that field which is created by server script other fields in the table for the same item are showing properly which were created manually.


Here are the screen shots:

For Item
<image.png>

For Item Website specification Report:

<image.png>


And Finally the screen shot of the webpage of the item:


<image.png>



On Mon, Jun 10, 2013 at 10:38 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Are you mis-typing the fieldname? Is it hidden? Can't think of anything else. If its there in the database, it should show up in the form.


On Mon, Jun 10, 2013 at 2:51 AM, Addy <ad…@rigpl.com> wrote:

Hi Rushabh,

Seems like the code is running fine. I have checked the report on item website specification and found out that the code is running properly but the field generated by the server script is not showing in the item but it shows up in the report.

Let me know what is to be done by me or is it a bug.

PS: I have tried to clear cache and refresh but still the filed created by the script is not showing up.

On Monday, May 27, 2013 11:14:21 AM UTC+5:30, rushabh wrote:

I have tried to run the below mentioned code but I guess something is wrong, though I am not getting any error code.

def fn_add_item_website_specifications(self):
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia

Surely I have called the function as self.fn_add_item_website_specifications

did you call it with a () in the end? as in self.fn_add_item_website_specifications()

also, try an put a msgprint if it shows up.


Another couple of queries are:
  • How could I ensure that if "H" exists in Label then the value for the same is updated in the system against that item since I could not find any code for the same in the item.py file.
  • self.doc.web_long_description = desc_web where desc_web is a String. Now this is supposed to update the website description every time the item is edited but it does so only once and if we delete the website description then it does not update the description, again I am not getting any error code.

On Saturday, May 25, 2013 4:49:57 PM UTC+5:30, Nabin Hait wrote:
You should use "addchild()" function to add a new row in child table.
For example you can check add_default_uom_in_conversion_factor_table() function in item.py file. Basically addchild() function create an document object for row and return it. Then you can assign any column value using that object.

On 25-May-2013, at 3:08 PM, Addy wrote:

Hi,

I would like to update a child table of the item master via custom script and I am unable to figure out a way to do so. Basically, I am looking to update the item website specification table automatically since all the details are there in my item master vide custom fields.

Now I think that the command

webnotes.conn.set_value("Item Website Specification", ?? , "label", "Material")
webnotes.conn.set_value("Item Website Specification", ?? , "description", self.doc.base_material)

should work but I am stuck at this since I am unable to find a way to know the id of the child table, since I want this value to update the first row of the table.

Any suggestions.

Regards,

Aditya Duggal



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsubscr…@googlegroups.com.


To post to this group, send email to erpnext-dev…@googlegroups.com.




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-dev…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/de1633f4-157a-4e11-b030-9bf7a665cc1b%40googlegroups.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





--



Twitter: @rushabh_mehta



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/66559587-2858-4822-9c0a-b337f86833b8%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.















You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CANn8SW%2BY2xJGW-3VKpOD4bbupFs-dfm0Nn2_kB5n7Q-9P1JTog%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.






You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHzxMFjXSfp6Ue1wnAM20C_5B5fGhHt3fHtDp%2B%2B-FASuyg%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1698082C-4A46-4029-B308-29148FF703D2%40erpnext.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHwi85S4J-USV2gWGaWCSkgFU5rvd9SXorVW%2Bv6rBfrRvA%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Aditya,

Can you send your latest script on gist?

You need to set 3 properties to make it show correctly as a child record: parent, parenttype, parentfield

It seems one of those fields is not set correctly

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 10-Jun-2013, at 11:22 AM, Aditya Duggal <ad...@rigpl.com> wrote:

<image.png>



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CB139B9B-ACD1-484E-99B3-5FB7787EEAF8%40erpnext.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

The latest gist in the last post of mine maybe we were typing at the same time anyhow I am still sending the link for the same.

Here is the latest GIST

Also I am not able to understand the requirement for 3 fields since in the item website specification I can see only one field which is parent.

Here is the function which I am using to update the item website specification table.

def fn_add_item_website_specifications(self):
webnotes.msgprint("Function Line 1")
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
webnotes.msgprint(web_specs)
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia


On Mon, Jun 10, 2013 at 11:34 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Aditya,

Can you send your latest script on gist?

You need to set 3 properties to make it show correctly as a child record: parent, parenttype, parentfield

It seems one of those fields is not set correctly

best,
Rushabh

On 10-Jun-2013, at 11:22 AM, Aditya Duggal <ad...@rigpl.com> wrote:

<image.png>



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CB139B9B-ACD1-484E-99B3-5FB7787EEAF8%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHyc1bMX%2BTX77pMW17hCVyP4cJY5-mnxP98wyFw%3DhV%2BWuQ%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Aditya,

There is a typo in the table fieldname

ch = addchild(self.doc, 'item_website_specifications', 'Item Website Specification', self.doclist)

It should be item_website_specifications with an "s" at the end.

In future, we will throw a validation if such a typo exists.

best,
Rushabh



W: https://erpnext.com
T: @rushabh_mehta

On 10-Jun-2013, at 11:42 AM, Aditya Duggal <ad...@rigpl.com> wrote:

The latest gist in the last post of mine maybe we were typing at the same time anyhow I am still sending the link for the same.

Here is the latest GIST

Also I am not able to understand the requirement for 3 fields since in the item website specification I can see only one field which is parent.

Here is the function which I am using to update the item website specification table.

def fn_add_item_website_specifications(self):
webnotes.msgprint("Function Line 1")
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
webnotes.msgprint(web_specs)
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia


On Mon, Jun 10, 2013 at 11:34 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Aditya,

Can you send your latest script on gist?

You need to set 3 properties to make it show correctly as a child record: parent, parenttype, parentfield

It seems one of those fields is not set correctly

best,
Rushabh

On 10-Jun-2013, at 11:22 AM, Aditya Duggal <ad...@rigpl.com> wrote:

<image.png>




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CB139B9B-ACD1-484E-99B3-5FB7787EEAF8%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHyc1bMX%2BTX77pMW17hCVyP4cJY5-mnxP98wyFw%3DhV%2BWuQ%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/79E9C825-0981-4763-A37A-CF2CB17CF2E6%40erpnext.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Thanks Rushabh

That typo has caused a lot of delays for me.....ahhh what a small oversight can do
.


On Mon, Jun 10, 2013 at 11:47 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Aditya,

There is a typo in the table fieldname

ch = addchild(self.doc, 'item_website_specifications', 'Item Website Specification', self.doclist)

It should be item_website_specifications with an "s" at the end.

In future, we will throw a validation if such a typo exists.

best,
Rushabh
On 10-Jun-2013, at 11:42 AM, Aditya Duggal <ad...@rigpl.com> wrote:

The latest gist in the last post of mine maybe we were typing at the same time anyhow I am still sending the link for the same.

Here is the latest GIST

Also I am not able to understand the requirement for 3 fields since in the item website specification I can see only one field which is parent.

Here is the function which I am using to update the item website specification table.

def fn_add_item_website_specifications(self):
webnotes.msgprint("Function Line 1")
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
webnotes.msgprint(web_specs)
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia


On Mon, Jun 10, 2013 at 11:34 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Aditya,

Can you send your latest script on gist?

You need to set 3 properties to make it show correctly as a child record: parent, parenttype, parentfield

It seems one of those fields is not set correctly

best,
Rushabh

On 10-Jun-2013, at 11:22 AM, Aditya Duggal <ad...@rigpl.com> wrote:

<image.png>




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CB139B9B-ACD1-484E-99B3-5FB7787EEAF8%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.






You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHyc1bMX%2BTX77pMW17hCVyP4cJY5-mnxP98wyFw%3DhV%2BWuQ%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/79E9C825-0981-4763-A37A-CF2CB17CF2E6%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.





You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHyoEvMHKVnW5fA9PzjEFdezyWMAbKp_L9OcAAy99K_EuA%40mail.gmail.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi,


Now I just wanted to know if it is possible to update the child table if a value exists since we are adding a new value if the item does not exist.
The print value of [d] is:

[{u’__islocal’: None, u’description’: 9.5250000000000004, u’parent’:
u’H1SQR3PN9’, u’__newname’: None, u’creation’: u’2013-06-10 17:47:00’,
u’modified’: ‘2013-06-10 17:48:50’, u’__modified’: None, u’owner’:
u’Administrator’, u’_user_tags’: None, u’modified_by’: u’Administrator’,
u’name’: u’000217854’, u’idx’: 7, u’__temp’: None, u’doctype’: u’Item
Website Specification’, u’label’: None, u’parenttype’: u’Item’,
u’docstatus’: 0, u’parentfield’: u’item_website_specifications’}]

Basically I want to modify my code as below but I am unable to fetch the name of the line in child table:

if “H (mm)” not in web_specs:
ch = addchild(self.doc, ‘item_website_specifications’, ‘Item Website Specification’, self.doclist)
ch.label = “H (mm)”
ch.description = self.doc.height_dia
else:
ch = amend(self.doc, ‘item_website_specifications’, ‘Item Website Specification’, self.doclist)
ch.description = self.doc.height_dia where item_website_specifications.name = d[10]
Something on the above lines but I am not sure about 2 things one is amend part marked in red and also how to call the id of the line since d[10] would throw an error.

On Monday, June 10, 2013 1:31:40 PM UTC+5:30, Addy wrote:
Thanks Rushabh

That typo has caused a lot of delays for me…ahhh what a small oversight can do
.



Aditya,

There is a typo in the table fieldname

ch = addchild(self.doc, 'item_website_specifications', 'Item Website Specification', self.doclist)

It should be item_website_specifications with an "s" at the end.

In future, we will throw a validation if such a typo exists.

best,
Rushabh


The latest gist in the last post of mine maybe we were typing at the same time anyhow I am still sending the link for the same.

Here is the latest GIST

Also I am not able to understand the requirement for 3 fields since in the item website specification I can see only one field which is parent.

Here is the function which I am using to update the item website specification table.

def fn_add_item_website_specifications(self):
webnotes.msgprint("Function Line 1")
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
webnotes.msgprint(web_specs)
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia


On Mon, Jun 10, 2013 at 11:34 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Aditya,

Can you send your latest script on gist?

You need to set 3 properties to make it show correctly as a child record: parent, parenttype, parentfield

It seems one of those fields is not set correctly

best,
Rushabh

On 10-Jun-2013, at 11:22 AM, Aditya Duggal 

<image.png>




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-developer-forum@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CB139B9B-ACD1-484E-99B3-5FB7787EEAF8%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-developer-forum@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHyc1bMX%2BTX77pMW17hCVyP4cJY5-mnxP98wyFw%3DhV%2BWuQ%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-developer-forum@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/79E9C825-0981-4763-A37A-CF2CB17CF2E6%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3ffc93f4-1503-471e-987c-39bd99ec5ed1%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi Aditya,

You can use:
ch = self.doclist.getone({"parent field": "item_website_specifications", "label": "H (mm)"})
ch.description = something

in the else part.

Thanks,
Anand.

On 10-Jun-2013, at 5:53 PM, Addy <ad...@rigpl.com> wrote:

Hi,

Now I just wanted to know if it is possible to update the child table if a value exists since we are adding a new value if the item does not exist.
The print value of [d] is:

[{u'__islocal': None, u'description': 9.5250000000000004, u'parent': u'H1SQR3PN9', u'__newname': None, u'creation': u'2013-06-10 17:47:00', u'modified': '2013-06-10 17:48:50', u'__modified': None, u'owner': u'Administrator', u'_user_tags': None, u'modified_by': u'Administrator', u'name': u'000217854', u'idx': 7, u'__temp': None, u'doctype': u'Item Website Specification', u'label': None, u'parenttype': u'Item', u'docstatus': 0, u'parentfield': u'item_website_specifications'}]

Basically I want to modify my code as below but I am unable to fetch the name of the line in child table:

if "H (mm)" not in web_specs:
ch = addchild(self.doc, 'item_website_specifications', 'Item Website Specification', self.doclist)
ch.label = "H (mm)"
ch.description = self.doc.height_dia
else:
ch = amend(self.doc, 'item_website_specifications', 'Item Website Specification', self.doclist)
ch.description = self.doc.height_dia where item_website_specifications.name = d[10]
Something on the above lines but I am not sure about 2 things one is amend part marked in red and also how to call the id of the line since d[10] would throw an error.

On Monday, June 10, 2013 1:31:40 PM UTC+5:30, Addy wrote:
Thanks Rushabh

That typo has caused a lot of delays for me.....ahhh what a small oversight can do
.



Aditya,

There is a typo in the table fieldname

ch = addchild(self.doc, 'item_website_specifications', 'Item Website Specification', self.doclist)

It should be item_website_specifications with an "s" at the end.

In future, we will throw a validation if such a typo exists.

best,
Rushabh


The latest gist in the last post of mine maybe we were typing at the same time anyhow I am still sending the link for the same.

Here is the latest GIST

Also I am not able to understand the requirement for 3 fields since in the item website specification I can see only one field which is parent.

Here is the function which I am using to update the item website specification table.

def fn_add_item_website_specifications(self):
webnotes.msgprint("Function Line 1")
web_specs = [d.label for d in self.doclist.get({"parentfield": "item_website_specification"})]
webnotes.msgprint(web_specs)
if "H" not in web_specs:
ch = addchild(self.doc, 'item_website_specification', 'Item Website Specification', self.doclist)
ch.label = "H"
ch.description = self.doc.height_dia


On Mon, Jun 10, 2013 at 11:34 AM, Rushabh Mehta <rm…@gmail.com> wrote:

Aditya,

Can you send your latest script on gist?

You need to set 3 properties to make it show correctly as a child record: parent, parenttype, parentfield

It seems one of those fields is not set correctly

best,
Rushabh

On 10-Jun-2013, at 11:22 AM, Aditya Duggal 

<image.png>




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-developer-forum@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CB139B9B-ACD1-484E-99B3-5FB7787EEAF8%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-developer-forum@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAEmKBHyc1bMX%2BTX77pMW17hCVyP4cJY5-mnxP98wyFw%3DhV%2BWuQ%40mail.gmail.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to erpnext-developer-forum@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/79E9C825-0981-4763-A37A-CF2CB17CF2E6%40erpnext.com?hl=en.


For more options, visit https://groups.google.com/groups/opt_out.
 
 




You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3ffc93f4-1503-471e-987c-39bd99ec5ed1%40googlegroups.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/0F2E013A-680B-4A29-8E3E-98CB98CAB48C%40erpnext.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

correction:

ch = self.doclist.getone({"parentfield": "item_website_specifications", "label": "H (mm)"})
ch.description = something

On 10-Jun-2013, at 6:10 PM, Anand Doshi <an...@iwebnotes.com> wrote:

ch = self.doclist.getone({"parent field": "item_website_specifications", "label": "H (mm)"})
ch.description = something



You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/FBF5666A-D1B3-452F-8D9E-895D163FE3F2%40erpnext.com?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.