Merge pull request #12932 from achillesrasquinha/py3-basestring
Py3 basestring
This commit is contained in:
commit
d56b00f5fd
@ -208,7 +208,7 @@ def remove_pricing_rule_for_item(pricing_rule, item_details):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def remove_pricing_rules(item_list):
|
def remove_pricing_rules(item_list):
|
||||||
if isinstance(item_list, basestring):
|
if isinstance(item_list, string_types):
|
||||||
item_list = json.loads(item_list)
|
item_list = json.loads(item_list)
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
|
@ -14,6 +14,8 @@ from frappe import _
|
|||||||
from frappe.core.doctype.communication.email import make
|
from frappe.core.doctype.communication.email import make
|
||||||
from frappe.utils import nowdate
|
from frappe.utils import nowdate
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_pos_data():
|
def get_pos_data():
|
||||||
@ -196,7 +198,7 @@ def get_customers_list(pos_profile={}):
|
|||||||
|
|
||||||
def get_customers_address(customers):
|
def get_customers_address(customers):
|
||||||
customer_address = {}
|
customer_address = {}
|
||||||
if isinstance(customers, basestring):
|
if isinstance(customers, string_types):
|
||||||
customers = [frappe._dict({'name': customers})]
|
customers = [frappe._dict({'name': customers})]
|
||||||
|
|
||||||
for data in customers:
|
for data in customers:
|
||||||
@ -216,7 +218,7 @@ def get_customers_address(customers):
|
|||||||
|
|
||||||
def get_contacts(customers):
|
def get_contacts(customers):
|
||||||
customer_contact = {}
|
customer_contact = {}
|
||||||
if isinstance(customers, basestring):
|
if isinstance(customers, string_types):
|
||||||
customers = [frappe._dict({'name': customers})]
|
customers = [frappe._dict({'name': customers})]
|
||||||
|
|
||||||
for data in customers:
|
for data in customers:
|
||||||
@ -351,13 +353,13 @@ def get_pricing_rule_data(doc):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
||||||
if isinstance(doc_list, basestring):
|
if isinstance(doc_list, string_types):
|
||||||
doc_list = json.loads(doc_list)
|
doc_list = json.loads(doc_list)
|
||||||
|
|
||||||
if isinstance(email_queue_list, basestring):
|
if isinstance(email_queue_list, string_types):
|
||||||
email_queue_list = json.loads(email_queue_list)
|
email_queue_list = json.loads(email_queue_list)
|
||||||
|
|
||||||
if isinstance(customers_list, basestring):
|
if isinstance(customers_list, string_types):
|
||||||
customers_list = json.loads(customers_list)
|
customers_list = json.loads(customers_list)
|
||||||
|
|
||||||
customers_list = make_customer_and_address(customers_list)
|
customers_list = make_customer_and_address(customers_list)
|
||||||
|
@ -16,6 +16,8 @@ from erpnext.stock.doctype.material_request.material_request import set_missing_
|
|||||||
from erpnext.controllers.buying_controller import BuyingController
|
from erpnext.controllers.buying_controller import BuyingController
|
||||||
from erpnext.buying.utils import validate_for_items
|
from erpnext.buying.utils import validate_for_items
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
STANDARD_USERS = ("Guest", "Administrator")
|
STANDARD_USERS = ("Guest", "Administrator")
|
||||||
|
|
||||||
class RequestforQuotation(BuyingController):
|
class RequestforQuotation(BuyingController):
|
||||||
@ -240,7 +242,7 @@ def make_supplier_quotation(source_name, for_supplier, target_doc=None):
|
|||||||
# This method is used to make supplier quotation from supplier's portal.
|
# This method is used to make supplier quotation from supplier's portal.
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_supplier_quotation(doc):
|
def create_supplier_quotation(doc):
|
||||||
if isinstance(doc, basestring):
|
if isinstance(doc, string_types):
|
||||||
doc = json.loads(doc)
|
doc = json.loads(doc)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -52,7 +52,7 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part
|
|||||||
return variant
|
return variant
|
||||||
|
|
||||||
def validate_item_variant_attributes(item, args=None):
|
def validate_item_variant_attributes(item, args=None):
|
||||||
if isinstance(item, basestring):
|
if isinstance(item, string_types):
|
||||||
item = frappe.get_doc('Item', item)
|
item = frappe.get_doc('Item', item)
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
|
@ -7,6 +7,8 @@ from frappe.utils.nestedset import get_root_of
|
|||||||
from frappe.utils import cint
|
from frappe.utils import cint
|
||||||
from erpnext.accounts.doctype.pos_profile.pos_profile import get_item_groups
|
from erpnext.accounts.doctype.pos_profile.pos_profile import get_item_groups
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_items(start, page_length, price_list, item_group, search_value="", pos_profile=None):
|
def get_items(start, page_length, price_list, item_group, search_value="", pos_profile=None):
|
||||||
serial_no = ""
|
serial_no = ""
|
||||||
@ -90,7 +92,7 @@ def get_conditions(item_code, serial_no, batch_no, barcode):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def submit_invoice(doc,is_saved):
|
def submit_invoice(doc,is_saved):
|
||||||
if isinstance(doc, basestring):
|
if isinstance(doc, string_types):
|
||||||
args = json.loads(doc)
|
args = json.loads(doc)
|
||||||
|
|
||||||
if(cint(is_saved) == 1):
|
if(cint(is_saved) == 1):
|
||||||
|
@ -7,6 +7,8 @@ import json
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils.jinja import validate_template
|
from frappe.utils.jinja import validate_template
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
class TermsandConditions(Document):
|
class TermsandConditions(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.terms:
|
if self.terms:
|
||||||
@ -14,7 +16,7 @@ class TermsandConditions(Document):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_terms_and_conditions(template_name, doc):
|
def get_terms_and_conditions(template_name, doc):
|
||||||
if isinstance(doc, basestring):
|
if isinstance(doc, string_types):
|
||||||
doc = json.loads(doc)
|
doc = json.loads(doc)
|
||||||
|
|
||||||
terms_and_conditions = frappe.get_doc("Terms and Conditions", template_name)
|
terms_and_conditions = frappe.get_doc("Terms and Conditions", template_name)
|
||||||
|
@ -15,6 +15,8 @@ from erpnext.controllers.buying_controller import BuyingController
|
|||||||
from erpnext.manufacturing.doctype.production_order.production_order import get_item_details
|
from erpnext.manufacturing.doctype.production_order.production_order import get_item_details
|
||||||
from erpnext.buying.utils import check_for_closed_status, validate_for_items
|
from erpnext.buying.utils import check_for_closed_status, validate_for_items
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
form_grid_templates = {
|
form_grid_templates = {
|
||||||
"items": "templates/form_grid/material_request_grid.html"
|
"items": "templates/form_grid/material_request_grid.html"
|
||||||
}
|
}
|
||||||
@ -275,7 +277,7 @@ def make_request_for_quotation(source_name, target_doc=None):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_purchase_order_based_on_supplier(source_name, target_doc=None):
|
def make_purchase_order_based_on_supplier(source_name, target_doc=None):
|
||||||
if target_doc:
|
if target_doc:
|
||||||
if isinstance(target_doc, basestring):
|
if isinstance(target_doc, string_types):
|
||||||
import json
|
import json
|
||||||
target_doc = frappe.get_doc(json.loads(target_doc))
|
target_doc = frappe.get_doc(json.loads(target_doc))
|
||||||
target_doc.set("items", [])
|
target_doc.set("items", [])
|
||||||
|
@ -872,7 +872,7 @@ class StockEntry(StockController):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def move_sample_to_retention_warehouse(company, items):
|
def move_sample_to_retention_warehouse(company, items):
|
||||||
if isinstance(items, basestring):
|
if isinstance(items, string_types):
|
||||||
items = json.loads(items)
|
items = json.loads(items)
|
||||||
retention_warehouse = frappe.db.get_single_value('Stock Settings', 'sample_retention_warehouse')
|
retention_warehouse = frappe.db.get_single_value('Stock Settings', 'sample_retention_warehouse')
|
||||||
stock_entry = frappe.new_doc("Stock Entry")
|
stock_entry = frappe.new_doc("Stock Entry")
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
import frappe, erpnext
|
import frappe, erpnext
|
||||||
from frappe.utils import cint, flt
|
from frappe.utils import cint, flt
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_stock_entry(**args):
|
def make_stock_entry(**args):
|
||||||
'''Helper function to make a Stock Entry
|
'''Helper function to make a Stock Entry
|
||||||
@ -49,7 +51,7 @@ def make_stock_entry(**args):
|
|||||||
if args.item_code:
|
if args.item_code:
|
||||||
args.item = args.item_code
|
args.item = args.item_code
|
||||||
|
|
||||||
if isinstance(args.qty, basestring):
|
if isinstance(args.qty, string_types):
|
||||||
if '.' in args.qty:
|
if '.' in args.qty:
|
||||||
args.qty = flt(args.qty)
|
args.qty = flt(args.qty)
|
||||||
else:
|
else:
|
||||||
|
@ -8,6 +8,8 @@ from frappe import _
|
|||||||
from frappe.utils import cstr, now_datetime, cint, flt, get_time
|
from frappe.utils import cstr, now_datetime, cint, flt, get_time
|
||||||
from erpnext.controllers.status_updater import StatusUpdater
|
from erpnext.controllers.status_updater import StatusUpdater
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
class UOMMustBeIntegerError(frappe.ValidationError): pass
|
class UOMMustBeIntegerError(frappe.ValidationError): pass
|
||||||
|
|
||||||
class TransactionBase(StatusUpdater):
|
class TransactionBase(StatusUpdater):
|
||||||
@ -139,7 +141,7 @@ def delete_events(ref_type, ref_name):
|
|||||||
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
||||||
|
|
||||||
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
||||||
if isinstance(qty_fields, basestring):
|
if isinstance(qty_fields, string_types):
|
||||||
qty_fields = [qty_fields]
|
qty_fields = [qty_fields]
|
||||||
|
|
||||||
distinct_uoms = list(set([d.get(uom_field) for d in doc.get_all_children()]))
|
distinct_uoms = list(set([d.get(uom_field) for d in doc.get_all_children()]))
|
||||||
|
Loading…
Reference in New Issue
Block a user