mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 09:53:09 +00:00
feat(italy): add document type field for e-invoicing
This commit is contained in:
@@ -139,6 +139,9 @@ def make_custom_fields(update=True):
|
||||
dict(fieldname='customer_fiscal_code', label='Customer Fiscal Code',
|
||||
fieldtype='Data', insert_after='cb_e_invoicing_reference', read_only=1,
|
||||
fetch_from="customer.fiscal_code"),
|
||||
dict(fieldname='type_of_document', label='Type of Document',
|
||||
fieldtype='Select', insert_after='customer_fiscal_code',
|
||||
options='\nTD01\nTD02\nTD03\nTD04\nTD05\nTD06\nTD16\nTD17\nTD18\nTD19\nTD20\nTD21\nTD22\nTD23\nTD24\nTD25\nTD26\nTD27'),
|
||||
],
|
||||
'Purchase Invoice Item': invoice_item_fields,
|
||||
'Sales Order Item': invoice_item_fields,
|
||||
|
||||
@@ -57,11 +57,12 @@ def prepare_invoice(invoice, progressive_number):
|
||||
invoice.company_address_data = company_address
|
||||
|
||||
#Set invoice type
|
||||
if invoice.is_return and invoice.return_against:
|
||||
invoice.type_of_document = "TD04" #Credit Note (Nota di Credito)
|
||||
invoice.return_against_unamended = get_unamended_name(frappe.get_doc("Sales Invoice", invoice.return_against))
|
||||
else:
|
||||
invoice.type_of_document = "TD01" #Sales Invoice (Fattura)
|
||||
if not invoice.type_of_document:
|
||||
if invoice.is_return and invoice.return_against:
|
||||
invoice.type_of_document = "TD04" #Credit Note (Nota di Credito)
|
||||
invoice.return_against_unamended = get_unamended_name(frappe.get_doc("Sales Invoice", invoice.return_against))
|
||||
else:
|
||||
invoice.type_of_document = "TD01" #Sales Invoice (Fattura)
|
||||
|
||||
#set customer information
|
||||
invoice.customer_data = frappe.get_doc("Customer", invoice.customer)
|
||||
|
||||
Reference in New Issue
Block a user