Merge branch 'develop' into independent-manu-entry
This commit is contained in:
commit
d7c4b8a383
@ -55,9 +55,9 @@ def set_perpetual_inventory(enable=1, company=None):
|
|||||||
company.enable_perpetual_inventory = enable
|
company.enable_perpetual_inventory = enable
|
||||||
company.save()
|
company.save()
|
||||||
|
|
||||||
def encode_company_abbr(name, company):
|
def encode_company_abbr(name, company=None, abbr=None):
|
||||||
'''Returns name encoded with company abbreviation'''
|
'''Returns name encoded with company abbreviation'''
|
||||||
company_abbr = frappe.get_cached_value('Company', company, "abbr")
|
company_abbr = abbr or frappe.get_cached_value('Company', company, "abbr")
|
||||||
parts = name.rsplit(" - ", 1)
|
parts = name.rsplit(" - ", 1)
|
||||||
|
|
||||||
if parts[-1].lower() != company_abbr.lower():
|
if parts[-1].lower() != company_abbr.lower():
|
||||||
|
|||||||
@ -148,7 +148,7 @@ def make_company():
|
|||||||
company.company_name = "_Test Opening Invoice Company"
|
company.company_name = "_Test Opening Invoice Company"
|
||||||
company.abbr = "_TOIC"
|
company.abbr = "_TOIC"
|
||||||
company.default_currency = "INR"
|
company.default_currency = "INR"
|
||||||
company.country = "India"
|
company.country = "Pakistan"
|
||||||
company.insert()
|
company.insert()
|
||||||
return company
|
return company
|
||||||
|
|
||||||
|
|||||||
@ -12,14 +12,15 @@ class AppointmentLetter(Document):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_appointment_letter_details(template):
|
def get_appointment_letter_details(template):
|
||||||
body = []
|
body = []
|
||||||
intro= frappe.get_list("Appointment Letter Template",
|
intro = frappe.get_list('Appointment Letter Template',
|
||||||
fields = ['introduction', 'closing_notes'],
|
fields=['introduction', 'closing_notes'],
|
||||||
filters={'name': template
|
filters={'name': template}
|
||||||
})[0]
|
)[0]
|
||||||
content = frappe.get_list("Appointment Letter content",
|
content = frappe.get_all('Appointment Letter content',
|
||||||
fields = ['title', 'description'],
|
fields=['title', 'description'],
|
||||||
filters={'parent': template
|
filters={'parent': template},
|
||||||
})
|
order_by='idx'
|
||||||
|
)
|
||||||
body.append(intro)
|
body.append(intro)
|
||||||
body.append({'description': content})
|
body.append({'description': content})
|
||||||
return body
|
return body
|
||||||
|
|||||||
@ -83,6 +83,13 @@ $.extend(erpnext.queries, {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dispatch_address_query: function(doc) {
|
||||||
|
return {
|
||||||
|
query: 'frappe.contacts.doctype.address.address.address_query',
|
||||||
|
filters: { link_doctype: 'Company', link_name: doc.company || '' }
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
supplier_filter: function(doc) {
|
supplier_filter: function(doc) {
|
||||||
if(!doc.supplier) {
|
if(!doc.supplier) {
|
||||||
frappe.throw(__("Please set {0}", [__(frappe.meta.get_label(doc.doctype, "supplier", doc.name))]));
|
frappe.throw(__("Please set {0}", [__(frappe.meta.get_label(doc.doctype, "supplier", doc.name))]));
|
||||||
|
|||||||
@ -41,6 +41,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
|||||||
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||||
me.frm.set_query('customer_address', erpnext.queries.address_query);
|
me.frm.set_query('customer_address', erpnext.queries.address_query);
|
||||||
me.frm.set_query('shipping_address_name', erpnext.queries.address_query);
|
me.frm.set_query('shipping_address_name', erpnext.queries.address_query);
|
||||||
|
me.frm.set_query('dispatch_address_name', erpnext.queries.dispatch_address_query);
|
||||||
|
|
||||||
|
|
||||||
if(this.frm.fields_dict.selling_price_list) {
|
if(this.frm.fields_dict.selling_price_list) {
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
"abbr": "_TC3",
|
"abbr": "_TC3",
|
||||||
"company_name": "_Test Company 3",
|
"company_name": "_Test Company 3",
|
||||||
"is_group": 1,
|
"is_group": 1,
|
||||||
"country": "India",
|
"country": "Pakistan",
|
||||||
"default_currency": "INR",
|
"default_currency": "INR",
|
||||||
"doctype": "Company",
|
"doctype": "Company",
|
||||||
"domain": "Manufacturing",
|
"domain": "Manufacturing",
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"company_name": "_Test Company 4",
|
"company_name": "_Test Company 4",
|
||||||
"parent_company": "_Test Company 3",
|
"parent_company": "_Test Company 3",
|
||||||
"is_group": 1,
|
"is_group": 1,
|
||||||
"country": "India",
|
"country": "Pakistan",
|
||||||
"default_currency": "INR",
|
"default_currency": "INR",
|
||||||
"doctype": "Company",
|
"doctype": "Company",
|
||||||
"domain": "Manufacturing",
|
"domain": "Manufacturing",
|
||||||
@ -61,7 +61,7 @@
|
|||||||
"abbr": "_TC5",
|
"abbr": "_TC5",
|
||||||
"company_name": "_Test Company 5",
|
"company_name": "_Test Company 5",
|
||||||
"parent_company": "_Test Company 4",
|
"parent_company": "_Test Company 4",
|
||||||
"country": "India",
|
"country": "Pakistan",
|
||||||
"default_currency": "INR",
|
"default_currency": "INR",
|
||||||
"doctype": "Company",
|
"doctype": "Company",
|
||||||
"domain": "Manufacturing",
|
"domain": "Manufacturing",
|
||||||
|
|||||||
@ -39,9 +39,9 @@ def create_test_delivery_note():
|
|||||||
"description": 'Test delivery note for shipment',
|
"description": 'Test delivery note for shipment',
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
"uom": 'Nos',
|
"uom": 'Nos',
|
||||||
"warehouse": 'Stores - SC',
|
"warehouse": 'Stores - _TC',
|
||||||
"rate": item.standard_rate,
|
"rate": item.standard_rate,
|
||||||
"cost_center": 'Main - SC'
|
"cost_center": 'Main - _TC'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
delivery_note.insert()
|
delivery_note.insert()
|
||||||
@ -127,13 +127,7 @@ def get_shipment_company_address(company_name):
|
|||||||
return create_shipment_address(address_title, company_name, 80331)
|
return create_shipment_address(address_title, company_name, 80331)
|
||||||
|
|
||||||
def get_shipment_company():
|
def get_shipment_company():
|
||||||
company_name = 'Shipment Company'
|
return frappe.get_doc("Company", "_Test Company")
|
||||||
abbr = 'SC'
|
|
||||||
companies = frappe.get_all("Company", fields=["name"], filters = {"company_name": company_name})
|
|
||||||
if len(companies):
|
|
||||||
return companies[0]
|
|
||||||
else:
|
|
||||||
return create_shipment_company(company_name, abbr)
|
|
||||||
|
|
||||||
def get_shipment_item(company_name):
|
def get_shipment_item(company_name):
|
||||||
item_name = 'Testing Shipment item'
|
item_name = 'Testing Shipment item'
|
||||||
@ -182,17 +176,6 @@ def create_customer_contact(fname, lname):
|
|||||||
customer.insert()
|
customer.insert()
|
||||||
return customer
|
return customer
|
||||||
|
|
||||||
|
|
||||||
def create_shipment_company(company_name, abbr):
|
|
||||||
company = frappe.new_doc("Company")
|
|
||||||
company.company_name = company_name
|
|
||||||
company.abbr = abbr
|
|
||||||
company.default_currency = 'EUR'
|
|
||||||
company.country = 'Germany'
|
|
||||||
company.enable_perpetual_inventory = 0
|
|
||||||
company.insert()
|
|
||||||
return company
|
|
||||||
|
|
||||||
def create_shipment_customer(customer_name):
|
def create_shipment_customer(customer_name):
|
||||||
customer = frappe.new_doc("Customer")
|
customer = frappe.new_doc("Customer")
|
||||||
customer.customer_name = customer_name
|
customer.customer_name = customer_name
|
||||||
@ -211,12 +194,12 @@ def create_material_receipt(item, company):
|
|||||||
stock.posting_date = posting_date.strftime("%Y-%m-%d")
|
stock.posting_date = posting_date.strftime("%Y-%m-%d")
|
||||||
stock.append('items',
|
stock.append('items',
|
||||||
{
|
{
|
||||||
"t_warehouse": 'Stores - SC',
|
"t_warehouse": 'Stores - _TC',
|
||||||
"item_code": item.name,
|
"item_code": item.name,
|
||||||
"qty": 5,
|
"qty": 5,
|
||||||
"uom": 'Nos',
|
"uom": 'Nos',
|
||||||
"basic_rate": item.standard_rate,
|
"basic_rate": item.standard_rate,
|
||||||
"cost_center": 'Main - SC'
|
"cost_center": 'Main - _TC'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
stock.insert()
|
stock.insert()
|
||||||
@ -233,7 +216,7 @@ def create_shipment_item(item_name, company_name):
|
|||||||
item.append('item_defaults',
|
item.append('item_defaults',
|
||||||
{
|
{
|
||||||
"company": company_name,
|
"company": company_name,
|
||||||
"default_warehouse": 'Stores - SC'
|
"default_warehouse": 'Stores - _TC'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
item.insert()
|
item.insert()
|
||||||
|
|||||||
@ -8,13 +8,8 @@ test_records = frappe.get_test_records('Company')
|
|||||||
|
|
||||||
class TestInit(unittest.TestCase):
|
class TestInit(unittest.TestCase):
|
||||||
def test_encode_company_abbr(self):
|
def test_encode_company_abbr(self):
|
||||||
company = frappe.new_doc("Company")
|
|
||||||
company.company_name = "New from Existing Company For Test"
|
|
||||||
company.abbr = "NFECT"
|
|
||||||
company.default_currency = "INR"
|
|
||||||
company.save()
|
|
||||||
|
|
||||||
abbr = company.abbr
|
abbr = "NFECT"
|
||||||
|
|
||||||
names = [
|
names = [
|
||||||
"Warehouse Name", "ERPNext Foundation India", "Gold - Member - {a}".format(a=abbr),
|
"Warehouse Name", "ERPNext Foundation India", "Gold - Member - {a}".format(a=abbr),
|
||||||
@ -32,7 +27,7 @@ class TestInit(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for i in range(len(names)):
|
for i in range(len(names)):
|
||||||
enc_name = encode_company_abbr(names[i], company.name)
|
enc_name = encode_company_abbr(names[i], abbr=abbr)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
enc_name == expected_names[i],
|
enc_name == expected_names[i],
|
||||||
"{enc} is not same as {exp}".format(enc=enc_name, exp=expected_names[i])
|
"{enc} is not same as {exp}".format(enc=enc_name, exp=expected_names[i])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user