Skip to content

Commit

Permalink
OK customizacion quick entry new customer
Browse files Browse the repository at this point in the history
  • Loading branch information
monroy95 committed May 14, 2021
1 parent 96ab0f1 commit f48c99e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
48 changes: 26 additions & 22 deletions factura_electronica/api_erp.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,29 @@ def custom_customer_info(doc, method):


def add_address_info(doc):
if doc.flags.is_new_doc and doc.get('address_line1'):
# this name construct should work
# because we just create this customer
# Billing is default type
# there shouldn't be any more address of this customer
address_name = (
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 = email_facelec
address_doc.county = doc.get('county')
address_doc.phone = doc.get('phone')
address_doc.is_primary_address = doc.get('is_primary_address')
address_doc.save()
try:
if doc.flags.is_new_doc and doc.get('address_line1'):
# this name construct should work
# because we just create this customer
# Billing is default type
# there shouldn't be any more address of this customer
address_name = (
cstr(doc.name).strip() + '-' + cstr(_('Billing')).strip()
)
address_doc = frappe.get_doc('Address', address_name)

email_facelec = doc.get('email_id')
if not doc.get('email_id'):
status_config = validate_configuration()
if status_config[0] and 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 = email_facelec
address_doc.county = doc.get('county')
address_doc.phone = doc.get('phone')
# En la creacion de direccion se definira como default
address_doc.is_primary_address = doc.get('is_primary_address') if doc.get('is_primary_address') else 1
address_doc.save()
except:
pass
3 changes: 2 additions & 1 deletion factura_electronica/public/js/facelec.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ frappe.ui.form.on("Address", {
frm.set_df_property("city", "description", __("<b>FEL: Ciudad</b> p. ej.: Antigua Guatemala"));
frm.set_df_property("state", "description", __("<b>FEL: Departamento</b> p. ej.: Sacatepéquez"));
frm.set_df_property("county", "description", __("<b>FEL: Municipio</b> p. ej.: Antigua Guatemala"));

frm.set_df_property("county", "reqd", 1);
frm.set_df_property("country", "description", __("<b>FEL: Pais</b> p. ej: Guatemala"));
frm.set_df_property("email_id", "description", __("<b>FEL: Correo Electronico</b> p. ej: [email protected]"));
frm.set_df_property("email_id", "reqd", 1);
frm.set_df_property("phone", "description", __("<b>Teléfono:</b> p. ej: +502 2333-2516"));
frm.set_df_property("pincode", "description", __("<b>FEL: Código Postal</b> p. ej.: 03001"));
frm.set_df_property("is_primary_address", "description", __("<b>FEL: Dirección para facturar</b>"));
Expand Down

0 comments on commit f48c99e

Please sign in to comment.