Merge branch 'develop' into customer_duplicates
This commit is contained in:
commit
a30d70e490
@ -618,13 +618,16 @@ class SalarySlip(TransactionBase):
|
|||||||
|
|
||||||
component_row = self.append(component_type)
|
component_row = self.append(component_type)
|
||||||
for attr in (
|
for attr in (
|
||||||
'depends_on_payment_days', 'salary_component', 'abbr'
|
'depends_on_payment_days', 'salary_component',
|
||||||
'do_not_include_in_total', 'is_tax_applicable',
|
'do_not_include_in_total', 'is_tax_applicable',
|
||||||
'is_flexible_benefit', 'variable_based_on_taxable_salary',
|
'is_flexible_benefit', 'variable_based_on_taxable_salary',
|
||||||
'exempted_from_income_tax'
|
'exempted_from_income_tax'
|
||||||
):
|
):
|
||||||
component_row.set(attr, component_data.get(attr))
|
component_row.set(attr, component_data.get(attr))
|
||||||
|
|
||||||
|
abbr = component_data.get('abbr') or component_data.get('salary_component_abbr')
|
||||||
|
component_row.set('abbr', abbr)
|
||||||
|
|
||||||
if additional_salary:
|
if additional_salary:
|
||||||
component_row.default_amount = 0
|
component_row.default_amount = 0
|
||||||
component_row.additional_amount = amount
|
component_row.additional_amount = amount
|
||||||
|
|||||||
@ -87,10 +87,10 @@ def get_doc_details(invoice):
|
|||||||
invoice_date=invoice_date
|
invoice_date=invoice_date
|
||||||
))
|
))
|
||||||
|
|
||||||
def get_party_details(address_name):
|
def get_party_details(address_name, company_address=None, billing_address=None, shipping_address=None):
|
||||||
d = frappe.get_all('Address', filters={'name': address_name}, fields=['*'])[0]
|
d = frappe.get_all('Address', filters={'name': address_name}, fields=['*'])[0]
|
||||||
|
|
||||||
if (not d.gstin
|
if ((not d.gstin and not shipping_address)
|
||||||
or not d.city
|
or not d.city
|
||||||
or not d.pincode
|
or not d.pincode
|
||||||
or not d.address_title
|
or not d.address_title
|
||||||
@ -108,8 +108,7 @@ def get_party_details(address_name):
|
|||||||
# according to einvoice standard
|
# according to einvoice standard
|
||||||
pincode = 999999
|
pincode = 999999
|
||||||
|
|
||||||
return frappe._dict(dict(
|
party_address_details = frappe._dict(dict(
|
||||||
gstin=d.gstin,
|
|
||||||
legal_name=sanitize_for_json(d.address_title),
|
legal_name=sanitize_for_json(d.address_title),
|
||||||
location=sanitize_for_json(d.city),
|
location=sanitize_for_json(d.city),
|
||||||
pincode=d.pincode,
|
pincode=d.pincode,
|
||||||
@ -117,6 +116,9 @@ def get_party_details(address_name):
|
|||||||
address_line1=sanitize_for_json(d.address_line1),
|
address_line1=sanitize_for_json(d.address_line1),
|
||||||
address_line2=sanitize_for_json(d.address_line2)
|
address_line2=sanitize_for_json(d.address_line2)
|
||||||
))
|
))
|
||||||
|
if d.gstin:
|
||||||
|
party_address_details.gstin = d.gstin
|
||||||
|
return party_address_details
|
||||||
|
|
||||||
def get_gstin_details(gstin):
|
def get_gstin_details(gstin):
|
||||||
if not hasattr(frappe.local, 'gstin_cache'):
|
if not hasattr(frappe.local, 'gstin_cache'):
|
||||||
@ -328,12 +330,12 @@ def make_einvoice(invoice):
|
|||||||
item_list = get_item_list(invoice)
|
item_list = get_item_list(invoice)
|
||||||
doc_details = get_doc_details(invoice)
|
doc_details = get_doc_details(invoice)
|
||||||
invoice_value_details = get_invoice_value_details(invoice)
|
invoice_value_details = get_invoice_value_details(invoice)
|
||||||
seller_details = get_party_details(invoice.company_address)
|
seller_details = get_party_details(invoice.company_address, company_address=1)
|
||||||
|
|
||||||
if invoice.gst_category == 'Overseas':
|
if invoice.gst_category == 'Overseas':
|
||||||
buyer_details = get_overseas_address_details(invoice.customer_address)
|
buyer_details = get_overseas_address_details(invoice.customer_address)
|
||||||
else:
|
else:
|
||||||
buyer_details = get_party_details(invoice.customer_address)
|
buyer_details = get_party_details(invoice.customer_address, billing_address=1)
|
||||||
place_of_supply = get_place_of_supply(invoice, invoice.doctype)
|
place_of_supply = get_place_of_supply(invoice, invoice.doctype)
|
||||||
if place_of_supply:
|
if place_of_supply:
|
||||||
place_of_supply = place_of_supply.split('-')[0]
|
place_of_supply = place_of_supply.split('-')[0]
|
||||||
@ -346,7 +348,7 @@ def make_einvoice(invoice):
|
|||||||
if invoice.gst_category == 'Overseas':
|
if invoice.gst_category == 'Overseas':
|
||||||
shipping_details = get_overseas_address_details(invoice.shipping_address_name)
|
shipping_details = get_overseas_address_details(invoice.shipping_address_name)
|
||||||
else:
|
else:
|
||||||
shipping_details = get_party_details(invoice.shipping_address_name)
|
shipping_details = get_party_details(invoice.shipping_address_name, shipping_address=1)
|
||||||
|
|
||||||
if invoice.is_pos and invoice.base_paid_amount:
|
if invoice.is_pos and invoice.base_paid_amount:
|
||||||
payment_details = get_payment_details(invoice)
|
payment_details = get_payment_details(invoice)
|
||||||
@ -394,7 +396,9 @@ def safe_json_load(json_string):
|
|||||||
snippet = json_string[start:end]
|
snippet = json_string[start:end]
|
||||||
frappe.throw(_("Error in input data. Please check for any special characters near following input: <br> {}").format(snippet))
|
frappe.throw(_("Error in input data. Please check for any special characters near following input: <br> {}").format(snippet))
|
||||||
|
|
||||||
def validate_einvoice(validations, einvoice, errors=[]):
|
def validate_einvoice(validations, einvoice, errors=None):
|
||||||
|
if errors is None:
|
||||||
|
errors = []
|
||||||
for fieldname, field_validation in validations.items():
|
for fieldname, field_validation in validations.items():
|
||||||
value = einvoice.get(fieldname, None)
|
value = einvoice.get(fieldname, None)
|
||||||
if not value or value == "None":
|
if not value or value == "None":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user