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.
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
–
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.
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.
–
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.