mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 13:49:13 +00:00
feat: show transporter address in sales invoice (#23731)
* feat: show transporter address in sales invoice * feat: multiple transporter address * fix: update all eway-bill fields * fix: travis * fix: travis * fix: travis * fix: travis * fix: travis Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from erpnext.regional.india import number_state_mapping
|
||||
from six import string_types
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from frappe.contacts.doctype.address.address import get_address_display
|
||||
from frappe.model.utils import get_fetch_values
|
||||
|
||||
def validate_gstin_for_india(doc, method):
|
||||
@@ -137,6 +138,30 @@ def get_itemised_tax_breakup_data(doc, account_wise=False):
|
||||
def set_place_of_supply(doc, method=None):
|
||||
doc.place_of_supply = get_place_of_supply(doc, doc.doctype)
|
||||
|
||||
def set_transporter_address(doc, method=None):
|
||||
country = frappe.get_cached_value('Company', doc.company, 'country')
|
||||
if country != 'India':
|
||||
return
|
||||
|
||||
if doc.get("transporter_address"):
|
||||
# once supplier is set, address can be selected from multiple transporter addresses
|
||||
doc.transporter_address_display = get_address_display(doc.get("transporter_address"))
|
||||
return
|
||||
|
||||
transporter_address = frappe.db.get_value("Dynamic Link", {
|
||||
'link_doctype': 'Supplier',
|
||||
'link_name': doc.get('transporter'),
|
||||
'parenttype': 'Address'
|
||||
}, "parent")
|
||||
|
||||
if not transporter_address:
|
||||
doc.transporter_address = ""
|
||||
doc.transporter_address_display = ""
|
||||
return
|
||||
|
||||
doc.transporter_address = transporter_address
|
||||
doc.transporter_address_display = get_address_display(transporter_address)
|
||||
|
||||
# don't remove this function it is used in tests
|
||||
def test_method():
|
||||
'''test function'''
|
||||
|
||||
Reference in New Issue
Block a user