|
|
@ -42,7 +42,10 @@ def validate_eligibility(doc): |
|
|
|
invalid_company = not frappe.db.get_value('E Invoice User', { 'company': doc.get('company') }) |
|
|
|
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export'] |
|
|
|
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin') |
|
|
|
no_taxes_applied = not doc.get('taxes') |
|
|
|
|
|
|
|
# if export invoice, then taxes can be empty |
|
|
|
# invoice can only be ineligible if no taxes applied and is not an export invoice |
|
|
|
no_taxes_applied = not doc.get('taxes') and not doc.get('gst_category') == 'Overseas' |
|
|
|
has_non_gst_item = any(d for d in doc.get('items', []) if d.get('is_non_gst')) |
|
|
|
|
|
|
|
if invalid_company or invalid_supply_type or company_transaction or no_taxes_applied or has_non_gst_item: |
|
|
@ -188,9 +191,10 @@ def get_item_list(invoice): |
|
|
|
|
|
|
|
item.qty = abs(item.qty) |
|
|
|
|
|
|
|
item.unit_rate = abs((abs(item.taxable_value) - item.discount_amount)/ item.qty) |
|
|
|
item.gross_amount = abs(item.taxable_value) + item.discount_amount |
|
|
|
item.unit_rate = abs(item.taxable_value / item.qty) |
|
|
|
item.gross_amount = abs(item.taxable_value) |
|
|
|
item.taxable_value = abs(item.taxable_value) |
|
|
|
item.discount_amount = 0 |
|
|
|
|
|
|
|
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None |
|
|
|
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None |
|
|
|