Merge pull request #26464 from nemesis189/added-dispatch-address-to-sales
feat: Added dispatch address fields in Sales Ord, Sales Inv, Delivery Note for Eway Bill
This commit is contained in:
commit
3e109840f9
@ -48,6 +48,8 @@
|
|||||||
"shipping_address",
|
"shipping_address",
|
||||||
"company_address",
|
"company_address",
|
||||||
"company_address_display",
|
"company_address_display",
|
||||||
|
"dispatch_address_name",
|
||||||
|
"dispatch_address",
|
||||||
"currency_and_price_list",
|
"currency_and_price_list",
|
||||||
"currency",
|
"currency",
|
||||||
"conversion_rate",
|
"conversion_rate",
|
||||||
@ -1966,6 +1968,21 @@
|
|||||||
"fieldname": "disable_rounded_total",
|
"fieldname": "disable_rounded_total",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Disable Rounded Total"
|
"label": "Disable Rounded Total"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"fieldname": "dispatch_address_name",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Dispatch Address Name",
|
||||||
|
"options": "Address",
|
||||||
|
"print_hide": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"fieldname": "dispatch_address",
|
||||||
|
"fieldtype": "Small Text",
|
||||||
|
"label": "Dispatch Address",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
@ -1978,7 +1995,7 @@
|
|||||||
"link_fieldname": "consolidated_invoice"
|
"link_fieldname": "consolidated_invoice"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-05-20 22:48:33.988881",
|
"modified": "2021-07-08 14:03:55.502522",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice",
|
"name": "Sales Invoice",
|
||||||
|
@ -1939,6 +1939,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
self.assertEqual(data['billLists'][0]['sgstValue'], 5400)
|
self.assertEqual(data['billLists'][0]['sgstValue'], 5400)
|
||||||
self.assertEqual(data['billLists'][0]['vehicleNo'], 'KA12KA1234')
|
self.assertEqual(data['billLists'][0]['vehicleNo'], 'KA12KA1234')
|
||||||
self.assertEqual(data['billLists'][0]['itemList'][0]['taxableAmount'], 60000)
|
self.assertEqual(data['billLists'][0]['itemList'][0]['taxableAmount'], 60000)
|
||||||
|
self.assertEqual(data['billLists'][0]['actualFromStateCode'],7)
|
||||||
|
self.assertEqual(data['billLists'][0]['fromStateCode'],27)
|
||||||
|
|
||||||
def test_einvoice_submission_without_irn(self):
|
def test_einvoice_submission_without_irn(self):
|
||||||
# init
|
# init
|
||||||
@ -2092,6 +2094,30 @@ def make_test_address_for_ewaybill():
|
|||||||
|
|
||||||
address.save()
|
address.save()
|
||||||
|
|
||||||
|
if not frappe.db.exists('Address', '_Test Dispatch-Address for Eway bill-Shipping'):
|
||||||
|
address = frappe.get_doc({
|
||||||
|
"address_line1": "_Test Dispatch Address Line 1",
|
||||||
|
"address_title": "_Test Dispatch-Address for Eway bill",
|
||||||
|
"address_type": "Shipping",
|
||||||
|
"city": "_Test City",
|
||||||
|
"state": "Test State",
|
||||||
|
"country": "India",
|
||||||
|
"doctype": "Address",
|
||||||
|
"is_primary_address": 0,
|
||||||
|
"phone": "+910000000000",
|
||||||
|
"gstin": "07AAACC1206D1ZI",
|
||||||
|
"gst_state": "Delhi",
|
||||||
|
"gst_state_number": "07",
|
||||||
|
"pincode": "1100101"
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
address.append("links", {
|
||||||
|
"link_doctype": "Company",
|
||||||
|
"link_name": "_Test Company"
|
||||||
|
})
|
||||||
|
|
||||||
|
address.save()
|
||||||
|
|
||||||
def make_test_transporter_for_ewaybill():
|
def make_test_transporter_for_ewaybill():
|
||||||
if not frappe.db.exists('Supplier', '_Test Transporter'):
|
if not frappe.db.exists('Supplier', '_Test Transporter'):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
@ -2130,6 +2156,7 @@ def make_sales_invoice_for_ewaybill():
|
|||||||
si.distance = 2000
|
si.distance = 2000
|
||||||
si.company_address = "_Test Address for Eway bill-Billing"
|
si.company_address = "_Test Address for Eway bill-Billing"
|
||||||
si.customer_address = "_Test Customer-Address for Eway bill-Shipping"
|
si.customer_address = "_Test Customer-Address for Eway bill-Shipping"
|
||||||
|
si.dispatch_address_name = "_Test Dispatch-Address for Eway bill-Shipping"
|
||||||
si.vehicle_no = "KA12KA1234"
|
si.vehicle_no = "KA12KA1234"
|
||||||
si.gst_category = "Registered Regular"
|
si.gst_category = "Registered Regular"
|
||||||
si.mode_of_transport = 'Road'
|
si.mode_of_transport = 'Road'
|
||||||
|
@ -431,9 +431,11 @@ def get_ewb_data(dt, dn):
|
|||||||
company_address = frappe.get_doc('Address', doc.company_address)
|
company_address = frappe.get_doc('Address', doc.company_address)
|
||||||
billing_address = frappe.get_doc('Address', doc.customer_address)
|
billing_address = frappe.get_doc('Address', doc.customer_address)
|
||||||
|
|
||||||
|
#added dispatch address
|
||||||
|
dispatch_address = frappe.get_doc('Address', doc.dispatch_address_name) if doc.dispatch_address_name else company_address
|
||||||
shipping_address = frappe.get_doc('Address', doc.shipping_address_name)
|
shipping_address = frappe.get_doc('Address', doc.shipping_address_name)
|
||||||
|
|
||||||
data = get_address_details(data, doc, company_address, billing_address)
|
data = get_address_details(data, doc, company_address, billing_address, dispatch_address)
|
||||||
|
|
||||||
data.itemList = []
|
data.itemList = []
|
||||||
data.totalValue = doc.total
|
data.totalValue = doc.total
|
||||||
@ -519,10 +521,10 @@ def get_gstins_for_company(company):
|
|||||||
`tabDynamic Link`.link_name = %(company)s""", {"company": company})
|
`tabDynamic Link`.link_name = %(company)s""", {"company": company})
|
||||||
return company_gstins
|
return company_gstins
|
||||||
|
|
||||||
def get_address_details(data, doc, company_address, billing_address):
|
def get_address_details(data, doc, company_address, billing_address, dispatch_address):
|
||||||
data.fromPincode = validate_pincode(company_address.pincode, 'Company Address')
|
data.fromPincode = validate_pincode(company_address.pincode, 'Company Address')
|
||||||
data.fromStateCode = data.actualFromStateCode = validate_state_code(
|
data.fromStateCode = validate_state_code(company_address.gst_state_number, 'Company Address')
|
||||||
company_address.gst_state_number, 'Company Address')
|
data.actualFromStateCode = validate_state_code(dispatch_address.gst_state_number, 'Dispatch Address')
|
||||||
|
|
||||||
if not doc.billing_address_gstin or len(doc.billing_address_gstin) < 15:
|
if not doc.billing_address_gstin or len(doc.billing_address_gstin) < 15:
|
||||||
data.toGstin = 'URP'
|
data.toGstin = 'URP'
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
"col_break46",
|
"col_break46",
|
||||||
"shipping_address_name",
|
"shipping_address_name",
|
||||||
"shipping_address",
|
"shipping_address",
|
||||||
|
"dispatch_address_name",
|
||||||
|
"dispatch_address",
|
||||||
"customer_group",
|
"customer_group",
|
||||||
"territory",
|
"territory",
|
||||||
"currency_and_price_list",
|
"currency_and_price_list",
|
||||||
@ -1486,13 +1488,29 @@
|
|||||||
"fieldname": "disable_rounded_total",
|
"fieldname": "disable_rounded_total",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Disable Rounded Total"
|
"label": "Disable Rounded Total"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"fieldname": "dispatch_address_name",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Dispatch Address Name",
|
||||||
|
"options": "Address",
|
||||||
|
"print_hide": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"depends_on": "dispatch_address_name",
|
||||||
|
"fieldname": "dispatch_address",
|
||||||
|
"fieldtype": "Small Text",
|
||||||
|
"label": "Dispatch Address",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 105,
|
"idx": 105,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-04-15 23:55:13.439068",
|
"modified": "2021-07-08 21:37:44.177493",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Sales Order",
|
"name": "Sales Order",
|
||||||
|
@ -114,6 +114,10 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
|||||||
erpnext.utils.set_taxes_from_address(this.frm, "shipping_address_name", "customer_address", "shipping_address_name");
|
erpnext.utils.set_taxes_from_address(this.frm, "shipping_address_name", "customer_address", "shipping_address_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch_address_name() {
|
||||||
|
erpnext.utils.get_address_display(this.frm, "dispatch_address_name", "dispatch_address");
|
||||||
|
}
|
||||||
|
|
||||||
sales_partner() {
|
sales_partner() {
|
||||||
this.apply_pricing_rule();
|
this.apply_pricing_rule();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
"contact_info",
|
"contact_info",
|
||||||
"shipping_address_name",
|
"shipping_address_name",
|
||||||
"shipping_address",
|
"shipping_address",
|
||||||
|
"dispatch_address_name",
|
||||||
|
"dispatch_address",
|
||||||
"contact_person",
|
"contact_person",
|
||||||
"contact_display",
|
"contact_display",
|
||||||
"contact_mobile",
|
"contact_mobile",
|
||||||
@ -1282,13 +1284,28 @@
|
|||||||
"fieldname": "disable_rounded_total",
|
"fieldname": "disable_rounded_total",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Disable Rounded Total"
|
"label": "Disable Rounded Total"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "dispatch_address_name",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Dispatch Address Name",
|
||||||
|
"options": "Address",
|
||||||
|
"print_hide": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "dispatch_address_name",
|
||||||
|
"fieldname": "dispatch_address",
|
||||||
|
"fieldtype": "Small Text",
|
||||||
|
"label": "Dispatch Address",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-truck",
|
"icon": "fa fa-truck",
|
||||||
"idx": 146,
|
"idx": 146,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-06-11 19:27:30.901112",
|
"modified": "2021-07-08 21:37:20.802652",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Delivery Note",
|
"name": "Delivery Note",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user