Skip to content

Commit 47d7caf

Browse files
committed
Agregando FIX para declarar facturas solamente validas
1 parent 3f0caff commit 47d7caf

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

factura_electronica/factura_electronica/doctype/vat_declaration/vat_declaration.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"declaration_month",
1212
"posting_date",
1313
"documents_in_declaration_section",
14-
"declaration_items"
14+
"declaration_items",
15+
"amended_from"
1516
],
1617
"fields": [
1718
{
@@ -52,9 +53,19 @@
5253
"fieldtype": "Data",
5354
"label": "Title",
5455
"unique": 1
56+
},
57+
{
58+
"fieldname": "amended_from",
59+
"fieldtype": "Link",
60+
"label": "Amended From",
61+
"no_copy": 1,
62+
"options": "VAT Declaration",
63+
"print_hide": 1,
64+
"read_only": 1
5565
}
5666
],
57-
"modified": "2020-07-28 15:59:22.293228",
67+
"is_submittable": 1,
68+
"modified": "2020-07-28 18:05:37.730574",
5869
"modified_by": "Administrator",
5970
"module": "Factura Electronica",
6071
"name": "VAT Declaration",

factura_electronica/factura_electronica/report/purchase_and_sales_ledger_tax_declaration/generate_tax_declaration.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ def generate_vat_declaration(company, year, month, declared, report_data):
3030
for record in records:
3131
# 3 - Si no existe la declaracion se agregara
3232
if not frappe.db.exists('VAT Declaration', {'link_name': record.get('invoice_name')}):
33-
declaration_invoices.append({
34-
'link_doctype': 'Sales Invoice' if record.get('compras_ventas') == 'V' else 'Purchase Invoice',
35-
'link_name': record.get('invoice_name')
36-
})
33+
if record.get('docstatus') == 1: # Solamente recibira docs validados
34+
declaration_invoices.append({
35+
'link_doctype': 'Sales Invoice' if record.get('compras_ventas') == 'V' else 'Purchase Invoice',
36+
'link_name': record.get('invoice_name')
37+
})
3738

3839
# 4 - Validamos que por lo menos exista un elemento para crear la declaracion
3940
if len(declaration_invoices) > 0:
@@ -48,12 +49,15 @@ def generate_vat_declaration(company, year, month, declared, report_data):
4849
"declaration_year": year,
4950
"declaration_month": MONTHS_MAP.get(str(month)),
5051
"declaration_items": declaration_invoices,
51-
"docstatus": 0
52+
"docstatus": 1
5253
})
5354

5455
# for validated documents: status_journal = vat_dec.insert(ignore_permissions=True)
5556
# status_declaration = vat_dec.save(ignore_permissions=True)
5657
status_declaration = vat_dec.insert(ignore_permissions=True)
58+
59+
# 5 - Actualizamos las facturas con su nueva Referencia en campo de tipo data,
60+
5761
else:
5862
nme_reg = f'VAT Declaration {date.today()}'
5963
frappe.msgprint(msg=_(f"We're sorry. A statement for the same month was found: <b>{nme_reg}</b>,\

factura_electronica/factura_electronica/report/purchase_and_sales_ledger_tax_declaration/purchase_and_sales_ledger_tax_declaration.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ frappe.query_reports["Purchase and Sales Ledger Tax Declaration"] = {
9696
//window.open("/api/method/factura_electronica.api_erp.download_asl_files");
9797
// window.open("sihaysistema.com", "_blank");
9898
//console.log(report.filters);
99-
console.log(report.data);
99+
// console.log(report.data);
100100
frappe.call({
101101
method: "factura_electronica.factura_electronica.report.purchase_and_sales_ledger_tax_declaration.generate_tax_declaration.generate_vat_declaration",
102102
args: {

0 commit comments

Comments
 (0)