Skip to content

Commit

Permalink
Adding default vals quick entry
Browse files Browse the repository at this point in the history
  • Loading branch information
monroy95 committed May 14, 2021
1 parent 8b59676 commit 96ab0f1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion factura_electronica/api_erp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)

Expand Down Expand Up @@ -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')
Expand Down
24 changes: 21 additions & 3 deletions factura_electronica/patches/v7_0_9/update_props_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -36,7 +36,7 @@ def execute():
"doctype": "Address",
"fieldname": "email_id",
"property": "reqd",
"value": 1,
"value": 0,
"property_type": "Int"
})

Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions factura_electronica/public/js/facelec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<b>FEL:</b> Si no tiene disponible el NIT escriba C/F'
},
{
Expand All @@ -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: '<b>FEL:</b> Si no tiene disponible el NIT escriba C/F'
},
Expand Down Expand Up @@ -322,27 +324,31 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({
label: __("City/Town"),
fieldname: "city",
fieldtype: "Data",
default: 'Guatemala',
reqd: 1,
description: '<b>FEL Ciudad</b> ej.: Antigua Guatemala'
},
{
label: __("County"),
fieldname: "county",
fieldtype: "Data",
default: 'Guatemala',
reqd: 1,
description: '<b>FEL: Municipio</b> p. ej.: Antigua Guatemala'
},
{
label: __("State"),
fieldname: "state",
fieldtype: "Data",
default: 'Guatemala',
reqd: 1,
description: '<b>FEL Departamento</b> ej.: Sacatepéquez'
},
{
label: __("Country"),
fieldname: "country",
fieldtype: "Link",
default: 'Guatemala',
reqd: 1,
options: 'Country',
description: '<b>FEL Pais</b> ej: Guatemala'
Expand Down

0 comments on commit 96ab0f1

Please sign in to comment.