diff --git a/factura_electronica/api_erp.py b/factura_electronica/api_erp.py index f355ad2e..15411ef4 100755 --- a/factura_electronica/api_erp.py +++ b/factura_electronica/api_erp.py @@ -12,6 +12,7 @@ from factura_electronica.controllers.journal_entry import JournalEntrySaleInvoice from factura_electronica.controllers.journal_entry_special import JournalEntrySpecialISR from factura_electronica.factura_electronica.doctype.batch_electronic_invoice.batch_electronic_invoice import batch_generator +from factura_electronica.fel_api import validate_configuration # USAR ESTE SCRIPT COMO API PARA COMUNICAR APPS DEL ECOSISTEMA FRAPPE/ERPNEXT :) @@ -153,8 +154,15 @@ def add_address_info(doc): cstr(doc.name).strip() + '-' + cstr(_('Billing')).strip() ) address_doc = frappe.get_doc('Address', address_name) + + email_facelec = "" + if not doc.get('email_id'): + status_config = validate_configuration() + if status_config[1]: + email_facelec = frappe.db.get_value('Configuracion Factura Electronica', {'name': status_config[1]}, 'correo_copia') + # adding custom data to address - address_doc.email_id = doc.get('email_id') + address_doc.email_id = email_facelec address_doc.county = doc.get('county') address_doc.phone = doc.get('phone') address_doc.is_primary_address = doc.get('is_primary_address') diff --git a/factura_electronica/patches/v7_0_9/update_props_address.py b/factura_electronica/patches/v7_0_9/update_props_address.py index 05d9af57..14ec0ad8 100755 --- a/factura_electronica/patches/v7_0_9/update_props_address.py +++ b/factura_electronica/patches/v7_0_9/update_props_address.py @@ -17,7 +17,7 @@ def execute(): frappe.make_property_setter({ "doctype": "Address", "fieldname": "pincode", - # "default": "0", + "default": "0", "property": "reqd", "value": 1, "property_type": "Int" @@ -36,7 +36,7 @@ def execute(): "doctype": "Address", "fieldname": "email_id", "property": "reqd", - "value": 1, + "value": 0, "property_type": "Int" }) @@ -69,12 +69,30 @@ def execute(): frappe.make_property_setter({ "doctype": "Address", "fieldname": "tax_id", + "default": "C/F", + "property": "allow_in_quick_entry", + "value": 1, + "property_type": "Int" + }) + + frappe.make_property_setter({ + "doctype": "Customer", + "fieldname": "county", + "property": "reqd", + "value": 0, + "property_type": "Int" + }) + + frappe.make_property_setter({ + "doctype": "Address", + "fieldname": "county", + "default": "Guatemala", "property": "allow_in_quick_entry", "value": 1, "property_type": "Int" }) - for ffield in ["city", "county", "state", "country"]: + for ffield in ["city", "state", "country"]: frappe.make_property_setter({ "doctype": "Address", "fieldname": ffield, diff --git a/factura_electronica/public/js/facelec.js b/factura_electronica/public/js/facelec.js index cf45aa35..e6f1f357 100755 --- a/factura_electronica/public/js/facelec.js +++ b/factura_electronica/public/js/facelec.js @@ -251,6 +251,7 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __('NIT FEL'), fieldname: 'nit_face_customer', fieldtype: 'Data', + default: 'C/F', description: 'FEL: Si no tiene disponible el NIT escriba C/F' }, { @@ -260,6 +261,7 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __('NIT'), fieldname: 'tax_id', fieldtype: 'Data', + default: 'C/F', reqd: true, description: 'FEL: Si no tiene disponible el NIT escriba C/F' }, @@ -322,6 +324,7 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __("City/Town"), fieldname: "city", fieldtype: "Data", + default: 'Guatemala', reqd: 1, description: 'FEL Ciudad ej.: Antigua Guatemala' }, @@ -329,6 +332,7 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __("County"), fieldname: "county", fieldtype: "Data", + default: 'Guatemala', reqd: 1, description: 'FEL: Municipio p. ej.: Antigua Guatemala' }, @@ -336,6 +340,7 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __("State"), fieldname: "state", fieldtype: "Data", + default: 'Guatemala', reqd: 1, description: 'FEL Departamento ej.: Sacatepéquez' }, @@ -343,6 +348,7 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __("Country"), fieldname: "country", fieldtype: "Link", + default: 'Guatemala', reqd: 1, options: 'Country', description: 'FEL Pais ej: Guatemala'