blob: 7e7fb2e1035794994b7156d53399dbccf9c044da [file] [log] [blame]
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
2# License: GNU General Public License v3. See license.txt
Anand Doshiabc10032013-06-14 17:44:03 +05303
4from __future__ import unicode_literals
5import webnotes
Anand Doshi2ac0a832013-07-10 20:49:44 +05306from webnotes import msgprint, _
Anand Doshiabc10032013-06-14 17:44:03 +05307import webnotes.defaults
Anand Doshi2ac0a832013-07-10 20:49:44 +05308from webnotes.utils import flt, get_fullname, fmt_money, cstr
Anand Doshiabc10032013-06-14 17:44:03 +05309
Anand Doshi3dceb842013-06-19 14:57:14 +053010class WebsitePriceListMissingError(webnotes.ValidationError): pass
Anand Doshie8132122013-06-17 15:42:38 +053011
Anand Doshi2ac0a832013-07-10 20:49:44 +053012def set_cart_count(quotation=None):
13 if not quotation:
14 quotation = _get_cart_quotation()
15 webnotes.add_cookies["cart_count"] = cstr(len(quotation.doclist.get(
16 {"parentfield": "quotation_details"})) or "")
17
Anand Doshie8132122013-06-17 15:42:38 +053018@webnotes.whitelist()
Anand Doshiedbf3e12013-07-02 11:40:16 +053019def get_cart_quotation(doclist=None):
20 party = get_lead_or_customer()
21
22 if not doclist:
Anand Doshi2ac0a832013-07-10 20:49:44 +053023 quotation = _get_cart_quotation(party)
24 doclist = quotation.doclist
25 set_cart_count(quotation)
Anand Doshiedbf3e12013-07-02 11:40:16 +053026
27 return {
28 "doclist": decorate_quotation_doclist(doclist),
29 "addresses": [{"name": address.name, "display": address.display}
Anand Doshi0b4943c2013-07-04 23:45:22 +053030 for address in get_address_docs(party)],
31 "shipping_rules": get_applicable_shipping_rules(party)
Anand Doshiedbf3e12013-07-02 11:40:16 +053032 }
Anand Doshi2ac0a832013-07-10 20:49:44 +053033
34@webnotes.whitelist()
35def place_order():
36 quotation = _get_cart_quotation()
37 controller = quotation.make_controller()
38 for fieldname in ["customer_address", "shipping_address_name"]:
39 if not quotation.doc.fields.get(fieldname):
40 msgprint(_("Please select a") + " " + _(controller.meta.get_label(fieldname)), raise_exception=True)
41
42 quotation.ignore_permissions = True
43 quotation.submit()
44
45 from selling.doctype.quotation.quotation import _make_sales_order
46 sales_order = webnotes.bean(_make_sales_order(quotation.doc.name, ignore_permissions=True))
47 sales_order.ignore_permissions = True
48 sales_order.insert()
49 sales_order.submit()
50 webnotes.add_cookies["cart_count"] = ""
51
52 return sales_order.doc.name
Anand Doshiedbf3e12013-07-02 11:40:16 +053053
54@webnotes.whitelist()
Anand Doshic2a35272013-06-19 17:19:20 +053055def update_cart(item_code, qty, with_doclist=0):
Anand Doshi3dceb842013-06-19 14:57:14 +053056 quotation = _get_cart_quotation()
Anand Doshiabc10032013-06-14 17:44:03 +053057
Anand Doshi0b4943c2013-07-04 23:45:22 +053058 qty = flt(qty)
Anand Doshi3dceb842013-06-19 14:57:14 +053059 if qty == 0:
Anand Doshie8132122013-06-17 15:42:38 +053060 quotation.set_doclist(quotation.doclist.get({"item_code": ["!=", item_code]}))
Anand Doshicefccb92013-07-15 18:28:14 +053061 if not quotation.doclist.get({"parentfield": "quotation_details"}) and \
62 not quotation.doc.fields.get("__islocal"):
63 quotation.__delete = True
64
Anand Doshie8132122013-06-17 15:42:38 +053065 else:
66 quotation_items = quotation.doclist.get({"item_code": item_code})
67 if not quotation_items:
68 quotation.doclist.append({
69 "doctype": "Quotation Item",
70 "parentfield": "quotation_details",
71 "item_code": item_code,
Anand Doshi3dceb842013-06-19 14:57:14 +053072 "qty": qty
Anand Doshie8132122013-06-17 15:42:38 +053073 })
74 else:
Anand Doshi3dceb842013-06-19 14:57:14 +053075 quotation_items[0].qty = qty
Anand Doshiabc10032013-06-14 17:44:03 +053076
Anand Doshi0b4943c2013-07-04 23:45:22 +053077 apply_cart_settings(quotation=quotation)
Anand Doshi2862c9e2013-07-08 18:50:33 +053078
Anand Doshicefccb92013-07-15 18:28:14 +053079 if hasattr(quotation, "__delete"):
80 webnotes.delete_doc("Quotation", quotation.doc.name, ignore_permissions=True)
81 quotation = _get_cart_quotation()
82 else:
83 quotation.ignore_permissions = True
84 quotation.save()
Anand Doshiabc10032013-06-14 17:44:03 +053085
Anand Doshi2ac0a832013-07-10 20:49:44 +053086 set_cart_count(quotation)
87
Anand Doshic2a35272013-06-19 17:19:20 +053088 if with_doclist:
Anand Doshiedbf3e12013-07-02 11:40:16 +053089 return get_cart_quotation(quotation.doclist)
Anand Doshic2a35272013-06-19 17:19:20 +053090 else:
91 return quotation.doc.name
Anand Doshiedbf3e12013-07-02 11:40:16 +053092
93@webnotes.whitelist()
94def update_cart_address(address_fieldname, address_name):
95 from utilities.transaction_base import get_address_display
96
97 quotation = _get_cart_quotation()
98 address_display = get_address_display(webnotes.doc("Address", address_name).fields)
99
100 if address_fieldname == "shipping_address_name":
101 quotation.doc.shipping_address_name = address_name
102 quotation.doc.shipping_address = address_display
103
104 if not quotation.doc.customer_address:
105 address_fieldname == "customer_address"
106
107 if address_fieldname == "customer_address":
108 quotation.doc.customer_address = address_name
109 quotation.doc.address_display = address_display
110
111
Anand Doshi2862c9e2013-07-08 18:50:33 +0530112 apply_cart_settings(quotation=quotation)
113
Anand Doshiedbf3e12013-07-02 11:40:16 +0530114 quotation.ignore_permissions = True
115 quotation.save()
116
117 return get_cart_quotation(quotation.doclist)
118
119@webnotes.whitelist()
120def get_addresses():
121 return [d.fields for d in get_address_docs()]
122
123@webnotes.whitelist()
124def save_address(fields, address_fieldname=None):
125 party = get_lead_or_customer()
126 fields = webnotes.load_json(fields)
127
128 if fields.get("name"):
129 bean = webnotes.bean("Address", fields.get("name"))
130 else:
131 bean = webnotes.bean({"doctype": "Address", "__islocal": 1})
132
133 bean.doc.fields.update(fields)
134
135 party_fieldname = party.doctype.lower()
136 bean.doc.fields.update({
137 party_fieldname: party.name,
138 (party_fieldname + "_name"): party.fields[party_fieldname + "_name"]
139 })
140 bean.ignore_permissions = True
141 bean.save()
142
143 if address_fieldname:
144 update_cart_address(address_fieldname, bean.doc.name)
145
146 return bean.doc.name
147
148def get_address_docs(party=None):
149 from webnotes.model.doclist import objectify
150 from utilities.transaction_base import get_address_display
151
152 if not party:
153 party = get_lead_or_customer()
154
155 address_docs = objectify(webnotes.conn.sql("""select * from `tabAddress`
156 where `%s`=%s order by name""" % (party.doctype.lower(), "%s"), party.name,
157 as_dict=True, update={"doctype": "Address"}))
158
159 for address in address_docs:
160 address.display = get_address_display(address.fields)
161 address.display = (address.display).replace("\n", "<br>\n")
162
163 return address_docs
Anand Doshie8132122013-06-17 15:42:38 +0530164
Anand Doshiabc10032013-06-14 17:44:03 +0530165def get_lead_or_customer():
166 customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, "customer")
167 if customer:
168 return webnotes.doc("Customer", customer)
169
170 lead = webnotes.conn.get_value("Lead", {"email_id": webnotes.session.user})
171 if lead:
172 return webnotes.doc("Lead", lead)
173 else:
174 lead_bean = webnotes.bean({
175 "doctype": "Lead",
176 "email_id": webnotes.session.user,
177 "lead_name": get_fullname(webnotes.session.user),
Anand Doshi99100a42013-07-04 17:13:53 +0530178 "territory": guess_territory(),
Anand Doshiabc10032013-06-14 17:44:03 +0530179 "status": "Open" # TODO: set something better???
180 })
Anand Doshiabc10032013-06-14 17:44:03 +0530181
Anand Doshi2862c9e2013-07-08 18:50:33 +0530182 if webnotes.session.user != "Guest":
183 lead_bean.ignore_permissions = True
184 lead_bean.insert()
185
Anand Doshiabc10032013-06-14 17:44:03 +0530186 return lead_bean.doc
Anand Doshi99100a42013-07-04 17:13:53 +0530187
188def guess_territory():
189 territory = None
190 geoip_country = webnotes.session.get("session_country")
191 if geoip_country:
192 territory = webnotes.conn.get_value("Territory", geoip_country)
193
194 return territory or \
195 webnotes.conn.get_value("Shopping Cart Settings", None, "territory") or \
196 "All Territories"
Anand Doshi3dceb842013-06-19 14:57:14 +0530197
Anand Doshic2a35272013-06-19 17:19:20 +0530198def decorate_quotation_doclist(doclist):
199 for d in doclist:
200 if d.item_code:
201 d.fields.update(webnotes.conn.get_value("Item", d.item_code,
Anand Doshicefccb92013-07-15 18:28:14 +0530202 ["website_image", "description", "page_name"], as_dict=True))
Anand Doshic2a35272013-06-19 17:19:20 +0530203 d.formatted_rate = fmt_money(d.export_rate, currency=doclist[0].currency)
204 d.formatted_amount = fmt_money(d.export_amount, currency=doclist[0].currency)
Anand Doshi0b4943c2013-07-04 23:45:22 +0530205 elif d.charge_type:
206 d.formatted_tax_amount = fmt_money(d.tax_amount / doclist[0].conversion_rate,
207 currency=doclist[0].currency)
Anand Doshic2a35272013-06-19 17:19:20 +0530208
Anand Doshi0b4943c2013-07-04 23:45:22 +0530209 doclist[0].formatted_grand_total_export = fmt_money(doclist[0].grand_total_export,
210 currency=doclist[0].currency)
211
Anand Doshic2a35272013-06-19 17:19:20 +0530212 return [d.fields for d in doclist]
Anand Doshi3dceb842013-06-19 14:57:14 +0530213
214def _get_cart_quotation(party=None):
215 if not party:
216 party = get_lead_or_customer()
217
Anand Doshiabc10032013-06-14 17:44:03 +0530218 quotation = webnotes.conn.get_value("Quotation",
219 {party.doctype.lower(): party.name, "order_type": "Shopping Cart", "docstatus": 0})
220
221 if quotation:
222 qbean = webnotes.bean("Quotation", quotation)
223 else:
224 qbean = webnotes.bean({
225 "doctype": "Quotation",
Anand Doshicefccb92013-07-15 18:28:14 +0530226 "naming_series": webnotes.defaults.get_user_default("shopping_cart_quotation_series") or "QTN-CART-",
Anand Doshic2a35272013-06-19 17:19:20 +0530227 "quotation_to": party.doctype,
Anand Doshiabc10032013-06-14 17:44:03 +0530228 "company": webnotes.defaults.get_user_default("company"),
229 "order_type": "Shopping Cart",
230 "status": "Draft",
Anand Doshi65f5c582013-08-21 19:36:23 +0530231 "docstatus": 0,
Anand Doshiabc10032013-06-14 17:44:03 +0530232 "__islocal": 1,
Anand Doshiabc10032013-06-14 17:44:03 +0530233 (party.doctype.lower()): party.name
234 })
Anand Doshi2ac0a832013-07-10 20:49:44 +0530235
Anand Doshicefccb92013-07-15 18:28:14 +0530236 if party.doctype == "Customer":
237 qbean.doc.contact_person = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user,
238 "customer": party.name})
239 qbean.run_method("set_contact_fields")
Anand Doshi2ac0a832013-07-10 20:49:44 +0530240
Anand Doshi99100a42013-07-04 17:13:53 +0530241 qbean.run_method("onload_post_render")
242 apply_cart_settings(party, qbean)
Anand Doshiabc10032013-06-14 17:44:03 +0530243
244 return qbean
Anand Doshi2ac0a832013-07-10 20:49:44 +0530245
246def update_party(fullname, company_name=None, mobile_no=None, phone=None):
247 party = get_lead_or_customer()
248
249 if party.doctype == "Lead":
250 party.company_name = company_name
251 party.lead_name = fullname
252 party.mobile_no = mobile_no
253 party.phone = phone
254 else:
255 party.customer_name = company_name or fullname
256 party.customer_type == "Company" if company_name else "Individual"
257
258 contact_name = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user,
259 "customer": party.name})
260 contact = webnotes.bean("Contact", contact_name)
261 contact.doc.first_name = fullname
262 contact.doc.last_name = None
263 contact.doc.customer_name = party.customer_name
264 contact.doc.mobile_no = mobile_no
265 contact.doc.phone = phone
266 contact.ignore_permissions = True
267 contact.save()
Anand Doshiabc10032013-06-14 17:44:03 +0530268
Anand Doshi2ac0a832013-07-10 20:49:44 +0530269 party_bean = webnotes.bean(party.fields)
270 party_bean.ignore_permissions = True
271 party_bean.save()
272
273 qbean = _get_cart_quotation(party)
Anand Doshicefccb92013-07-15 18:28:14 +0530274 if not qbean.doc.fields.get("__islocal"):
275 qbean.doc.customer_name = company_name or fullname
276 qbean.run_method("set_contact_fields")
277 qbean.ignore_permissions = True
278 qbean.save()
Anand Doshi2ac0a832013-07-10 20:49:44 +0530279
Anand Doshi99100a42013-07-04 17:13:53 +0530280def apply_cart_settings(party=None, quotation=None):
281 if not party:
282 party = get_lead_or_customer()
283 if not quotation:
284 quotation = _get_cart_quotation(party)
Anand Doshiabc10032013-06-14 17:44:03 +0530285
Anand Doshi99100a42013-07-04 17:13:53 +0530286 cart_settings = webnotes.get_obj("Shopping Cart Settings")
Anand Doshiabc10032013-06-14 17:44:03 +0530287
Anand Doshi99100a42013-07-04 17:13:53 +0530288 billing_territory = get_address_territory(quotation.doc.customer_address) or \
Nabin Hait6ec4b0c2013-09-26 15:45:44 +0530289 party.territory or "All Territories"
Anand Doshi2862c9e2013-07-08 18:50:33 +0530290
Anand Doshi99100a42013-07-04 17:13:53 +0530291 set_price_list_and_rate(quotation, cart_settings, billing_territory)
292
Anand Doshi99100a42013-07-04 17:13:53 +0530293 quotation.run_method("calculate_taxes_and_totals")
294
Anand Doshi0b4943c2013-07-04 23:45:22 +0530295 set_taxes(quotation, cart_settings, billing_territory)
296
297 _apply_shipping_rule(party, quotation, cart_settings)
298
Anand Doshi99100a42013-07-04 17:13:53 +0530299def set_price_list_and_rate(quotation, cart_settings, billing_territory):
300 """set price list based on billing territory"""
Rushabh Mehta4a404e92013-08-09 18:11:35 +0530301 quotation.doc.selling_price_list = cart_settings.get_price_list(billing_territory)
Anand Doshi99100a42013-07-04 17:13:53 +0530302
303 # reset values
304 quotation.doc.price_list_currency = quotation.doc.currency = \
305 quotation.doc.plc_conversion_rate = quotation.doc.conversion_rate = None
306 for item in quotation.doclist.get({"parentfield": "quotation_details"}):
307 item.ref_rate = item.adj_rate = item.export_rate = item.export_amount = None
308
309 # refetch values
310 quotation.run_method("set_price_list_and_item_details")
311
Anand Doshi2862c9e2013-07-08 18:50:33 +0530312 # set it in cookies for using in product page
Rushabh Mehta4a404e92013-08-09 18:11:35 +0530313 webnotes.cookies[b"selling_price_list"] = quotation.doc.selling_price_list
Anand Doshi2862c9e2013-07-08 18:50:33 +0530314
Anand Doshi99100a42013-07-04 17:13:53 +0530315def set_taxes(quotation, cart_settings, billing_territory):
316 """set taxes based on billing territory"""
317 quotation.doc.charge = cart_settings.get_tax_master(billing_territory)
Anand Doshiabc10032013-06-14 17:44:03 +0530318
Anand Doshi99100a42013-07-04 17:13:53 +0530319 # clear table
Anand Doshi2ac0a832013-07-10 20:49:44 +0530320 quotation.set_doclist(quotation.doclist.get({"parentfield": ["!=", "other_charges"]}))
321
Anand Doshi99100a42013-07-04 17:13:53 +0530322 # append taxes
323 controller = quotation.make_controller()
324 controller.append_taxes_from_master("other_charges", "charge")
325 quotation.set_doclist(controller.doclist)
Anand Doshi0b4943c2013-07-04 23:45:22 +0530326
327@webnotes.whitelist()
328def apply_shipping_rule(shipping_rule):
329 quotation = _get_cart_quotation()
Anand Doshi99100a42013-07-04 17:13:53 +0530330
Anand Doshi0b4943c2013-07-04 23:45:22 +0530331 quotation.doc.shipping_rule = shipping_rule
332
333 apply_cart_settings(quotation=quotation)
334
Anand Doshi2862c9e2013-07-08 18:50:33 +0530335 quotation.ignore_permissions = True
Anand Doshi0b4943c2013-07-04 23:45:22 +0530336 quotation.save()
337
338 return get_cart_quotation(quotation.doclist)
339
340def _apply_shipping_rule(party=None, quotation=None, cart_settings=None):
341 shipping_rules = get_shipping_rules(party, quotation, cart_settings)
342
343 if not shipping_rules:
344 return
345
346 elif quotation.doc.shipping_rule not in shipping_rules:
347 quotation.doc.shipping_rule = shipping_rules[0]
348
Anand Doshi99100a42013-07-04 17:13:53 +0530349 quotation.run_method("apply_shipping_rule")
Anand Doshi0b4943c2013-07-04 23:45:22 +0530350 quotation.run_method("calculate_taxes_and_totals")
351
352def get_applicable_shipping_rules(party=None, quotation=None):
353 shipping_rules = get_shipping_rules(party, quotation)
354
355 if shipping_rules:
356 rule_label_map = webnotes.conn.get_values("Shipping Rule", shipping_rules, "label")
357 # we need this in sorted order as per the position of the rule in the settings page
358 return [[rule, rule_label_map.get(rule)] for rule in shipping_rules]
359
360def get_shipping_rules(party=None, quotation=None, cart_settings=None):
361 if not party:
362 party = get_lead_or_customer()
363 if not quotation:
364 quotation = _get_cart_quotation()
365 if not cart_settings:
366 cart_settings = webnotes.get_obj("Shopping Cart Settings")
367
368 # set shipping rule based on shipping territory
369 shipping_territory = get_address_territory(quotation.doc.shipping_address_name) or \
370 party.territory
371
372 shipping_rules = cart_settings.get_shipping_rules(shipping_territory)
373
374 return shipping_rules
Anand Doshi99100a42013-07-04 17:13:53 +0530375
376def get_address_territory(address_name):
377 """Tries to match city, state and country of address to existing territory"""
378 territory = None
379
380 if address_name:
381 address_fields = webnotes.conn.get_value("Address", address_name,
382 ["city", "state", "country"])
383 for value in address_fields:
384 territory = webnotes.conn.get_value("Territory", value)
385 if territory:
386 break
387
388 return territory
389
Anand Doshie8132122013-06-17 15:42:38 +0530390import unittest
Anand Doshicefccb92013-07-15 18:28:14 +0530391test_dependencies = ["Item", "Price List", "Contact", "Shopping Cart Settings"]
Anand Doshiabc10032013-06-14 17:44:03 +0530392
393class TestCart(unittest.TestCase):
Anand Doshicefccb92013-07-15 18:28:14 +0530394 def tearDown(self):
395 return
396
397 cart_settings = webnotes.bean("Shopping Cart Settings")
398 cart_settings.ignore_permissions = True
399 cart_settings.doc.enabled = 0
400 cart_settings.save()
401
402 def enable_shopping_cart(self):
403 return
404 if not webnotes.conn.get_value("Shopping Cart Settings", None, "enabled"):
405 cart_settings = webnotes.bean("Shopping Cart Settings")
406 cart_settings.ignore_permissions = True
407 cart_settings.doc.enabled = 1
408 cart_settings.save()
409
Anand Doshie8132122013-06-17 15:42:38 +0530410 def test_get_lead_or_customer(self):
411 webnotes.session.user = "test@example.com"
412 party1 = get_lead_or_customer()
413 party2 = get_lead_or_customer()
414 self.assertEquals(party1.name, party2.name)
415 self.assertEquals(party1.doctype, "Lead")
416
417 webnotes.session.user = "test_contact_customer@example.com"
418 party = get_lead_or_customer()
419 self.assertEquals(party.name, "_Test Customer")
420
Anand Doshiabc10032013-06-14 17:44:03 +0530421 def test_add_to_cart(self):
Anand Doshicefccb92013-07-15 18:28:14 +0530422 self.enable_shopping_cart()
Anand Doshiabc10032013-06-14 17:44:03 +0530423 webnotes.session.user = "test@example.com"
Anand Doshicefccb92013-07-15 18:28:14 +0530424
Anand Doshi3dceb842013-06-19 14:57:14 +0530425 update_cart("_Test Item", 1)
Anand Doshiabc10032013-06-14 17:44:03 +0530426
Anand Doshi3dceb842013-06-19 14:57:14 +0530427 quotation = _get_cart_quotation()
Anand Doshie8132122013-06-17 15:42:38 +0530428 quotation_items = quotation.doclist.get({"parentfield": "quotation_details", "item_code": "_Test Item"})
429 self.assertTrue(quotation_items)
430 self.assertEquals(quotation_items[0].qty, 1)
431
432 return quotation
433
Anand Doshi3dceb842013-06-19 14:57:14 +0530434 def test_update_cart(self):
Anand Doshie8132122013-06-17 15:42:38 +0530435 self.test_add_to_cart()
436
Anand Doshi3dceb842013-06-19 14:57:14 +0530437 update_cart("_Test Item", 5)
Anand Doshie8132122013-06-17 15:42:38 +0530438
Anand Doshi3dceb842013-06-19 14:57:14 +0530439 quotation = _get_cart_quotation()
Anand Doshie8132122013-06-17 15:42:38 +0530440 quotation_items = quotation.doclist.get({"parentfield": "quotation_details", "item_code": "_Test Item"})
441 self.assertTrue(quotation_items)
442 self.assertEquals(quotation_items[0].qty, 5)
443
444 return quotation
Anand Doshiabc10032013-06-14 17:44:03 +0530445
446 def test_remove_from_cart(self):
Anand Doshie8132122013-06-17 15:42:38 +0530447 quotation0 = self.test_add_to_cart()
448
Anand Doshi3dceb842013-06-19 14:57:14 +0530449 update_cart("_Test Item", 0)
Anand Doshie8132122013-06-17 15:42:38 +0530450
Anand Doshi3dceb842013-06-19 14:57:14 +0530451 quotation = _get_cart_quotation()
Anand Doshie8132122013-06-17 15:42:38 +0530452 self.assertEquals(quotation0.doc.name, quotation.doc.name)
453
454 quotation_items = quotation.doclist.get({"parentfield": "quotation_details", "item_code": "_Test Item"})
455 self.assertEquals(quotation_items, [])
Anand Doshiabc10032013-06-14 17:44:03 +0530456
Anand Doshicefccb92013-07-15 18:28:14 +0530457 def test_place_order(self):
Anand Doshi3dceb842013-06-19 14:57:14 +0530458 quotation = self.test_update_cart()
Anand Doshicefccb92013-07-15 18:28:14 +0530459 sales_order_name = place_order()
460 sales_order = webnotes.bean("Sales Order", sales_order_name)
Anand Doshie8132122013-06-17 15:42:38 +0530461 self.assertEquals(sales_order.doclist.getone({"item_code": "_Test Item"}).prevdoc_docname, quotation.doc.name)
Anand Doshiabc10032013-06-14 17:44:03 +0530462