Subtotal |
-
+
|
-
+
|
-
- |
+
+ |
-
+
|
-
+
|
-
+
de
-
+
|
-
+
|
-
+
|
@@ -74,10 +97,10 @@
Total |
-
+
|
-
+
|
@@ -87,14 +110,21 @@
-
- Se Aplicó la Tasa de Cambio Oficial del Banco Central de Venezuela (BCV) de
-
- Bs
- por cada USD$,
+
+ Se Aplicó la Tasa de Cambio Oficial del Banco Central de Venezuela (BCV) de
+
+ Bs
+ por cada USD$,
de Conformidad con la Providencia del SENIAT SNAT/2011/00071 Artículo 13 numeral 14.
- PARA EFECTOS DEL PAGO DEBE UTILIZARSE LA TASA VIGENTE AL DIA DE PAGO
+ PARA EFECTOS DEL PAGO DEBE UTILIZARSE LA TASA VIGENTE AL DIA DE PAGO
diff --git a/l10n_ve_vat_ledger/__manifest__.py b/l10n_ve_vat_ledger/__manifest__.py
index 105b0bc4..10e08a13 100755
--- a/l10n_ve_vat_ledger/__manifest__.py
+++ b/l10n_ve_vat_ledger/__manifest__.py
@@ -6,28 +6,25 @@
#
###############################################################################
{
- 'name': "Localización Vat Ledger Venezuela",
- 'description': """
+ "name": "Localización Vat Ledger Venezuela",
+ "description": """
**Localización VENEZUELA Withholding**
- ¡Felicidades!. Este es el módulo Withholding para la implementación de
- la **Localización Venezuela** que agrega características y datos
+ ¡Felicidades!. Este es el módulo Withholding para la implementación de
+ la **Localización Venezuela** que agrega características y datos
necesarios para la generacion de los libros Iva ventas/ Compras.
""",
-
- 'author': "SINAPSYS GLOBAL SA || MASTERCORE SAS",
- 'website': "http://sinapsys.global",
- 'version': '15.0.8',
- 'category': 'Localization',
- 'license': 'AGPL-3',
- 'depends': [
- 'account', 'l10n_ve_base','l10n_ve_withholding', 'report_xlsx'],
- 'data': [
- 'security/security.xml',
- 'security/ir.model.access.csv',
- 'views/account_vat_ledger_views.xml',
- 'wizard/account_wizard_views.xml',
- 'report/account_vat_ledger_report.xml',
+ "author": "SINAPSYS GLOBAL SA || MASTERCORE SAS",
+ "website": "https://github.com/OCA/l10n-venezuela",
+ "version": "15.0.8",
+ "category": "Localization",
+ "license": "AGPL-3",
+ "depends": ["account", "l10n_ve_base", "l10n_ve_withholding", "report_xlsx"],
+ "data": [
+ "security/security.xml",
+ "security/ir.model.access.csv",
+ "views/account_vat_ledger_views.xml",
+ "wizard/account_wizard_views.xml",
+ "report/account_vat_ledger_report.xml",
],
-
}
diff --git a/l10n_ve_vat_ledger/models/account_move.py b/l10n_ve_vat_ledger/models/account_move.py
index 773286a3..2b6bd6ff 100755
--- a/l10n_ve_vat_ledger/models/account_move.py
+++ b/l10n_ve_vat_ledger/models/account_move.py
@@ -1,39 +1,28 @@
-from datetime import datetime, timedelta
-from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT
-from odoo import models, fields, api, _, tools
-from odoo.exceptions import UserError
-from ast import literal_eval
-import logging
-import io
-from io import BytesIO
-import xlsxwriter
-import shutil
-import base64
-import csv
-import xlwt
-import json
-from dateutil.relativedelta import relativedelta, MO
-from json import JSONDecodeError
-from odoo.exceptions import UserError, ValidationError
+from odoo import api, fields, models
class AccountMove(models.Model):
- _inherit = 'account.move'
+ _inherit = "account.move"
- @api.depends('reversed_entry_id')
+ @api.depends("reversed_entry_id")
def _compute_reversed_entry_code(self):
for rec in self:
- rec.reversed_entry_code = str(rec.reversed_entry_id.sequence_number).rjust(5, '0')
+ rec.reversed_entry_code = str(rec.reversed_entry_id.sequence_number).rjust(
+ 5, "0"
+ )
-
- reversed_entry_code = fields.Char(compute='_compute_reversed_entry_code')
+ reversed_entry_code = fields.Char(compute="_compute_reversed_entry_code")
def invoice_rate(self, currency_id, invoice_date):
for rec in self:
- last_rate = self.env['res.currency.rate'].search([
- ('currency_id', '=', currency_id),
- ('name', '<=', invoice_date)
- ], limit=1).rate
+ last_rate = (
+ self.env["res.currency.rate"]
+ .search(
+ [("currency_id", "=", currency_id), ("name", "<=", invoice_date)],
+ limit=1,
+ )
+ .rate
+ )
if not last_rate:
last_rate = 1
return last_rate
@@ -43,8 +32,10 @@ def amount_str_in_company_currency(self, amount, currency_id, date):
result = 0.00
if currency_id and date:
rate = rec.invoice_rate(currency_id, date)
- if amount.split('$'):
- amount_float = round(float(amount.replace(
- '.', '').replace(',', '.').split('$')[1]), 4)
- result = round(amount_float * (1/rate), 4)
+ if amount.split("$"):
+ amount_float = round(
+ float(amount.replace(".", "").replace(",", ".").split("$")[1]),
+ 4,
+ )
+ result = round(amount_float * (1 / rate), 4)
return result
diff --git a/l10n_ve_vat_ledger/models/account_vat_ledger.py b/l10n_ve_vat_ledger/models/account_vat_ledger.py
index d7a331d4..81a92ce6 100755
--- a/l10n_ve_vat_ledger/models/account_vat_ledger.py
+++ b/l10n_ve_vat_ledger/models/account_vat_ledger.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2020-Present.
@@ -6,74 +5,70 @@
#
#
###############################################################################
-from odoo import models, fields, api, _
import logging
-_logger = logging.getLogger(__name__)
+from odoo import _, api, fields, models
+_logger = logging.getLogger(__name__)
class AccountVatLedger(models.Model):
_name = "account.vat.ledger"
_description = "Account VAT Ledger"
- _inherit = ['mail.thread']
- _order = 'date_from desc'
+ _inherit = ["mail.thread"]
+ _order = "date_from desc"
company_id = fields.Many2one(
- 'res.company',
- string='Company',
+ "res.company",
+ string="Company",
required=True,
readonly=True,
- states={'draft': [('readonly', False)]},
- default=lambda self: self.env[
- 'res.company']._company_default_get('account.vat.ledger')
+ states={"draft": [("readonly", False)]},
+ default=lambda self: self.env["res.company"]._company_default_get(
+ "account.vat.ledger"
+ ),
)
type = fields.Selection(
- [('sale', 'Sale'), ('purchase', 'Purchase')],
- "Type",
- required=True
+ [("sale", "Sale"), ("purchase", "Purchase")], "Type", required=True
)
date_from = fields.Date(
- string='Start Date',
+ string="Start Date",
required=True,
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
date_to = fields.Date(
- string='End Date',
+ string="End Date",
required=True,
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
journal_ids = fields.Many2many(
- 'account.journal', 'account_vat_ledger_journal_rel',
- 'vat_ledger_id', 'journal_id',
- string='Journals',
+ "account.journal",
+ "account_vat_ledger_journal_rel",
+ "vat_ledger_id",
+ "journal_id",
+ string="Journals",
required=True,
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
state = fields.Selection(
- [('draft', 'Draft'), ('presented', 'Presented'), ('cancel', 'Cancel')],
- 'State',
+ [("draft", "Draft"), ("presented", "Presented"), ("cancel", "Cancel")],
+ "State",
required=True,
- default='draft'
+ default="draft",
)
- note = fields.Html(
- "Notes"
- )
-
+ note = fields.Html("Notes")
+
# Computed fields
- name = fields.Char(
- 'Title',
- compute='_compute_name'
- )
+ name = fields.Char("Title", compute="_compute_name")
reference = fields.Char(
- 'Reference',
+ "Reference",
)
invoice_ids = fields.Many2many(
- 'account.move',
+ "account.move",
string="Invoices",
)
@@ -82,78 +77,84 @@ def compute_invoices(self):
invoices_domain = []
invoices_domain += [
- ('state', 'not in', ['draft']),
- ('name','not in', ['/', False]),
- ('journal_id', 'in', rec.journal_ids.ids),
- ('company_id', '=', rec.company_id.id),
+ ("state", "not in", ["draft"]),
+ ("name", "not in", ["/", False]),
+ ("journal_id", "in", rec.journal_ids.ids),
+ ("company_id", "=", rec.company_id.id),
]
- if rec.type == 'sale':
+ if rec.type == "sale":
invoices_domain += [
- ('move_type', 'in',['out_invoice', 'out_refund']),
- ('invoice_date', '>=', rec.date_from),
- ('invoice_date', '<=', rec.date_to),]
- elif rec.type == 'purchase':
+ ("move_type", "in", ["out_invoice", "out_refund"]),
+ ("invoice_date", ">=", rec.date_from),
+ ("invoice_date", "<=", rec.date_to),
+ ]
+ elif rec.type == "purchase":
invoices_domain += [
- ('move_type', 'in',['in_invoice', 'in_refund']),
- ('date', '>=', rec.date_from),
- ('state', '!=', 'cancel'),
- ('date', '<=', rec.date_to),]
- rec.invoice_ids = rec.env['account.move'].search(invoices_domain,
- order='invoice_date desc, l10n_ve_document_number desc')
-
-
-
-
-
- @api.depends('type', 'reference',)
+ ("move_type", "in", ["in_invoice", "in_refund"]),
+ ("date", ">=", rec.date_from),
+ ("state", "!=", "cancel"),
+ ("date", "<=", rec.date_to),
+ ]
+ rec.invoice_ids = rec.env["account.move"].search(
+ invoices_domain, order="invoice_date desc, l10n_ve_document_number desc"
+ )
+
+ @api.depends(
+ "type",
+ "reference",
+ )
def _compute_name(self):
- date_format = self.env['res.lang']._lang_get(
- self._context.get('lang', 'en_US')).date_format
+ date_format = (
+ self.env["res.lang"]
+ ._lang_get(self._context.get("lang", "en_US"))
+ .date_format
+ )
for rec in self:
- if rec.type == 'sale':
- ledger_type = _('Ventas')
- elif rec.type == 'purchase':
- ledger_type = _('Compras')
+ if rec.type == "sale":
+ ledger_type = _("Ventas")
+ elif rec.type == "purchase":
+ ledger_type = _("Compras")
if rec.date_from and rec.date_to:
- name = _("Libro IVA ({0}) {1} - {2}").format(ledger_type,
- rec.date_from and fields.Date.from_string(rec.date_from).strftime(date_format) or '',
- rec.date_to and fields.Date.from_string(
- rec.date_to).strftime(date_format) or ''
- )
- else:
- name = _("Libro IVA (%s)") % (
+ name = _("Libro IVA ({0}) {1} - {2}").format(
ledger_type,
+ rec.date_from
+ and fields.Date.from_string(rec.date_from).strftime(date_format)
+ or "",
+ rec.date_to
+ and fields.Date.from_string(rec.date_to).strftime(date_format)
+ or "",
)
+ else:
+ name = _("Libro IVA (%s)") % (ledger_type,)
if rec.reference:
name = "%s - %s" % (name, rec.reference)
rec.name = name
-
-
- @api.onchange('company_id')
+ @api.onchange("company_id")
def change_company(self):
- if self.type == 'sale':
- domain = [('type', '=', 'sale')]
- elif self.type == 'purchase':
- domain = [('type', '=', 'purchase')]
- domain += [('company_id', '=', self.company_id.id),]
- journals = self.env['account.journal'].search(domain)
+ if self.type == "sale":
+ domain = [("type", "=", "sale")]
+ elif self.type == "purchase":
+ domain = [("type", "=", "purchase")]
+ domain += [
+ ("company_id", "=", self.company_id.id),
+ ]
+ journals = self.env["account.journal"].search(domain)
self.journal_ids = journals
def action_present(self):
self.compute_invoices()
- self.state = 'presented'
+ self.state = "presented"
def action_cancel(self):
- self.state = 'cancel'
+ self.state = "cancel"
def action_to_draft(self):
- self.state = 'draft'
+ self.state = "draft"
def action_print(self):
self.ensure_one()
- model_name = \
- "l10n_ve_vat_ledger.action_account_vat_ledger_report_xlsx"
+ model_name = "l10n_ve_vat_ledger.action_account_vat_ledger_report_xlsx"
self.env.ref(model_name).report_file = self.display_name
return self.env.ref(model_name).report_action(self)
diff --git a/l10n_ve_vat_ledger/report/__init__.py b/l10n_ve_vat_ledger/report/__init__.py
index f5512ac7..71f17028 100755
--- a/l10n_ve_vat_ledger/report/__init__.py
+++ b/l10n_ve_vat_ledger/report/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2020-Present.
@@ -6,4 +5,4 @@
#
#
###############################################################################
-from . import account_vat_ledger_xlsx
\ No newline at end of file
+from . import account_vat_ledger_xlsx
diff --git a/l10n_ve_vat_ledger/report/account_vat_ledger_report.xml b/l10n_ve_vat_ledger/report/account_vat_ledger_report.xml
index 167f6db4..0c5b60a3 100755
--- a/l10n_ve_vat_ledger/report/account_vat_ledger_report.xml
+++ b/l10n_ve_vat_ledger/report/account_vat_ledger_report.xml
@@ -1,7 +1,11 @@
-
+
-
+
Account Vat Ledger Xlsx
ir.actions.report
account.vat.ledger
diff --git a/l10n_ve_vat_ledger/report/account_vat_ledger_xlsx.py b/l10n_ve_vat_ledger/report/account_vat_ledger_xlsx.py
index 388a904f..31505ff7 100755
--- a/l10n_ve_vat_ledger/report/account_vat_ledger_xlsx.py
+++ b/l10n_ve_vat_ledger/report/account_vat_ledger_xlsx.py
@@ -2,27 +2,22 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
-from re import search
-from datetime import datetime, timedelta
-from odoo import models, fields, api, _
import json
+
# import time
import logging
-import xlsxwriter
-import shutil
-import base64
-import csv
-import xlwt
+from datetime import timedelta
+
+from odoo import _, models
_logger = logging.getLogger(__name__)
+
class AccountVatLedgerXlsx(models.AbstractModel):
- _name = 'report.l10n_ve_vat_ledger.account_vat_ledger_xlsx'
- _inherit = 'report.report_xlsx.abstract'
+ _name = "report.l10n_ve_vat_ledger.account_vat_ledger_xlsx"
+ _inherit = "report.report_xlsx.abstract"
_description = "Xlsx Account VAT Ledger"
-
-
def find_values(self, id, json_repr):
results = []
@@ -32,70 +27,69 @@ def _decode_dict(a_dict):
except KeyError:
pass
return a_dict
+
# Return value ignored.
json.loads(json_repr, object_hook=_decode_dict)
return results
-
def generate_xlsx_report(self, workbook, data, account_vat):
for obj in account_vat:
report_name = obj.name
sheet = workbook.add_worksheet(report_name[:31])
- title = workbook.add_format({'bold': True})
- bold = workbook.add_format({'bold': True, 'border':1})
-
+ title = workbook.add_format({"bold": True})
+ bold = workbook.add_format({"bold": True, "border": 1})
# Resumen IVA
# sheet2 = workbook.add_worksheet('Resumen consolidado de IVA')
# style nuevo
- cell_format = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'center',
- 'valign': 'vcenter',
- 'fg_color': '#a64d79',
- 'font_color': 'white',
- 'text_wrap': 1})
-
- cell_format_1 = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'center',
- 'fg_color': '#a64d79',
- 'font_color': 'white'})
-
- cell_format_2 = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'left',
- 'fg_color': '#a64d79',
- 'font_color': 'white'})
-
- title = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'center',
- 'valign': 'vcenter'})
-
- title_style = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'left'})
-
- line = workbook.add_format({
- 'border': 1,
- 'align': 'center'})
-
- line_total = workbook.add_format({
- 'border': 1,
- 'fg_color': '#f0f0f0',
- 'bold': 1,
- 'align': 'center'})
+ cell_format = workbook.add_format(
+ {
+ "bold": 1,
+ "border": 1,
+ "align": "center",
+ "valign": "vcenter",
+ "fg_color": "#a64d79",
+ "font_color": "white",
+ "text_wrap": 1,
+ }
+ )
+
+ cell_format_1 = workbook.add_format(
+ {
+ "bold": 1,
+ "border": 1,
+ "align": "center",
+ "fg_color": "#a64d79",
+ "font_color": "white",
+ }
+ )
+
+ cell_format_2 = workbook.add_format(
+ {
+ "bold": 1,
+ "border": 1,
+ "align": "left",
+ "fg_color": "#a64d79",
+ "font_color": "white",
+ }
+ )
+
+ title = workbook.add_format(
+ {"bold": 1, "border": 1, "align": "center", "valign": "vcenter"}
+ )
+
+ title_style = workbook.add_format({"bold": 1, "border": 1, "align": "left"})
+
+ line = workbook.add_format({"border": 1, "align": "center"})
+
+ line_total = workbook.add_format(
+ {"border": 1, "fg_color": "#f0f0f0", "bold": 1, "align": "center"}
+ )
date_line = workbook.add_format(
- {'border': 1, 'num_format': 'dd-mm-yyyy',
- 'align': 'center'})
+ {"border": 1, "num_format": "dd-mm-yyyy", "align": "center"}
+ )
sheet.set_column(0, 0, 9)
sheet.set_column(1, 4, 20)
@@ -128,107 +122,130 @@ def generate_xlsx_report(self, workbook, data, account_vat):
sheet.set_column(5, 28, 30)
sheet.set_column(5, 29, 30)
sheet.set_column(5, 30, 30)
-# _____________________________________________________________________________________
-# _____________________________________________________________________________________
- if obj.type == 'purchase':
-
- sheet.merge_range('A1:D1', obj.company_id.name,title_style)
- sheet.merge_range('A2:D2', _('%s-%s', obj.company_id.l10n_latam_identification_type_id.l10n_ve_code, obj.company_id.vat), title_style)
- sheet.merge_range('A3:G3', obj.name + ' ' + 'Libro de IVA Compras' + ' ' + 'mes' + ' ' + 'Año', title_style)
+ # _____________________________________________________________________________________
+ # _____________________________________________________________________________________
+ if obj.type == "purchase":
+
+ sheet.merge_range("A1:D1", obj.company_id.name, title_style)
+ sheet.merge_range(
+ "A2:D2",
+ _(
+ "%s-%s",
+ obj.company_id.l10n_latam_identification_type_id.l10n_ve_code,
+ obj.company_id.vat,
+ ),
+ title_style,
+ )
+ sheet.merge_range(
+ "A3:G3",
+ obj.name + " " + "Libro de IVA Compras" + " " + "mes" + " " + "Año",
+ title_style,
+ )
# alto de las celdas
sheet.set_row(4, 30)
- sheet.write(4, 0, 'Nro Oper.', cell_format)
- sheet.write(4, 1, 'Fecha de la Factura o Documento', cell_format)
- sheet.write(4, 2, 'Tipo de Documento', cell_format)
- sheet.write(4, 3, 'Número de Documento', cell_format)
- sheet.write(4, 4, 'Número de Control', cell_format)
- sheet.write(4, 5, 'Número de Comprobante', cell_format)
- sheet.write(4, 6, 'Número Factura Afectada', cell_format)
- sheet.write(4, 7, 'Nª planilla de Importaciòn', cell_format)
- sheet.write(4, 8, 'Nª de Expediente de Importaciòn', cell_format)
- sheet.write(4, 9, 'Nombre o Razón Social', cell_format)
- sheet.write(4, 10, 'RIF', cell_format)
- sheet.write(4, 11, 'Total Compras Bs. Incluyendo IVA.', cell_format)
- sheet.write(4, 12, 'Compras sin Derecho a Crédito I.V.A.', cell_format)
+ sheet.write(4, 0, "Nro Oper.", cell_format)
+ sheet.write(4, 1, "Fecha de la Factura o Documento", cell_format)
+ sheet.write(4, 2, "Tipo de Documento", cell_format)
+ sheet.write(4, 3, "Número de Documento", cell_format)
+ sheet.write(4, 4, "Número de Control", cell_format)
+ sheet.write(4, 5, "Número de Comprobante", cell_format)
+ sheet.write(4, 6, "Número Factura Afectada", cell_format)
+ sheet.write(4, 7, "Nª planilla de Importaciòn", cell_format)
+ sheet.write(4, 8, "Nª de Expediente de Importaciòn", cell_format)
+ sheet.write(4, 9, "Nombre o Razón Social", cell_format)
+ sheet.write(4, 10, "RIF", cell_format)
+ sheet.write(4, 11, "Total Compras Bs. Incluyendo IVA.", cell_format)
+ sheet.write(4, 12, "Compras sin Derecho a Crédito I.V.A.", cell_format)
# celda adicional compras por cuenta de terceros
- sheet.merge_range('N4:P4','Importaciones', cell_format)
- sheet.write(4, 13, 'Base Imponible', cell_format)
- sheet.write(4, 14, '% Alic.', cell_format)
- sheet.write(4, 15, 'Imp. I.V.A.', cell_format)
+ sheet.merge_range("N4:P4", "Importaciones", cell_format)
+ sheet.write(4, 13, "Base Imponible", cell_format)
+ sheet.write(4, 14, "% Alic.", cell_format)
+ sheet.write(4, 15, "Imp. I.V.A.", cell_format)
# # IVA RETENIDO
- sheet.merge_range('Q4:Z4', 'Compras Internas', cell_format)
- sheet.write(4, 16, 'Base Imponible', cell_format)
- sheet.write(4, 17, 'Alicuota 16%', cell_format)
- sheet.write(4, 18, 'Imp. I.V.A.', cell_format)
- sheet.write(4, 19, 'B. Imponible', cell_format)
- sheet.write(4, 20, 'Alicuota 8%', cell_format)
- sheet.write(4, 21, 'Imp. I.V.A.', cell_format)
+ sheet.merge_range("Q4:Z4", "Compras Internas", cell_format)
+ sheet.write(4, 16, "Base Imponible", cell_format)
+ sheet.write(4, 17, "Alicuota 16%", cell_format)
+ sheet.write(4, 18, "Imp. I.V.A.", cell_format)
+ sheet.write(4, 19, "B. Imponible", cell_format)
+ sheet.write(4, 20, "Alicuota 8%", cell_format)
+ sheet.write(4, 21, "Imp. I.V.A.", cell_format)
- sheet.write(4, 22, 'B. Imponible', cell_format)
- sheet.write(4, 23, 'Alicuota 31%', cell_format)
- sheet.write(4, 24, 'Imp. I.V.A.', cell_format)
+ sheet.write(4, 22, "B. Imponible", cell_format)
+ sheet.write(4, 23, "Alicuota 31%", cell_format)
+ sheet.write(4, 24, "Imp. I.V.A.", cell_format)
- sheet.write(4, 25, 'I.V.A. Retenido por el comprador', cell_format)
- sheet.write(4, 26, 'I.G.T.F Pagado ', cell_format)
+ sheet.write(4, 25, "I.V.A. Retenido por el comprador", cell_format)
+ sheet.write(4, 26, "I.G.T.F Pagado ", cell_format)
- elif obj.type == 'sale':
+ elif obj.type == "sale":
- sheet.merge_range('A1:D1', obj.company_id.name, title_style)
+ sheet.merge_range("A1:D1", obj.company_id.name, title_style)
# sheet.merge_range('E2:S2', 'LIBRO DE VENTAS (FECHA DESDE:' + ' ' + str(obj.date_from) + ' ' + 'HASTA:' + ' ' + str(obj.date_from) + ')', title)
- sheet.merge_range('A2:D2', _('%s-%s', obj.company_id.l10n_latam_identification_type_id.l10n_ve_code, obj.company_id.vat), title_style)
- sheet.merge_range('A3:G3', obj.name + ' ' + 'Libro de IVA Ventas' + ' ' + 'mes' + ' ' + 'Año',
- title_style)
+ sheet.merge_range(
+ "A2:D2",
+ _(
+ "%s-%s",
+ obj.company_id.l10n_latam_identification_type_id.l10n_ve_code,
+ obj.company_id.vat,
+ ),
+ title_style,
+ )
+ sheet.merge_range(
+ "A3:G3",
+ obj.name + " " + "Libro de IVA Ventas" + " " + "mes" + " " + "Año",
+ title_style,
+ )
# alto de las celdas
sheet.set_row(4, 30)
- sheet.write(4, 0, 'Nro Oper.', cell_format)
- sheet.write(4, 1, 'Fecha de la Factura', cell_format)
- sheet.write(4, 2, 'Tipo de Documento', cell_format)
- sheet.write(4, 3, 'Factura o Número de Documento', cell_format)
- sheet.write(4, 4, 'Número de Control', cell_format)
- sheet.write(4, 5, 'N° comprobante', cell_format)
- sheet.write(4, 6, 'Número Factura Afectada', cell_format)
- sheet.write(4, 7, 'Nombre o Razón Social', cell_format)
- sheet.write(4, 8, 'RIF', cell_format)
- sheet.write(4, 9, 'Total Ventas Bs. Incluyendo IVA.', cell_format)
+ sheet.write(4, 0, "Nro Oper.", cell_format)
+ sheet.write(4, 1, "Fecha de la Factura", cell_format)
+ sheet.write(4, 2, "Tipo de Documento", cell_format)
+ sheet.write(4, 3, "Factura o Número de Documento", cell_format)
+ sheet.write(4, 4, "Número de Control", cell_format)
+ sheet.write(4, 5, "N° comprobante", cell_format)
+ sheet.write(4, 6, "Número Factura Afectada", cell_format)
+ sheet.write(4, 7, "Nombre o Razón Social", cell_format)
+ sheet.write(4, 8, "RIF", cell_format)
+ sheet.write(4, 9, "Total Ventas Bs. Incluyendo IVA.", cell_format)
# celda adicional Ventas por cuenta de terceros
- sheet.merge_range('K4:N4', 'Ventas por cuenta de terceros', cell_format)
- sheet.write(4, 10, 'Ventas Internas No Gravadas', cell_format)
- sheet.write(4, 11, 'Base Imponible', cell_format)
- sheet.write(4, 12, '% Alicuota.', cell_format)
- sheet.write(4, 13, 'Impuesto I.V.A', cell_format)
+ sheet.merge_range("K4:N4", "Ventas por cuenta de terceros", cell_format)
+ sheet.write(4, 10, "Ventas Internas No Gravadas", cell_format)
+ sheet.write(4, 11, "Base Imponible", cell_format)
+ sheet.write(4, 12, "% Alicuota.", cell_format)
+ sheet.write(4, 13, "Impuesto I.V.A", cell_format)
# celda adicional Contribuyente
- sheet.merge_range('O4:U4', 'Contribuyente', cell_format)
- sheet.write(4, 14, 'Ventas Internas No Gravadas', cell_format)
- sheet.write(4, 15, 'Base Imponible', cell_format)
- sheet.write(4, 16, '% Alicuota General', cell_format)
- sheet.write(4, 17, 'Impuesto I.V.A', cell_format)
- sheet.write(4, 18, 'Base Imponible', cell_format)
- sheet.write(4, 19, '% Alicuota Reducida', cell_format)
- sheet.write(4, 20, 'Impuesto I.V.A', cell_format)
+ sheet.merge_range("O4:U4", "Contribuyente", cell_format)
+ sheet.write(4, 14, "Ventas Internas No Gravadas", cell_format)
+ sheet.write(4, 15, "Base Imponible", cell_format)
+ sheet.write(4, 16, "% Alicuota General", cell_format)
+ sheet.write(4, 17, "Impuesto I.V.A", cell_format)
+ sheet.write(4, 18, "Base Imponible", cell_format)
+ sheet.write(4, 19, "% Alicuota Reducida", cell_format)
+ sheet.write(4, 20, "Impuesto I.V.A", cell_format)
# celda adicional No Contribuyente
- sheet.merge_range('V4:AB4', 'No Contribuyente', cell_format)
- sheet.write(4, 21, 'Ventas Internas No Gravadas', cell_format)
- sheet.write(4, 22, 'Base Imponible', cell_format)
- sheet.write(4, 23, '% Alicuota.', cell_format)
- sheet.write(4, 24, 'Impuesto I.V.A', cell_format)
- sheet.write(4, 25, 'Base Imponible', cell_format)
- sheet.write(4, 26, '% Alicuota Reducida', cell_format)
- sheet.write(4, 27, 'Impuesto I.V.A', cell_format)
+ sheet.merge_range("V4:AB4", "No Contribuyente", cell_format)
+ sheet.write(4, 21, "Ventas Internas No Gravadas", cell_format)
+ sheet.write(4, 22, "Base Imponible", cell_format)
+ sheet.write(4, 23, "% Alicuota.", cell_format)
+ sheet.write(4, 24, "Impuesto I.V.A", cell_format)
+ sheet.write(4, 25, "Base Imponible", cell_format)
+ sheet.write(4, 26, "% Alicuota Reducida", cell_format)
+ sheet.write(4, 27, "Impuesto I.V.A", cell_format)
# celda adicional Retención IVA
# sheet.merge_range('AB4:AD4', 'Retención IVA', cell_format)
- sheet.write(4, 28, 'I.V.A Retenido', cell_format)
+ sheet.write(4, 28, "I.V.A Retenido", cell_format)
# sheet.write(4, 29, 'Factura afectada', cell_format)
- sheet.write(4, 29, 'I.G.T.F Percibido', cell_format)
+ sheet.write(4, 29, "I.G.T.F Percibido", cell_format)
row = 5
total_base_exento = 0.00
@@ -241,12 +258,6 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_base_imponible_8 = 0.00
total_iva_8 = 0.00
- total_iva_8_igtf = 0.00
-
- total_base_imponible_15 = 0.00
- total_iva_15 = 0.00
- total_iva_15_igtf = 0.00
- alic = ''
total_base_imponible_31 = 0.00
total_iva_31 = 0.00
@@ -264,7 +275,7 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_nota_debito_31 = 0.00
total_nota_debito_iva_31 = 0.00
total_igtf = 0.00
- """
+ """
Totales columnas ventas
"""
@@ -280,7 +291,7 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_base_imponible_no_contribuyente_8 = 0.00
total_iva_no_contribuyente_8 = 0.00
- """
+ """
Totales columnas compras
"""
@@ -291,114 +302,145 @@ def generate_xlsx_report(self, workbook, data, account_vat):
c_total_iva_8 = 0.00
c_total_base_imponible_31 = 0.00
c_total_iva_31 = 0.00
-
+
i = 0
-
- """
+
+ """
Retenciones
"""
tax_withholding_id = []
retens = []
- if obj.type == 'purchase':
- tax_withholding_id = self.env['account.tax'].search([
- ('type_tax_use', '=', 'supplier'),
- ('withholding_type', '=', 'partner_tax')
- ], limit=1)
+ if obj.type == "purchase":
+ tax_withholding_id = self.env["account.tax"].search(
+ [
+ ("type_tax_use", "=", "supplier"),
+ ("withholding_type", "=", "partner_tax"),
+ ],
+ limit=1,
+ )
else:
- tax_withholding_id = self.env['account.tax'].search([
- ('type_tax_use', '=', 'customer'),
- ('name', 'like', 'IVA')
- ], limit=1)
+ tax_withholding_id = self.env["account.tax"].search(
+ [("type_tax_use", "=", "customer"), ("name", "like", "IVA")],
+ limit=1,
+ )
if tax_withholding_id:
- retens = self.env['account.payment'].search([
- ('tax_withholding_id', '=', tax_withholding_id.id),
- ('state', '=', 'posted'),
- ('date', '>=', obj.date_from),
- ('date', '<=', obj.date_to),
- ])
+ retens = self.env["account.payment"].search(
+ [
+ ("tax_withholding_id", "=", tax_withholding_id.id),
+ ("state", "=", "posted"),
+ ("date", ">=", obj.date_from),
+ ("date", "<=", obj.date_to),
+ ]
+ )
retenciones = []
if retens:
retenciones = list(retens)
- if obj.type == 'sale':
+ if obj.type == "sale":
invoices = reversed(obj.invoice_ids)
- elif obj.type == 'purchase':
+ elif obj.type == "purchase":
invoices = sorted(obj.invoice_ids, key=lambda x: x.invoice_date)
-
+
date_reference = obj.date_from
-
+
for idx, invoice in enumerate(invoices):
- if obj.type == 'purchase':
+ if obj.type == "purchase":
if date_reference <= invoice.invoice_date:
while date_reference < invoice.invoice_date:
- coincident_date = [tup for tup in retenciones if date_reference == tup.date ]
+ coincident_date = [
+ tup for tup in retenciones if date_reference == tup.date
+ ]
if coincident_date:
for reten in coincident_date:
- total_iva_16_retenido += reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency
+ total_iva_16_retenido += (
+ reten.amount
+ if reten.currency_id
+ == reten.company_id.currency_id
+ else reten.amount_company_currency
+ )
i += 1
- # codigo
+ # codigo
sheet.write(row, 0, i, line)
# fehca
sheet.write(row, 1, reten.date, date_line)
# tipo de documento
- sheet.write(row, 2, 'Retención', line)
- sheet.write(row, 3, '', line)
- sheet.write(row, 4, '', line)
+ sheet.write(row, 2, "Retención", line)
+ sheet.write(row, 3, "", line)
+ sheet.write(row, 4, "", line)
# Numero de comrpobante
sheet.write(row, 5, reten.withholding_number, line)
# Documento afectado
- sheet.write(row, 6, reten.reconciled_bill_ids.ref, line)
- sheet.write(row, 7, '', line)
- sheet.write(row, 8, '', line)
+ sheet.write(
+ row, 6, reten.reconciled_bill_ids.ref, line
+ )
+ sheet.write(row, 7, "", line)
+ sheet.write(row, 8, "", line)
# Nombre
- sheet.write(row, 9, reten.move_id.partner_id.name, line)
+ sheet.write(
+ row, 9, reten.move_id.partner_id.name, line
+ )
# RIF
- sheet.write(row, 10, '%s-%s' % (reten.move_id.partner_id. \
- l10n_latam_identification_type_id.l10n_ve_code or 'FALSE',
- reten.move_id.partner_id.vat or 'FALSE'), line)
- #Total
- sheet.write(row, 11, '', line)
+ sheet.write(
+ row,
+ 10,
+ "%s-%s"
+ % (
+ reten.move_id.partner_id.l10n_latam_identification_type_id.l10n_ve_code
+ or "FALSE",
+ reten.move_id.partner_id.vat or "FALSE",
+ ),
+ line,
+ )
+ # Total
+ sheet.write(row, 11, "", line)
# Compras Exento
- sheet.write(row, 12, '', line)
+ sheet.write(row, 12, "", line)
- #IMPORTACIONES
+ # IMPORTACIONES
# Base Imponible
- sheet.write(row, 13, '', line)
+ sheet.write(row, 13, "", line)
# % Alic
- sheet.write(row, 14, '', line)
- #Imp. IVA
- sheet.write(row, 15, '', line)
+ sheet.write(row, 14, "", line)
+ # Imp. IVA
+ sheet.write(row, 15, "", line)
- #Compras internas
+ # Compras internas
# Base Imponible
- sheet.write(row, 16, '', line)
+ sheet.write(row, 16, "", line)
# % Alic
- sheet.write(row, 17, '', line)
- #Imp. IVA
- sheet.write(row, 18, '', line)
+ sheet.write(row, 17, "", line)
+ # Imp. IVA
+ sheet.write(row, 18, "", line)
- #IVA 8%
+ # IVA 8%
# Base Imponible
- sheet.write(row, 19, '', line)
+ sheet.write(row, 19, "", line)
# % Alic
- sheet.write(row, 20, '', line)
- #Imp. IVA
- sheet.write(row, 21, '', line)
+ sheet.write(row, 20, "", line)
+ # Imp. IVA
+ sheet.write(row, 21, "", line)
- #IVA 31%
+ # IVA 31%
# Base Imponible
- sheet.write(row, 22, '', line)
+ sheet.write(row, 22, "", line)
# % Alic
- sheet.write(row, 23, '', line)
- #Imp. IVA
- sheet.write(row, 24, '', line)
-
-
- #Retenciones
- sheet.write(row, 25, reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency, line)
+ sheet.write(row, 23, "", line)
+ # Imp. IVA
+ sheet.write(row, 24, "", line)
+
+ # Retenciones
+ sheet.write(
+ row,
+ 25,
+ reten.amount
+ if reten.currency_id
+ == reten.company_id.currency_id
+ else reten.amount_company_currency,
+ line,
+ )
###### IGTF
- sheet.write(row, 26, '', line)
+ sheet.write(row, 26, "", line)
retenciones.remove(reten)
- row +=1
+ row += 1
else:
date_reference += timedelta(days=1)
@@ -406,74 +448,92 @@ def generate_xlsx_report(self, workbook, data, account_vat):
# contador de la factura
sheet.write(row, 0, i, line)
# codigo fecha
- sheet.write(row, 1, invoice.invoice_date or 'FALSE', date_line)
+ sheet.write(row, 1, invoice.invoice_date or "FALSE", date_line)
# tipo de documento
- if invoice.move_type == 'out_invoice':
- sheet.write(row, 2, 'Factura', line)
- elif invoice.move_type == 'out_refund' and not invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Credito', line)
- elif invoice.move_type == 'out_refund' and invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Debito', line)
- elif invoice.move_type == 'in_invoice':
- sheet.write(row, 2, 'Factura', line)
- elif invoice.move_type == 'in_refund' and not invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Credito', line)
- elif invoice.move_type == 'in_refund' and invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Debito', line)
+ if invoice.move_type == "out_invoice":
+ sheet.write(row, 2, "Factura", line)
+ elif (
+ invoice.move_type == "out_refund"
+ and not invoice.debit_origin_id
+ ):
+ sheet.write(row, 2, "Nota de Credito", line)
+ elif invoice.move_type == "out_refund" and invoice.debit_origin_id:
+ sheet.write(row, 2, "Nota de Debito", line)
+ elif invoice.move_type == "in_invoice":
+ sheet.write(row, 2, "Factura", line)
+ elif (
+ invoice.move_type == "in_refund" and not invoice.debit_origin_id
+ ):
+ sheet.write(row, 2, "Nota de Credito", line)
+ elif invoice.move_type == "in_refund" and invoice.debit_origin_id:
+ sheet.write(row, 2, "Nota de Debito", line)
# Número de Documento
- sheet.write(row, 3, invoice.ref or '', line)
+ sheet.write(row, 3, invoice.ref or "", line)
# Número de Control
- sheet.write(row, 4, invoice.l10n_ve_document_number or '', line)
-
-
+ sheet.write(row, 4, invoice.l10n_ve_document_number or "", line)
+
# Retencion
# Numero de comprobante
- sheet.write(row, 5, '', line)
+ sheet.write(row, 5, "", line)
# Número Factura Afectada si es de debito o credito
- if invoice.move_type == 'in_refund' or invoice.move_type == 'out_refund':
+ if (
+ invoice.move_type == "in_refund"
+ or invoice.move_type == "out_refund"
+ ):
move_reconcileds = invoice._get_reconciled_info_JSON_values()
- inv_info = ''
+ inv_info = ""
moves = []
if move_reconcileds:
for m in move_reconcileds:
- moves.append(m['move_id'])
- move_ids = self.env['account.move'].search(
- [('id', 'in', moves)])
+ moves.append(m["move_id"])
+ move_ids = self.env["account.move"].search(
+ [("id", "in", moves)]
+ )
for mov in move_ids:
- if mov.move_type == 'in_invoice' and mov.state == 'posted':
+ if (
+ mov.move_type == "in_invoice"
+ and mov.state == "posted"
+ ):
inv_info = mov.ref
sheet.write(row, 6, inv_info, line)
else:
- sheet.write(row, 6, '', line)
+ sheet.write(row, 6, "", line)
# Planilla de importacion
- sheet.write(row, 7, '', line)
+ sheet.write(row, 7, "", line)
# Nro Expediente de importacion
- sheet.write(row, 8, '', line)
+ sheet.write(row, 8, "", line)
# nombre del partner
- sheet.write(row, 9, invoice.partner_id.name or 'FALSE', line)
+ sheet.write(row, 9, invoice.partner_id.name or "FALSE", line)
# Rif del cliente
- sheet.write(row, 10, '%s-%s' % (invoice.partner_id. \
- l10n_latam_identification_type_id.l10n_ve_code or 'FALSE',
- invoice.partner_id.vat or 'FALSE'), line)
+ sheet.write(
+ row,
+ 10,
+ "%s-%s"
+ % (
+ invoice.partner_id.l10n_latam_identification_type_id.l10n_ve_code
+ or "FALSE",
+ invoice.partner_id.vat or "FALSE",
+ ),
+ line,
+ )
# Tipo de Proveedor Compras
# sheet.write(row, 10, invoice.partner_id.l10n_ve_responsibility_type_id.name or 'FALSE', line)
- #Total Compras con IVA
- sheet.write(
- row, 11, (invoice.amount_total_signed * -1.00), line)
+ # Total Compras con IVA
+ sheet.write(row, 11, (invoice.amount_total_signed * -1.00), line)
####IMPUESTOS##########
-
+
base_exento = 0.00
base_imponible = 0.00
iva_16 = 0.00
- alic_16 = ''
- alic_8 = ''
+ alic_16 = ""
+ alic_8 = ""
iva_8 = 0.00
- alic_31 = ''
+ alic_31 = ""
iva_31 = 0.00
base_imponible_8 = 0.00
base_imponible_31 = 0.00
@@ -481,66 +541,148 @@ def generate_xlsx_report(self, workbook, data, account_vat):
for linel in invoice.line_ids:
if linel.tax_ids:
if linel.tax_ids[0].amount == 16.00:
- base_imponible += linel.debit if linel.credit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or \
- invoice.move_type == 'in_refund' or (invoice.move_type == 'out_invoice' \
- and invoice.debit_origin_id):
- base_imponible += (linel.credit * -1.00) if linel.credit == 0 else 0
+ base_imponible += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_imponible += (
+ (linel.credit * -1.00)
+ if linel.credit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_nota_credito_16 += linel.credit * -1.00
+ total_nota_credito_16 += (
+ linel.credit * -1.00
+ )
else:
base_imponible += linel.debit
total_nota_debito_16 += linel.debit
else:
- total_base_imponible_16 += linel.debit if linel.credit == 0 else -linel.debit
- alic_16 = '16%'
+ total_base_imponible_16 += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ alic_16 = "16%"
elif linel.tax_ids[0].amount == 0.00:
- base_exento += linel.debit if linel.credit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
- base_exento += linel.credit * -1.00 if linel.credit == 0 else 0
+ base_exento += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_exento += (
+ linel.credit * -1.00
+ if linel.credit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_base_exento_credito += linel.credit * -1.00
+ total_base_exento_credito += (
+ linel.credit * -1.00
+ )
else:
base_exento += linel.debit
total_base_exento_debito += linel.debit
else:
- total_base_exento += linel.debit if linel.credit == 0 else -linel.debit
+ total_base_exento += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
elif linel.tax_ids[0].amount == 8.00:
- base_imponible_8 += linel.debit if linel.credit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
- base_imponible_8 += linel.credit * -1.00 if linel.credit == 0 else 0
+ base_imponible_8 += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_imponible_8 += (
+ linel.credit * -1.00
+ if linel.credit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_nota_credito_8 += linel.credit * -1.00
+ total_nota_credito_8 += linel.credit * -1.00
else:
base_imponible_8 += linel.debit
total_nota_debito_8 += linel.debit
else:
- total_base_imponible_8 += linel.debit if linel.credit == 0 else -linel.debit
- alic_8 = '8%'
-
- ## BASE IMPONIBLE 31%
+ total_base_imponible_8 += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ alic_8 = "8%"
+
+ ## BASE IMPONIBLE 31%
elif linel.tax_ids[0].amount == 31.00:
- print('####### ENTRO ENBASE IMPONIBLE #########')
- base_imponible_31 += linel.debit if linel.credit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
- base_imponible_31 += linel.credit * -1.00 if linel.credit == 0 else 0
+ print("####### ENTRO ENBASE IMPONIBLE #########")
+ base_imponible_31 += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_imponible_31 += (
+ linel.credit * -1.00
+ if linel.credit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_nota_credito_31 += linel.credit * -1.00
+ total_nota_credito_31 += (
+ linel.credit * -1.00
+ )
else:
base_imponible_31 += linel.debit
total_nota_debito_31 += linel.debit
else:
- total_base_imponible_31 += linel.debit if linel.credit == 0 else -linel.debit
- alic_31 = '31%'
- elif linel.name == 'IVA (16.0%) compras':
+ total_base_imponible_31 += (
+ linel.debit
+ if linel.credit == 0
+ else -linel.debit
+ )
+ alic_31 = "31%"
+ elif linel.name == "IVA (16.0%) compras":
iva_16 += linel.debit
- if invoice.move_type == 'out_refund' or \
- invoice.move_type == 'in_refund' or (invoice.move_type == 'out_invoice' \
- and invoice.debit_origin_id):
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
iva_16 += linel.credit * -1.00
if not invoice.debit_origin_id:
total_nota_credito_iva_16 += iva_16
@@ -549,10 +691,16 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_nota_debito_iva_16 += iva_16
else:
total_iva_16 += iva_16
- elif linel.name == 'IVA (8.0%) compras':
+ elif linel.name == "IVA (8.0%) compras":
iva_8 += linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
iva_8 += linel.credit * -1.00
if not invoice.debit_origin_id:
total_nota_credito_iva_8 += iva_8
@@ -561,12 +709,18 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_nota_debito_iva_8 += iva_8
else:
total_iva_8 += iva_8
- alic_8 = '8%'
+ alic_8 = "8%"
### IVA 31
- elif linel.name == 'IVA (31.0%) compras':
+ elif linel.name == "IVA (31.0%) compras":
iva_31 += linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
iva_31 += linel.credit * -1.00
if not invoice.debit_origin_id:
total_nota_credito_iva_31 += iva_31
@@ -575,183 +729,242 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_nota_debito_iva_31 += iva_31
else:
total_iva_31 += iva_31
- alic_31 = '31%'
-
-
+ alic_31 = "31%"
#########
""" Totales """
c_total_base_exento += base_exento if base_exento else 0.00
- c_total_base_imponible_16 += base_imponible if base_imponible else 0.00
+ c_total_base_imponible_16 += (
+ base_imponible if base_imponible else 0.00
+ )
c_total_iva_16 += iva_16 if iva_16 else 0.00
- c_total_base_imponible_8 += base_imponible_8 if base_imponible_8 else 0.00
+ c_total_base_imponible_8 += (
+ base_imponible_8 if base_imponible_8 else 0.00
+ )
c_total_iva_8 += iva_8 if iva_8 else 0.00
- c_total_base_imponible_31 += base_imponible_31 if base_imponible_31 else 0.00
+ c_total_base_imponible_31 += (
+ base_imponible_31 if base_imponible_31 else 0.00
+ )
c_total_iva_31 += iva_31 if iva_31 else 0.00
-
# Compras Exento
sheet.write(row, 12, base_exento, line)
- #IMPORTACIONES
+ # IMPORTACIONES
# Base Imponible
- sheet.write(row, 13, '', line)
+ sheet.write(row, 13, "", line)
# % Alic
- sheet.write(row, 14, '', line)
- #Imp. IVA
- sheet.write(row, 15, '', line)
+ sheet.write(row, 14, "", line)
+ # Imp. IVA
+ sheet.write(row, 15, "", line)
- #Compras internas
+ # Compras internas
# Base Imponible
sheet.write(row, 16, base_imponible, line)
# % Alic
sheet.write(row, 17, alic_16, line)
- #Imp. IVA
+ # Imp. IVA
sheet.write(row, 18, iva_16, line)
- #IVA 8%
+ # IVA 8%
# Base Imponible
sheet.write(row, 19, base_imponible_8, line)
# % Alic
sheet.write(row, 20, alic_8, line)
- #Imp. IVA
+ # Imp. IVA
sheet.write(row, 21, iva_8, line)
- #IVA 31%
+ # IVA 31%
# Base Imponible
sheet.write(row, 22, base_imponible_31, line)
# % Alic
sheet.write(row, 23, alic_31, line)
- #Imp. IVA
+ # Imp. IVA
sheet.write(row, 24, iva_31, line)
-
- #Retenciones
- sheet.write(row, 25, '', line)
+ # Retenciones
+ sheet.write(row, 25, "", line)
###### IGTF
- sheet.write(row, 26, '', line)
+ sheet.write(row, 26, "", line)
-
- elif obj.type == 'sale':
+ elif obj.type == "sale":
if date_reference <= invoice.invoice_date:
while date_reference < invoice.invoice_date:
- coincident_date = [tup for tup in retenciones if date_reference == tup.date]
+ coincident_date = [
+ tup for tup in retenciones if date_reference == tup.date
+ ]
if coincident_date:
for reten in coincident_date:
- total_iva_16_retenido += reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency
+ total_iva_16_retenido += (
+ reten.amount
+ if reten.currency_id
+ == reten.company_id.currency_id
+ else reten.amount_company_currency
+ )
i += 1
# contador de la factura
sheet.write(row, 0, i, line)
# codigo fecha
- sheet.write(row, 1, reten.date or 'FALSE', date_line)
+ sheet.write(
+ row, 1, reten.date or "FALSE", date_line
+ )
# tipo de documento
- sheet.write(row, 2, 'Retención', line)
+ sheet.write(row, 2, "Retención", line)
- sheet.write(row, 3, '', line)
- sheet.write(row, 4, '', line)
+ sheet.write(row, 3, "", line)
+ sheet.write(row, 4, "", line)
# Numero de comrpobante
sheet.write(row, 5, reten.withholding_number, line)
# Documento afectado
if len(reten.reconciled_invoice_ids) > 1:
- sheet.write(row, 6, reten.reconciled_invoice_ids[0].name, line)
+ sheet.write(
+ row,
+ 6,
+ reten.reconciled_invoice_ids[0].name,
+ line,
+ )
else:
- sheet.write(row, 6, reten.reconciled_invoice_ids.name, line)
+ sheet.write(
+ row,
+ 6,
+ reten.reconciled_invoice_ids.name,
+ line,
+ )
# nombre del partner
- sheet.write(row, 7, reten.move_id.partner_id.name or 'FALSE', line)
+ sheet.write(
+ row,
+ 7,
+ reten.move_id.partner_id.name or "FALSE",
+ line,
+ )
# Rif del cliente
- sheet.write(row, 8, '%s-%s' % (reten.move_id.partner_id. \
- l10n_latam_identification_type_id.l10n_ve_code or 'FALSE',
- reten.move_id.partner_id.vat or 'FALSE'), line)
- sheet.write(row, 9, '', line)
- sheet.write(row, 10, '', line)
- sheet.write(row, 11, '', line)
- sheet.write(row, 12, '', line)
- sheet.write(row, 13, '', line)
- sheet.write(row, 14, '', line)
- sheet.write(row, 15, '', line)
- sheet.write(row, 16, '', line)
- sheet.write(row, 17, '', line)
- sheet.write(row, 18, '', line)
- sheet.write(row, 19, '', line)
- sheet.write(row, 20, '', line)
- sheet.write(row, 21, '', line)
- sheet.write(row, 22, '', line)
- sheet.write(row, 23, '', line)
- sheet.write(row, 24, '', line)
- sheet.write(row, 25, '', line)
- sheet.write(row, 26, '', line)
- sheet.write(row, 27, '', line)
- sheet.write(row, 28, reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency, line)
- sheet.write(row, 29, '', line)
+ sheet.write(
+ row,
+ 8,
+ "%s-%s"
+ % (
+ reten.move_id.partner_id.l10n_latam_identification_type_id.l10n_ve_code
+ or "FALSE",
+ reten.move_id.partner_id.vat or "FALSE",
+ ),
+ line,
+ )
+ sheet.write(row, 9, "", line)
+ sheet.write(row, 10, "", line)
+ sheet.write(row, 11, "", line)
+ sheet.write(row, 12, "", line)
+ sheet.write(row, 13, "", line)
+ sheet.write(row, 14, "", line)
+ sheet.write(row, 15, "", line)
+ sheet.write(row, 16, "", line)
+ sheet.write(row, 17, "", line)
+ sheet.write(row, 18, "", line)
+ sheet.write(row, 19, "", line)
+ sheet.write(row, 20, "", line)
+ sheet.write(row, 21, "", line)
+ sheet.write(row, 22, "", line)
+ sheet.write(row, 23, "", line)
+ sheet.write(row, 24, "", line)
+ sheet.write(row, 25, "", line)
+ sheet.write(row, 26, "", line)
+ sheet.write(row, 27, "", line)
+ sheet.write(
+ row,
+ 28,
+ reten.amount
+ if reten.currency_id
+ == reten.company_id.currency_id
+ else reten.amount_company_currency,
+ line,
+ )
+ sheet.write(row, 29, "", line)
retenciones.remove(reten)
- row +=1
+ row += 1
else:
date_reference += timedelta(days=1)
-
+
i += 1
# contador de la factura
sheet.write(row, 0, i, line)
# codigo fecha
- sheet.write(row, 1, invoice.invoice_date or 'FALSE', date_line)
+ sheet.write(row, 1, invoice.invoice_date or "FALSE", date_line)
# tipo de documento
-
- if invoice.move_type == 'out_invoice' and not invoice.debit_origin_id:
- sheet.write(row, 2, 'Factura', line)
- elif invoice.move_type == 'out_invoice' and invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Debito', line)
- elif invoice.move_type == 'out_refund' and not invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Credito', line)
- elif invoice.move_type == 'in_invoice':
- sheet.write(row, 2, 'Factura', line)
- elif invoice.move_type == 'in_refund' and not invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Credito', line)
- elif invoice.move_type == 'in_refund' and invoice.debit_origin_id:
- sheet.write(row, 2, 'Nota de Debito', line)
+
+ if (
+ invoice.move_type == "out_invoice"
+ and not invoice.debit_origin_id
+ ):
+ sheet.write(row, 2, "Factura", line)
+ elif invoice.move_type == "out_invoice" and invoice.debit_origin_id:
+ sheet.write(row, 2, "Nota de Debito", line)
+ elif (
+ invoice.move_type == "out_refund"
+ and not invoice.debit_origin_id
+ ):
+ sheet.write(row, 2, "Nota de Credito", line)
+ elif invoice.move_type == "in_invoice":
+ sheet.write(row, 2, "Factura", line)
+ elif (
+ invoice.move_type == "in_refund" and not invoice.debit_origin_id
+ ):
+ sheet.write(row, 2, "Nota de Credito", line)
+ elif invoice.move_type == "in_refund" and invoice.debit_origin_id:
+ sheet.write(row, 2, "Nota de Debito", line)
# Número de Documento
- sheet.write(row, 3, invoice.name or 'FALSE', line)
+ sheet.write(row, 3, invoice.name or "FALSE", line)
# Número de Control
- sheet.write(row, 4, invoice.l10n_ve_document_number or 'FALSE', line)
+ sheet.write(
+ row, 4, invoice.l10n_ve_document_number or "FALSE", line
+ )
# Factura cancelada
- if invoice.state == 'cancel':
- sheet.write(row, 5, '', line)
- sheet.write(row, 6, '', line)
- sheet.write(row, 7, 'ANULADA', line)
+ if invoice.state == "cancel":
+ sheet.write(row, 5, "", line)
+ sheet.write(row, 6, "", line)
+ sheet.write(row, 7, "ANULADA", line)
-
else:
- sheet.write(row, 5, '', line)
+ sheet.write(row, 5, "", line)
# Número Factura Afectada si es de debito o credito
- if invoice.move_type == 'out_refund':
+ if invoice.move_type == "out_refund":
if invoice.reversed_entry_id:
- sheet.write(row, 6, invoice.reversed_entry_id.name, line)
+ sheet.write(
+ row, 6, invoice.reversed_entry_id.name, line
+ )
else:
- sheet.write(row, 6, '', line)
+ sheet.write(row, 6, "", line)
elif invoice.debit_origin_id:
sheet.write(row, 6, invoice.debit_origin_id.name, line)
else:
- sheet.write(row, 6, '', line)
+ sheet.write(row, 6, "", line)
# nombre del partner
- sheet.write(row, 7, invoice.partner_id.name or 'FALSE', line)
+ sheet.write(row, 7, invoice.partner_id.name or "FALSE", line)
# Rif del cliente
- sheet.write(row, 8, '%s-%s' % (invoice.partner_id. \
- l10n_latam_identification_type_id.l10n_ve_code or 'FALSE',
- invoice.partner_id.vat or 'FALSE'), line)
+ sheet.write(
+ row,
+ 8,
+ "%s-%s"
+ % (
+ invoice.partner_id.l10n_latam_identification_type_id.l10n_ve_code
+ or "FALSE",
+ invoice.partner_id.vat or "FALSE",
+ ),
+ line,
+ )
# Total Ventas Bs.Incluyendo IVA
- if invoice.state != 'cancel':
+ if invoice.state != "cancel":
sheet.write(row, 9, invoice.amount_total_signed, line)
else:
- sheet.write(row, 9, '0', line)
-
- #Ventas por cuentas de tercero
- sheet.write(row, 10, '', line)
- sheet.write(row, 11, '', line)
- sheet.write(row, 12, '', line)
- sheet.write(row, 13, '', line)
+ sheet.write(row, 9, "0", line)
+ # Ventas por cuentas de tercero
+ sheet.write(row, 10, "", line)
+ sheet.write(row, 11, "", line)
+ sheet.write(row, 12, "", line)
+ sheet.write(row, 13, "", line)
# sheet.write(row, 9, invoice.amount_untaxed_signed, line)
# Impuesto IVA Bs.
@@ -761,65 +974,128 @@ def generate_xlsx_report(self, workbook, data, account_vat):
# else:
# sheet.write(row, 8, '16', line)
-
#############################
####IMPUESTOS##########
-
+
base_exento = 0.00
base_imponible = 0.00
iva_16 = 0.00
- alic_16 = ''
- alic_8 = ''
+ alic_16 = ""
+ alic_8 = ""
iva_8 = 0.00
base_imponible_8 = 0.00
if invoice.line_ids:
for linel in invoice.line_ids:
if linel.tax_ids:
if linel.tax_ids[0].amount == 16.00:
- base_imponible += linel.credit if linel.debit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or \
- invoice.move_type == 'in_refund' or (invoice.move_type == 'out_invoice' \
- and invoice.debit_origin_id):
- base_imponible += (linel.debit * -1.00) if linel.debit == 0 else 0
+ base_imponible += (
+ linel.credit
+ if linel.debit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_imponible += (
+ (linel.debit * -1.00)
+ if linel.debit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_nota_credito_16 += linel.debit * -1.00
+ total_nota_credito_16 += (
+ linel.debit * -1.00
+ )
else:
base_imponible += linel.credit
total_nota_debito_16 += linel.credit
else:
- total_base_imponible_16 += linel.credit if linel.debit == 0 else -linel.debit
- alic_16 = '16%'
+ total_base_imponible_16 += (
+ linel.credit
+ if linel.debit == 0
+ else -linel.debit
+ )
+ alic_16 = "16%"
elif linel.tax_ids[0].amount == 0.00:
- base_exento += linel.credit if linel.debit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
- base_exento += linel.debit * -1.00 if linel.debit == 0 else 0
+ base_exento += (
+ linel.credit
+ if linel.debit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_exento += (
+ linel.debit * -1.00
+ if linel.debit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_base_exento_credito += linel.debit * -1.00
+ total_base_exento_credito += (
+ linel.debit * -1.00
+ )
else:
base_exento += linel.credit
total_base_exento_debito += linel.credit
else:
- total_base_exento += linel.credit if linel.debit == 0 else -linel.debit
+ total_base_exento += (
+ linel.credit
+ if linel.debit == 0
+ else -linel.debit
+ )
elif linel.tax_ids[0].amount == 8.00:
- base_imponible_8 += linel.credit if linel.debit == 0 else -linel.debit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
- base_imponible_8 += linel.debit * -1.00 if linel.debit == 0 else 0
+ base_imponible_8 += (
+ linel.credit
+ if linel.debit == 0
+ else -linel.debit
+ )
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
+ base_imponible_8 += (
+ linel.debit * -1.00
+ if linel.debit == 0
+ else 0
+ )
if not invoice.debit_origin_id:
- total_nota_credito_8 += linel.debit * -1.00
+ total_nota_credito_8 += (
+ linel.debit * -1.00
+ )
else:
base_imponible_8 += linel.credit
total_nota_debito_8 += linel.credit
else:
- total_base_imponible_8 += linel.credit if linel.debit == 0 else -linel.debit
- alic_8 = '8%'
- elif linel.name == 'IVA (16.0%) ventas':
+ total_base_imponible_8 += (
+ linel.credit
+ if linel.debit == 0
+ else -linel.debit
+ )
+ alic_8 = "8%"
+ elif linel.name == "IVA (16.0%) ventas":
iva_16 += linel.credit
- if invoice.move_type == 'out_refund' or \
- invoice.move_type == 'in_refund' or (invoice.move_type == 'out_invoice' \
- and invoice.debit_origin_id):
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
iva_16 += linel.debit * -1.00
if not invoice.debit_origin_id:
total_nota_credito_iva_16 += iva_16
@@ -828,10 +1104,16 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_nota_debito_iva_16 += iva_16
else:
total_iva_16 += iva_16
- elif linel.name == 'IVA (8.0%) ventas':
+ elif linel.name == "IVA (8.0%) ventas":
iva_8 += linel.credit
- if invoice.move_type == 'out_refund' or invoice.move_type == 'in_refund' \
- or (invoice.move_type == 'out_invoice' and invoice.debit_origin_id):
+ if (
+ invoice.move_type == "out_refund"
+ or invoice.move_type == "in_refund"
+ or (
+ invoice.move_type == "out_invoice"
+ and invoice.debit_origin_id
+ )
+ ):
iva_8 += linel.debit * -1.00
if not invoice.debit_origin_id:
total_nota_credito_iva_8 += iva_8
@@ -840,14 +1122,20 @@ def generate_xlsx_report(self, workbook, data, account_vat):
total_nota_debito_iva_8 += iva_8
else:
total_iva_8 += iva_8
- alic_8 = '8%'
-
- #Contribuyentes
+ alic_8 = "8%"
+
+ # Contribuyentes
if invoice.partner_id.l10n_latam_identification_type_id.is_vat:
- total_base_exento_contribuyente += base_exento if base_exento else 0.00
- total_base_imponible_contribuyente_16 += base_imponible if base_imponible else 0.00
+ total_base_exento_contribuyente += (
+ base_exento if base_exento else 0.00
+ )
+ total_base_imponible_contribuyente_16 += (
+ base_imponible if base_imponible else 0.00
+ )
total_iva_contribuyente_16 += iva_16 if iva_16 else 0.00
- total_base_imponible_contribuyente_8 += base_imponible_8 if base_imponible_8 else 0.00
+ total_base_imponible_contribuyente_8 += (
+ base_imponible_8 if base_imponible_8 else 0.00
+ )
total_iva_contribuyente_8 += iva_8 if iva_8 else 0.00
sheet.write(row, 14, base_exento, line)
@@ -858,31 +1146,36 @@ def generate_xlsx_report(self, workbook, data, account_vat):
sheet.write(row, 19, alic_8, line)
sheet.write(row, 20, iva_8, line)
- sheet.write(row, 21, '', line)
- sheet.write(row, 22, '', line)
- sheet.write(row, 23, '', line)
- sheet.write(row, 24, '', line)
- sheet.write(row, 25, '', line)
- sheet.write(row, 26, '', line)
- sheet.write(row, 27, '', line)
+ sheet.write(row, 21, "", line)
+ sheet.write(row, 22, "", line)
+ sheet.write(row, 23, "", line)
+ sheet.write(row, 24, "", line)
+ sheet.write(row, 25, "", line)
+ sheet.write(row, 26, "", line)
+ sheet.write(row, 27, "", line)
- #No contribuyentes
+ # No contribuyentes
else:
- total_base_exento_no_contribuyente += base_exento if base_exento else 0.00
- total_base_imponible_no_contribuyente_16 += base_imponible if base_imponible else 0.00
+ total_base_exento_no_contribuyente += (
+ base_exento if base_exento else 0.00
+ )
+ total_base_imponible_no_contribuyente_16 += (
+ base_imponible if base_imponible else 0.00
+ )
total_iva_no_contribuyente_16 += iva_16 if iva_16 else 0.00
- total_base_imponible_no_contribuyente_8 += base_imponible_8 if base_imponible_8 else 0.00
+ total_base_imponible_no_contribuyente_8 += (
+ base_imponible_8 if base_imponible_8 else 0.00
+ )
total_iva_no_contribuyente_8 += iva_8 if iva_8 else 0.00
- sheet.write(row, 14, '', line)
- sheet.write(row, 15, '', line)
- sheet.write(row, 16, '', line)
- sheet.write(row, 17, '', line)
- sheet.write(row, 18, '', line)
- sheet.write(row, 19, '', line)
- sheet.write(row, 20, '', line)
-
+ sheet.write(row, 14, "", line)
+ sheet.write(row, 15, "", line)
+ sheet.write(row, 16, "", line)
+ sheet.write(row, 17, "", line)
+ sheet.write(row, 18, "", line)
+ sheet.write(row, 19, "", line)
+ sheet.write(row, 20, "", line)
sheet.write(row, 21, base_exento, line)
sheet.write(row, 22, base_imponible, line)
@@ -892,100 +1185,124 @@ def generate_xlsx_report(self, workbook, data, account_vat):
sheet.write(row, 26, alic_8, line)
sheet.write(row, 27, iva_8, line)
# sheet.write(row, 27, iva, line)
-
-
- #IGTF
+
+ # IGTF
amount_igtf = 0
- if 'igtf_amount' in self.env['account.move']._fields and invoice.igtf_amount > 0:
+ if (
+ "igtf_amount" in self.env["account.move"]._fields
+ and invoice.igtf_amount > 0
+ ):
amount_igtf = invoice.igtf_amount
- sheet.write(row, 28, '', line)
+ sheet.write(row, 28, "", line)
sheet.write(row, 29, amount_igtf, line)
total_igtf += amount_igtf
row += 1
- if len(retenciones) > 0 and obj.type == 'purchase':
+ if len(retenciones) > 0 and obj.type == "purchase":
for reten in sorted(retenciones, key=lambda x: x.date):
- total_iva_16_retenido += reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency
- # codigo
+ total_iva_16_retenido += (
+ reten.amount
+ if reten.currency_id == reten.company_id.currency_id
+ else reten.amount_company_currency
+ )
+ # codigo
sheet.write(row, 0, i, line)
# fehca
sheet.write(row, 1, reten.date, date_line)
# tipo de documento
- sheet.write(row, 2, 'Retención', line)
- sheet.write(row, 3, '', line)
- sheet.write(row, 4, '', line)
+ sheet.write(row, 2, "Retención", line)
+ sheet.write(row, 3, "", line)
+ sheet.write(row, 4, "", line)
# Numero de comrpobante
sheet.write(row, 5, reten.withholding_number, line)
# Documento afectado
sheet.write(row, 6, reten.reconciled_bill_ids.ref, line)
- sheet.write(row, 7, '', line)
- sheet.write(row, 8, '', line)
+ sheet.write(row, 7, "", line)
+ sheet.write(row, 8, "", line)
# Nombre
sheet.write(row, 9, reten.move_id.partner_id.name, line)
# RIF
- sheet.write(row, 10, '%s-%s' % (reten.move_id.partner_id. \
- l10n_latam_identification_type_id.l10n_ve_code or 'FALSE',
- reten.move_id.partner_id.vat or 'FALSE'), line)
- #Total
- sheet.write(row, 11, '', line)
+ sheet.write(
+ row,
+ 10,
+ "%s-%s"
+ % (
+ reten.move_id.partner_id.l10n_latam_identification_type_id.l10n_ve_code
+ or "FALSE",
+ reten.move_id.partner_id.vat or "FALSE",
+ ),
+ line,
+ )
+ # Total
+ sheet.write(row, 11, "", line)
# Compras Exento
- sheet.write(row, 12, '', line)
+ sheet.write(row, 12, "", line)
- #IMPORTACIONES
+ # IMPORTACIONES
# Base Imponible
- sheet.write(row, 13, '', line)
+ sheet.write(row, 13, "", line)
# % Alic
- sheet.write(row, 14, '', line)
- #Imp. IVA
- sheet.write(row, 15, '', line)
+ sheet.write(row, 14, "", line)
+ # Imp. IVA
+ sheet.write(row, 15, "", line)
- #Compras internas
+ # Compras internas
# Base Imponible
- sheet.write(row, 16, '', line)
+ sheet.write(row, 16, "", line)
# % Alic
- sheet.write(row, 17, '', line)
- #Imp. IVA
- sheet.write(row, 18, '', line)
+ sheet.write(row, 17, "", line)
+ # Imp. IVA
+ sheet.write(row, 18, "", line)
- #IVA 8%
+ # IVA 8%
# Base Imponible
- sheet.write(row, 19, '', line)
+ sheet.write(row, 19, "", line)
# % Alic
- sheet.write(row, 20, '', line)
- #Imp. IVA
- sheet.write(row, 21, '', line)
+ sheet.write(row, 20, "", line)
+ # Imp. IVA
+ sheet.write(row, 21, "", line)
- #IVA 31%
+ # IVA 31%
# Base Imponible
- sheet.write(row, 22, '', line)
+ sheet.write(row, 22, "", line)
# % Alic
- sheet.write(row, 23, '', line)
- #Imp. IVA
- sheet.write(row, 24, '', line)
-
+ sheet.write(row, 23, "", line)
+ # Imp. IVA
+ sheet.write(row, 24, "", line)
- #Retenciones
- sheet.write(row, 25, reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency, line)
+ # Retenciones
+ sheet.write(
+ row,
+ 25,
+ reten.amount
+ if reten.currency_id == reten.company_id.currency_id
+ else reten.amount_company_currency,
+ line,
+ )
###### IGTF
- sheet.write(row, 26, '', line)
+ sheet.write(row, 26, "", line)
print(reten)
print(retenciones)
retenciones.remove(reten)
- row +=1
+ row += 1
- elif len(retenciones) > 0 and obj.type == 'sale':
+ elif len(retenciones) > 0 and obj.type == "sale":
for reten in sorted(retenciones, key=lambda x: x.date):
- total_iva_16_retenido += reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency
+ total_iva_16_retenido += (
+ reten.amount
+ if reten.currency_id == reten.company_id.currency_id
+ else reten.amount_company_currency
+ )
i += 1
# contador de la factura
sheet.write(row, 0, i, line)
# codigo fecha
- sheet.write(row, 1, reten.date or 'FALSE', date_line)
+ sheet.write(row, 1, reten.date or "FALSE", date_line)
# tipo de documento
- sheet.write(row, 2, 'Retención', line)
+ sheet.write(row, 2, "Retención", line)
- sheet.write(row, 3, '', line)
- sheet.write(row, 4, '', line)
+ sheet.write(row, 3, "", line)
+ sheet.write(row, 4, "", line)
# Numero de comrpobante
sheet.write(row, 5, reten.withholding_number, line)
# Documento afectado
@@ -994,125 +1311,238 @@ def generate_xlsx_report(self, workbook, data, account_vat):
else:
sheet.write(row, 6, reten.reconciled_invoice_ids.name, line)
# nombre del partner
- sheet.write(row, 7, reten.move_id.partner_id.name or 'FALSE', line)
+ sheet.write(row, 7, reten.move_id.partner_id.name or "FALSE", line)
# Rif del cliente
- sheet.write(row, 8, '%s-%s' % (reten.move_id.partner_id. \
- l10n_latam_identification_type_id.l10n_ve_code or 'FALSE',
- reten.move_id.partner_id.vat or 'FALSE'), line)
- sheet.write(row, 9, '', line)
- sheet.write(row, 10, '', line)
- sheet.write(row, 11, '', line)
- sheet.write(row, 12, '', line)
- sheet.write(row, 13, '', line)
- sheet.write(row, 14, '', line)
- sheet.write(row, 15, '', line)
- sheet.write(row, 16, '', line)
- sheet.write(row, 17, '', line)
- sheet.write(row, 18, '', line)
- sheet.write(row, 19, '', line)
- sheet.write(row, 20, '', line)
- sheet.write(row, 21, '', line)
- sheet.write(row, 22, '', line)
- sheet.write(row, 23, '', line)
- sheet.write(row, 24, '', line)
- sheet.write(row, 25, '', line)
- sheet.write(row, 26, '', line)
- sheet.write(row, 27, '', line)
- sheet.write(row, 28, reten.amount if reten.currency_id == reten.company_id.currency_id else reten.amount_company_currency, line)
- sheet.write(row, 29, '', line)
+ sheet.write(
+ row,
+ 8,
+ "%s-%s"
+ % (
+ reten.move_id.partner_id.l10n_latam_identification_type_id.l10n_ve_code
+ or "FALSE",
+ reten.move_id.partner_id.vat or "FALSE",
+ ),
+ line,
+ )
+ sheet.write(row, 9, "", line)
+ sheet.write(row, 10, "", line)
+ sheet.write(row, 11, "", line)
+ sheet.write(row, 12, "", line)
+ sheet.write(row, 13, "", line)
+ sheet.write(row, 14, "", line)
+ sheet.write(row, 15, "", line)
+ sheet.write(row, 16, "", line)
+ sheet.write(row, 17, "", line)
+ sheet.write(row, 18, "", line)
+ sheet.write(row, 19, "", line)
+ sheet.write(row, 20, "", line)
+ sheet.write(row, 21, "", line)
+ sheet.write(row, 22, "", line)
+ sheet.write(row, 23, "", line)
+ sheet.write(row, 24, "", line)
+ sheet.write(row, 25, "", line)
+ sheet.write(row, 26, "", line)
+ sheet.write(row, 27, "", line)
+ sheet.write(
+ row,
+ 28,
+ reten.amount
+ if reten.currency_id == reten.company_id.currency_id
+ else reten.amount_company_currency,
+ line,
+ )
+ sheet.write(row, 29, "", line)
retenciones.remove(reten)
- row +=1
+ row += 1
- if obj.type == 'sale':
+ if obj.type == "sale":
sheet.write((row), 14, total_base_exento_contribuyente, line_total)
- sheet.write((row), 15, total_base_imponible_contribuyente_16, line_total)
+ sheet.write(
+ (row), 15, total_base_imponible_contribuyente_16, line_total
+ )
sheet.write((row), 17, total_iva_contribuyente_16, line_total)
sheet.write((row), 18, total_base_imponible_contribuyente_8, line_total)
sheet.write((row), 20, total_iva_contribuyente_8, line_total)
sheet.write((row), 21, total_base_exento_no_contribuyente, line_total)
- sheet.write((row), 22, total_base_imponible_no_contribuyente_16, line_total)
+ sheet.write(
+ (row), 22, total_base_imponible_no_contribuyente_16, line_total
+ )
sheet.write((row), 24, total_iva_no_contribuyente_16, line_total)
- sheet.write((row), 25, total_base_imponible_no_contribuyente_8, line_total)
+ sheet.write(
+ (row), 25, total_base_imponible_no_contribuyente_8, line_total
+ )
sheet.write((row), 27, total_iva_no_contribuyente_8, line_total)
sheet.write((row), 29, total_igtf, line_total)
-
+
# RESUMEN DE LOS TOTALES VENTAS
- row +=5
- sheet.merge_range('J%s:M%s' % (str(row+1), str(row+1)), 'RESUMEN GENERAL', cell_format_2)
- sheet.write((row), 13, 'Base Imponible', cell_format_1)
- sheet.write((row), 14, 'Débito fiscal', cell_format_1)
- sheet.write((row), 15, 'IVA Retenido', cell_format_1)
- sheet.write((row), 16, 'IGTF percibido', cell_format_1)
-
- sheet.merge_range('J%s:M%s' % (str(row+2), str(row+2)), 'Total Ventas Internas No Gravadas', title_style)
- sheet.write((row+1), 13, total_base_exento_contribuyente + total_base_exento_no_contribuyente, line)
- sheet.write((row+1), 14, '0', line)
- sheet.write((row+1), 15, '0', line)
- sheet.write((row+1), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+3), str(row+3)), 'Total Nota de Credito No Gravadas', title_style)
- sheet.write((row+2), 13, total_base_exento_credito, line)
- sheet.write((row+2), 14, '0', line)
- sheet.write((row+2), 15, '0', line)
- sheet.write((row+2), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+4), str(row+4)), 'Total Nota de Debito No Gravadas', title_style)
- sheet.write((row+3), 13, total_base_exento_debito, line)
- sheet.write((row+3), 14, '0', line)
- sheet.write((row+3), 15, '0', line)
- sheet.write((row+3), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+5), str(row+5)), 'Total Ventas de Exportación ', title_style)
- sheet.write((row+4), 13, '0', line)
- sheet.write((row+4), 14, '0', line)
- sheet.write((row+4), 15, '0', line)
- sheet.write((row+4), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+6), str(row+6)), 'Total Ventas Internas afectadas sólo alícuota general 16.00', title_style)
- sheet.write((row+5), 13, total_base_imponible_contribuyente_16 + total_base_imponible_no_contribuyente_16 - total_nota_credito_16 + total_nota_debito_16, line)
- sheet.write((row+5), 14, total_iva_16, line)
- sheet.write((row+5), 15, total_iva_16_retenido, line)
- sheet.write((row+5), 16, total_iva_16_igtf, line)
- sheet.merge_range('J%s:M%s' % (str(row+7), str(row+7)), 'Total Ventas Internas afectadas sólo alícuota reducida 8.00', title_style)
- sheet.write((row+6), 13, total_base_imponible_contribuyente_8 + total_base_imponible_no_contribuyente_8 - total_nota_credito_8 + total_nota_debito_8, line)
- sheet.write((row+6), 14, total_iva_8, line)
- sheet.write((row+6), 15, '0', line)
- sheet.write((row+6), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+8), str(row+8)), 'Total Ventas Internas afectadas más adicional 31.00', title_style)
- sheet.write((row+7), 13, '0', line)
- sheet.write((row+7), 14, '0', line)
- sheet.write((row+7), 15, '0', line)
- sheet.write((row+7), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+9), str(row+9)), 'Total Notas de Crédito o Devoluciones aplicadas en Ventas 16%', title_style)
- sheet.write((row+8), 13, total_nota_credito_16, line)
- sheet.write((row+8), 14, total_nota_credito_iva_16, line)
- sheet.write((row+8), 15, '', line)
- sheet.write((row+8), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+10), str(row+10)), 'Total Notas de Crédito o Devoluciones aplicadas en Ventas 8%', title_style)
- sheet.write((row+9), 13, total_nota_credito_8, line)
- sheet.write((row+9), 14, total_nota_credito_iva_8, line)
- sheet.write((row+9), 15, '', line)
- sheet.write((row+9), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+11), str(row+11)), 'Total Notas de Débito o recargos aplicadas en Ventas 16%:', title_style)
- sheet.write((row+10), 13, total_nota_debito_16, line)
- sheet.write((row+10), 14, total_nota_debito_iva_16, line)
- sheet.write((row+10), 15, '', line)
- sheet.write((row+10), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+12), str(row+12)), 'Total Notas de Débito o recargos aplicadas en Ventas 8%:', title_style)
- sheet.write((row+11), 13, total_nota_debito_8, line)
- sheet.write((row+11), 14, total_nota_debito_iva_8, line)
- sheet.write((row+11), 15, '', line)
- sheet.write((row+11), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+13), str(row+13)), 'Total:', title_style)
- sheet.write((row+12), 13, total_base_exento_contribuyente + total_base_exento_no_contribuyente + total_base_imponible_contribuyente_16 + total_base_imponible_no_contribuyente_16\
- + total_base_imponible_contribuyente_8 + total_base_imponible_no_contribuyente_8 + total_base_exento_credito \
- + total_base_exento_debito, line)
- sheet.write((row+12), 14, (total_iva_16 + total_iva_8 + \
- total_nota_credito_iva_16 + total_nota_credito_iva_8 + \
- total_nota_debito_iva_16 + total_nota_debito_iva_8), line)
- sheet.write((row+12), 15, total_iva_16_retenido, line)
- sheet.write((row+12), 16, total_igtf, line)
+ row += 5
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 1), str(row + 1)),
+ "RESUMEN GENERAL",
+ cell_format_2,
+ )
+ sheet.write((row), 13, "Base Imponible", cell_format_1)
+ sheet.write((row), 14, "Débito fiscal", cell_format_1)
+ sheet.write((row), 15, "IVA Retenido", cell_format_1)
+ sheet.write((row), 16, "IGTF percibido", cell_format_1)
+
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 2), str(row + 2)),
+ "Total Ventas Internas No Gravadas",
+ title_style,
+ )
+ sheet.write(
+ (row + 1),
+ 13,
+ total_base_exento_contribuyente
+ + total_base_exento_no_contribuyente,
+ line,
+ )
+ sheet.write((row + 1), 14, "0", line)
+ sheet.write((row + 1), 15, "0", line)
+ sheet.write((row + 1), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 3), str(row + 3)),
+ "Total Nota de Credito No Gravadas",
+ title_style,
+ )
+ sheet.write((row + 2), 13, total_base_exento_credito, line)
+ sheet.write((row + 2), 14, "0", line)
+ sheet.write((row + 2), 15, "0", line)
+ sheet.write((row + 2), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 4), str(row + 4)),
+ "Total Nota de Debito No Gravadas",
+ title_style,
+ )
+ sheet.write((row + 3), 13, total_base_exento_debito, line)
+ sheet.write((row + 3), 14, "0", line)
+ sheet.write((row + 3), 15, "0", line)
+ sheet.write((row + 3), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 5), str(row + 5)),
+ "Total Ventas de Exportación ",
+ title_style,
+ )
+ sheet.write((row + 4), 13, "0", line)
+ sheet.write((row + 4), 14, "0", line)
+ sheet.write((row + 4), 15, "0", line)
+ sheet.write((row + 4), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 6), str(row + 6)),
+ "Total Ventas Internas afectadas sólo alícuota general 16.00",
+ title_style,
+ )
+ sheet.write(
+ (row + 5),
+ 13,
+ total_base_imponible_contribuyente_16
+ + total_base_imponible_no_contribuyente_16
+ - total_nota_credito_16
+ + total_nota_debito_16,
+ line,
+ )
+ sheet.write((row + 5), 14, total_iva_16, line)
+ sheet.write((row + 5), 15, total_iva_16_retenido, line)
+ sheet.write((row + 5), 16, total_iva_16_igtf, line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 7), str(row + 7)),
+ "Total Ventas Internas afectadas sólo alícuota reducida 8.00",
+ title_style,
+ )
+ sheet.write(
+ (row + 6),
+ 13,
+ total_base_imponible_contribuyente_8
+ + total_base_imponible_no_contribuyente_8
+ - total_nota_credito_8
+ + total_nota_debito_8,
+ line,
+ )
+ sheet.write((row + 6), 14, total_iva_8, line)
+ sheet.write((row + 6), 15, "0", line)
+ sheet.write((row + 6), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 8), str(row + 8)),
+ "Total Ventas Internas afectadas más adicional 31.00",
+ title_style,
+ )
+ sheet.write((row + 7), 13, "0", line)
+ sheet.write((row + 7), 14, "0", line)
+ sheet.write((row + 7), 15, "0", line)
+ sheet.write((row + 7), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 9), str(row + 9)),
+ "Total Notas de Crédito o Devoluciones aplicadas en Ventas 16%",
+ title_style,
+ )
+ sheet.write((row + 8), 13, total_nota_credito_16, line)
+ sheet.write((row + 8), 14, total_nota_credito_iva_16, line)
+ sheet.write((row + 8), 15, "", line)
+ sheet.write((row + 8), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 10), str(row + 10)),
+ "Total Notas de Crédito o Devoluciones aplicadas en Ventas 8%",
+ title_style,
+ )
+ sheet.write((row + 9), 13, total_nota_credito_8, line)
+ sheet.write((row + 9), 14, total_nota_credito_iva_8, line)
+ sheet.write((row + 9), 15, "", line)
+ sheet.write((row + 9), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 11), str(row + 11)),
+ "Total Notas de Débito o recargos aplicadas en Ventas 16%:",
+ title_style,
+ )
+ sheet.write((row + 10), 13, total_nota_debito_16, line)
+ sheet.write((row + 10), 14, total_nota_debito_iva_16, line)
+ sheet.write((row + 10), 15, "", line)
+ sheet.write((row + 10), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 12), str(row + 12)),
+ "Total Notas de Débito o recargos aplicadas en Ventas 8%:",
+ title_style,
+ )
+ sheet.write((row + 11), 13, total_nota_debito_8, line)
+ sheet.write((row + 11), 14, total_nota_debito_iva_8, line)
+ sheet.write((row + 11), 15, "", line)
+ sheet.write((row + 11), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 13), str(row + 13)), "Total:", title_style
+ )
+ sheet.write(
+ (row + 12),
+ 13,
+ total_base_exento_contribuyente
+ + total_base_exento_no_contribuyente
+ + total_base_imponible_contribuyente_16
+ + total_base_imponible_no_contribuyente_16
+ + total_base_imponible_contribuyente_8
+ + total_base_imponible_no_contribuyente_8
+ + total_base_exento_credito
+ + total_base_exento_debito,
+ line,
+ )
+ sheet.write(
+ (row + 12),
+ 14,
+ (
+ total_iva_16
+ + total_iva_8
+ + total_nota_credito_iva_16
+ + total_nota_credito_iva_8
+ + total_nota_debito_iva_16
+ + total_nota_debito_iva_8
+ ),
+ line,
+ )
+ sheet.write((row + 12), 15, total_iva_16_retenido, line)
+ sheet.write((row + 12), 16, total_igtf, line)
# Totales de compras
else:
-
+
sheet.write((row), 12, c_total_base_exento, line_total)
sheet.write((row), 16, c_total_base_imponible_16, line_total)
sheet.write((row), 18, c_total_iva_16, line_total)
@@ -1121,93 +1551,169 @@ def generate_xlsx_report(self, workbook, data, account_vat):
sheet.write((row), 22, c_total_base_imponible_31, line_total)
sheet.write((row), 24, c_total_iva_31, line_total)
-
row += 5
- sheet.merge_range('J%s:M%s' % (str(row + 1), str(row + 1)), 'RESUMEN GENERAL', cell_format_2)
- sheet.write((row), 13, 'Base Imponible', cell_format_1)
- sheet.write((row), 14, 'Crédito fiscal', cell_format_1)
- sheet.write((row), 15, 'IVA retenido por el comprador', cell_format_1)
- sheet.write((row), 16, 'IVA retenido a terceros', cell_format_1)
-
- sheet.merge_range('J%s:M%s' % (str(row + 2), str(row + 2)), 'Total Compras Internas NO Gravadas',
- title_style)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 1), str(row + 1)),
+ "RESUMEN GENERAL",
+ cell_format_2,
+ )
+ sheet.write((row), 13, "Base Imponible", cell_format_1)
+ sheet.write((row), 14, "Crédito fiscal", cell_format_1)
+ sheet.write((row), 15, "IVA retenido por el comprador", cell_format_1)
+ sheet.write((row), 16, "IVA retenido a terceros", cell_format_1)
+
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 2), str(row + 2)),
+ "Total Compras Internas NO Gravadas",
+ title_style,
+ )
sheet.write((row + 1), 13, total_base_exento, line)
- sheet.write((row + 1), 14, '0', line)
- sheet.write((row + 1), 15, '0', line)
- sheet.write((row + 1), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row + 3), str(row + 3)), 'Total Notas de Credito NO Gravadas',
- title_style)
+ sheet.write((row + 1), 14, "0", line)
+ sheet.write((row + 1), 15, "0", line)
+ sheet.write((row + 1), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 3), str(row + 3)),
+ "Total Notas de Credito NO Gravadas",
+ title_style,
+ )
sheet.write((row + 2), 13, total_base_exento_credito, line)
- sheet.write((row + 2), 14, '0', line)
- sheet.write((row + 2), 15, '0', line)
- sheet.write((row + 2), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row + 4), str(row + 4)), 'Total Notas de Debito NO Gravadas',
- title_style)
+ sheet.write((row + 2), 14, "0", line)
+ sheet.write((row + 2), 15, "0", line)
+ sheet.write((row + 2), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 4), str(row + 4)),
+ "Total Notas de Debito NO Gravadas",
+ title_style,
+ )
sheet.write((row + 3), 13, total_base_exento_debito, line)
- sheet.write((row + 3), 14, '0', line)
- sheet.write((row + 3), 15, '0', line)
- sheet.write((row + 3), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row + 5), str(row + 5)), 'Total Compras de Importaciòn', title_style)
- sheet.write((row + 4), 13, '0', line)
- sheet.write((row + 4), 14, '0', line)
- sheet.write((row + 4), 15, '0', line)
- sheet.write((row + 4), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row + 6), str(row + 6)),
- 'Total Compras Internas afectadas sólo alícuota general 16.00', title_style)
+ sheet.write((row + 3), 14, "0", line)
+ sheet.write((row + 3), 15, "0", line)
+ sheet.write((row + 3), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 5), str(row + 5)),
+ "Total Compras de Importaciòn",
+ title_style,
+ )
+ sheet.write((row + 4), 13, "0", line)
+ sheet.write((row + 4), 14, "0", line)
+ sheet.write((row + 4), 15, "0", line)
+ sheet.write((row + 4), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 6), str(row + 6)),
+ "Total Compras Internas afectadas sólo alícuota general 16.00",
+ title_style,
+ )
sheet.write((row + 5), 13, total_base_imponible_16, line)
sheet.write((row + 5), 14, total_iva_16, line)
sheet.write((row + 5), 15, total_iva_16_retenido, line)
sheet.write((row + 5), 16, total_iva_16_igtf, line)
- sheet.merge_range('J%s:M%s' % (str(row + 7), str(row + 7)),
- 'Total Compras Internas afectadas sólo alícuota reducida 8.00', title_style)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 7), str(row + 7)),
+ "Total Compras Internas afectadas sólo alícuota reducida 8.00",
+ title_style,
+ )
sheet.write((row + 6), 13, total_base_imponible_8, line)
sheet.write((row + 6), 14, total_iva_8, line)
- sheet.write((row + 6), 15, '0', line)
- sheet.write((row + 6), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row + 8), str(row + 8)),
- 'Total Compras Internas afectadas por alícuota general más adicional 31.00', title_style)
+ sheet.write((row + 6), 15, "0", line)
+ sheet.write((row + 6), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 8), str(row + 8)),
+ "Total Compras Internas afectadas por alícuota general más adicional 31.00",
+ title_style,
+ )
sheet.write((row + 7), 13, total_base_imponible_31, line)
sheet.write((row + 7), 14, total_iva_31, line)
- sheet.write((row + 7), 15, '0', line)
- sheet.write((row + 7), 16, '0', line)
- sheet.merge_range('J%s:M%s' % (str(row+9), str(row+9)), 'Total Notas de Crédito o Devoluciones aplicadas en Compras 16%', title_style)
- sheet.write((row+8), 13, total_nota_credito_16, line)
- sheet.write((row+8), 14, total_nota_credito_iva_16, line)
- sheet.write((row+8), 15, '', line)
- sheet.write((row+8), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+10), str(row+10)), 'Total Notas de Crédito o Devoluciones aplicadas en Compras 8%', title_style)
- sheet.write((row+9), 13, total_nota_credito_8, line)
- sheet.write((row+9), 14, total_nota_credito_iva_8, line)
- sheet.write((row+9), 15, '', line)
- sheet.write((row+9), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+11), str(row+11)), 'Total Notas de Crédito o Devoluciones aplicadas en Compras 31%', title_style)
- sheet.write((row+10), 13, total_nota_credito_31, line)
- sheet.write((row+10), 14, total_nota_credito_iva_31, line)
- sheet.write((row+10), 15, '', line)
- sheet.write((row+10), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+12), str(row+12)), 'Total Notas de Débito o recargos aplicadas en Compras 16%:', title_style)
- sheet.write((row+11), 13, total_nota_debito_16, line)
- sheet.write((row+11), 14, total_nota_debito_iva_16, line)
- sheet.write((row+11), 15, '', line)
- sheet.write((row+11), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+13), str(row+13)), 'Total Notas de Débito o recargos aplicadas en Compras 8%:', title_style)
- sheet.write((row+12), 13, total_nota_debito_8, line)
- sheet.write((row+12), 14, total_nota_debito_iva_8, line)
- sheet.write((row+12), 15, '', line)
- sheet.write((row+12), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+14), str(row+14)), 'Total Notas de Débito o recargos aplicadas en Compras 31%:', title_style)
- sheet.write((row+13), 13, total_nota_debito_31, line)
- sheet.write((row+13), 14, total_nota_debito_iva_31, line)
- sheet.write((row+13), 15, '', line)
- sheet.write((row+13), 16, '', line)
- sheet.merge_range('J%s:M%s' % (str(row+15), str(row+15)), 'Total:', title_style)
- sheet.write((row+14), 13, total_base_exento + total_base_imponible_16 \
- + total_base_imponible_8+total_base_imponible_31+total_nota_credito_16+\
- + total_nota_credito_8 + total_nota_credito_31 +total_nota_debito_16 + \
- + total_nota_debito_8 + total_nota_debito_31 + total_base_exento_credito +\
- total_base_exento_debito, line)
- sheet.write((row+14), 14, (total_iva_16 + total_iva_8 + total_iva_31 + \
- total_nota_credito_iva_16 + total_nota_credito_iva_8 + total_nota_credito_iva_31 + \
- total_nota_debito_iva_16 + total_nota_debito_iva_8 + total_nota_debito_iva_31), line)
- sheet.write((row+14), 15, total_iva_16_retenido, line)
- sheet.write((row+14), 16, total_iva_16_igtf, line)
\ No newline at end of file
+ sheet.write((row + 7), 15, "0", line)
+ sheet.write((row + 7), 16, "0", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 9), str(row + 9)),
+ "Total Notas de Crédito o Devoluciones aplicadas en Compras 16%",
+ title_style,
+ )
+ sheet.write((row + 8), 13, total_nota_credito_16, line)
+ sheet.write((row + 8), 14, total_nota_credito_iva_16, line)
+ sheet.write((row + 8), 15, "", line)
+ sheet.write((row + 8), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 10), str(row + 10)),
+ "Total Notas de Crédito o Devoluciones aplicadas en Compras 8%",
+ title_style,
+ )
+ sheet.write((row + 9), 13, total_nota_credito_8, line)
+ sheet.write((row + 9), 14, total_nota_credito_iva_8, line)
+ sheet.write((row + 9), 15, "", line)
+ sheet.write((row + 9), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 11), str(row + 11)),
+ "Total Notas de Crédito o Devoluciones aplicadas en Compras 31%",
+ title_style,
+ )
+ sheet.write((row + 10), 13, total_nota_credito_31, line)
+ sheet.write((row + 10), 14, total_nota_credito_iva_31, line)
+ sheet.write((row + 10), 15, "", line)
+ sheet.write((row + 10), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 12), str(row + 12)),
+ "Total Notas de Débito o recargos aplicadas en Compras 16%:",
+ title_style,
+ )
+ sheet.write((row + 11), 13, total_nota_debito_16, line)
+ sheet.write((row + 11), 14, total_nota_debito_iva_16, line)
+ sheet.write((row + 11), 15, "", line)
+ sheet.write((row + 11), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 13), str(row + 13)),
+ "Total Notas de Débito o recargos aplicadas en Compras 8%:",
+ title_style,
+ )
+ sheet.write((row + 12), 13, total_nota_debito_8, line)
+ sheet.write((row + 12), 14, total_nota_debito_iva_8, line)
+ sheet.write((row + 12), 15, "", line)
+ sheet.write((row + 12), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 14), str(row + 14)),
+ "Total Notas de Débito o recargos aplicadas en Compras 31%:",
+ title_style,
+ )
+ sheet.write((row + 13), 13, total_nota_debito_31, line)
+ sheet.write((row + 13), 14, total_nota_debito_iva_31, line)
+ sheet.write((row + 13), 15, "", line)
+ sheet.write((row + 13), 16, "", line)
+ sheet.merge_range(
+ "J%s:M%s" % (str(row + 15), str(row + 15)), "Total:", title_style
+ )
+ sheet.write(
+ (row + 14),
+ 13,
+ total_base_exento
+ + total_base_imponible_16
+ + total_base_imponible_8
+ + total_base_imponible_31
+ + total_nota_credito_16
+ + +total_nota_credito_8
+ + total_nota_credito_31
+ + total_nota_debito_16
+ + +total_nota_debito_8
+ + total_nota_debito_31
+ + total_base_exento_credito
+ + total_base_exento_debito,
+ line,
+ )
+ sheet.write(
+ (row + 14),
+ 14,
+ (
+ total_iva_16
+ + total_iva_8
+ + total_iva_31
+ + total_nota_credito_iva_16
+ + total_nota_credito_iva_8
+ + total_nota_credito_iva_31
+ + total_nota_debito_iva_16
+ + total_nota_debito_iva_8
+ + total_nota_debito_iva_31
+ ),
+ line,
+ )
+ sheet.write((row + 14), 15, total_iva_16_retenido, line)
+ sheet.write((row + 14), 16, total_iva_16_igtf, line)
diff --git a/l10n_ve_vat_ledger/security/security.xml b/l10n_ve_vat_ledger/security/security.xml
index 161dd57b..535d61d1 100755
--- a/l10n_ve_vat_ledger/security/security.xml
+++ b/l10n_ve_vat_ledger/security/security.xml
@@ -1,11 +1,13 @@
-
+
Vat Ledger Multi Company
-
-
- ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
diff --git a/l10n_ve_vat_ledger/views/account_vat_ledger_views.xml b/l10n_ve_vat_ledger/views/account_vat_ledger_views.xml
index b0953a95..8677cca6 100755
--- a/l10n_ve_vat_ledger/views/account_vat_ledger_views.xml
+++ b/l10n_ve_vat_ledger/views/account_vat_ledger_views.xml
@@ -1,69 +1,113 @@
-
+
- Account VAT Ledger
+ Account VAT Ledger
account.vat.ledger
-
-
-
-
+
+
+
+
- Account VAT Ledger
+ Account VAT Ledger
account.vat.ledger
@@ -73,14 +117,18 @@
Purchases VAT Ledger
account.vat.ledger
{'default_type':'purchase'}
- [('type','=','purchase'),('company_id', 'in', context.get('allowed_company_ids'))]
+ [('type','=','purchase'),('company_id', 'in', context.get('allowed_company_ids'))]
Sales VAT Ledger
account.vat.ledger
{'default_type':'sale'}
- [('type','=','sale'),('company_id', 'in', context.get('allowed_company_ids'))]
+ [('type','=','sale'),('company_id', 'in', context.get('allowed_company_ids'))]
-
+ sequence="6"
+ />
-
-
\ No newline at end of file
+ sequence="4"
+ />
+
diff --git a/l10n_ve_vat_ledger/wizard/__init__.py b/l10n_ve_vat_ledger/wizard/__init__.py
index c800aa56..f704f254 100755
--- a/l10n_ve_vat_ledger/wizard/__init__.py
+++ b/l10n_ve_vat_ledger/wizard/__init__.py
@@ -1,6 +1 @@
-# -*- coding: utf-8 -*-
-
-from . import wizard_resumen_iva
-
-
-
+from . import wizard_resumen_iva
diff --git a/l10n_ve_vat_ledger/wizard/account_wizard_views.xml b/l10n_ve_vat_ledger/wizard/account_wizard_views.xml
index 89aa9b34..0758bb6e 100755
--- a/l10n_ve_vat_ledger/wizard/account_wizard_views.xml
+++ b/l10n_ve_vat_ledger/wizard/account_wizard_views.xml
@@ -6,13 +6,18 @@
@@ -22,13 +27,15 @@
Resumen I.V.A
resumen.iva
form
-
+
new
-
+
diff --git a/l10n_ve_vat_ledger/wizard/wizard_resumen_iva.py b/l10n_ve_vat_ledger/wizard/wizard_resumen_iva.py
index 7efe9263..49fcfb3e 100644
--- a/l10n_ve_vat_ledger/wizard/wizard_resumen_iva.py
+++ b/l10n_ve_vat_ledger/wizard/wizard_resumen_iva.py
@@ -2,32 +2,31 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
-from re import search
-from datetime import datetime, timedelta
-from odoo import models, fields, api, _
-from datetime import datetime, timedelta
-from re import search
+import base64
+import io
import json
+from datetime import datetime, timedelta
+from io import BytesIO
+
# import time
-import logging
import xlsxwriter
-import io
-from io import BytesIO
-import shutil
-import base64
-import csv
-import xlwt
+from odoo import fields, models
-class ResumenIVA(models.TransientModel):
- _name = 'resumen.iva'
- _description = 'Resumen I.V.A'
- resumen_iva_ids = fields.Many2many('account.vat.ledger', string='nuevo')
- content = fields.Binary('Content')
- date_from = fields.Date(string='Date From', default=lambda *a: datetime.now().strftime('%Y-%m-%d'))
- date_to = fields.Date('Date To', default=lambda *a: (datetime.now() + timedelta(days=(1))).strftime('%Y-%m-%d'))
+class ResumenIVA(models.TransientModel):
+ _name = "resumen.iva"
+ _description = "Resumen I.V.A"
+ resumen_iva_ids = fields.Many2many("account.vat.ledger", string="nuevo")
+ content = fields.Binary("Content")
+ date_from = fields.Date(
+ string="Date From", default=lambda *a: datetime.now().strftime("%Y-%m-%d")
+ )
+ date_to = fields.Date(
+ "Date To",
+ default=lambda *a: (datetime.now() + timedelta(days=(1))).strftime("%Y-%m-%d"),
+ )
def find_values(self, id, json_repr):
results = []
@@ -38,6 +37,7 @@ def _decode_dict(a_dict):
except KeyError:
pass
return a_dict
+
# Return value ignored.
json.loads(json_repr, object_hook=_decode_dict)
return results
@@ -49,9 +49,9 @@ def generate_xls_report(self, workbook, data, account_vat):
sheet = workbook.add_worksheet(report_name[:31])
self.ensure_one()
_log = BytesIO()
- wb = xlsxwriter.Workbook(_log, {'in_memory': True})
+ wb = xlsxwriter.Workbook(_log, {"in_memory": True})
buffer = io.BytesIO()
- writer = pd.ExcelWriter(buffer, engine='xlsxwriter')
+ writer = pd.ExcelWriter(buffer, engine="xlsxwriter")
workbook = writer.book
# Resumen IVA
@@ -59,147 +59,195 @@ def generate_xls_report(self, workbook, data, account_vat):
sheet.set_column(0, 0, 9)
# style nuevo
- cell_format = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'center',
- 'valign': 'vcenter',
- 'fg_color': '#a64d79',
- 'font_color': 'white',
- 'text_wrap': 1})
-
- cell_format_1 = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'center',
- 'fg_color': '#a64d79',
- 'font_color': 'white'})
-
- cell_format_2 = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'left',
- 'fg_color': '#a64d79',
- 'font_color': 'white'})
-
- title = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'center',
- 'valign': 'vcenter'})
-
- title_style = workbook.add_format({
- 'bold': 1,
- 'border': 1,
- 'align': 'left'})
-
- line = workbook.add_format({
- 'border': 1,
- 'align': 'center'})
+ cell_format = workbook.add_format(
+ {
+ "bold": 1,
+ "border": 1,
+ "align": "center",
+ "valign": "vcenter",
+ "fg_color": "#a64d79",
+ "font_color": "white",
+ "text_wrap": 1,
+ }
+ )
+
+ cell_format_1 = workbook.add_format(
+ {
+ "bold": 1,
+ "border": 1,
+ "align": "center",
+ "fg_color": "#a64d79",
+ "font_color": "white",
+ }
+ )
+
+ cell_format_2 = workbook.add_format(
+ {
+ "bold": 1,
+ "border": 1,
+ "align": "left",
+ "fg_color": "#a64d79",
+ "font_color": "white",
+ }
+ )
+
+ title = workbook.add_format(
+ {"bold": 1, "border": 1, "align": "center", "valign": "vcenter"}
+ )
+
+ title_style = workbook.add_format({"bold": 1, "border": 1, "align": "left"})
+
+ line = workbook.add_format({"border": 1, "align": "center"})
date_line = workbook.add_format(
- {'border': 1, 'num_format': 'dd-mm-yyyy',
- 'align': 'center'})
+ {"border": 1, "num_format": "dd-mm-yyyy", "align": "center"}
+ )
# Resume IVA
sheet2.set_column(7, 1, 20)
- sheet2.merge_range('A1:D1', obj.company_id.name, title_style)
+ sheet2.merge_range("A1:D1", obj.company_id.name, title_style)
# sheet2.merge_range('A2:D2', obj.company_id.vat, title_style)
# sheet2.merge_range('A3:G3', obj.name + ' ' + 'Libro de IVA Compras' + ' ' + 'mes' + ' ' + 'Año', title_style)
# DEBITOS FISCALES
- sheet2.merge_range('A7:D7', 'DEBITOS FISCALES', title_style)
- sheet2.merge_range('A8:D8', 'Total Ventas Internas No Gravadas ', title_style)
- sheet2.merge_range('A9:D9', 'Total Ventas de Exportación ', title_style)
- sheet2.merge_range('A10:D10', 'Total Ventas Internas afectadas sólo alícuota general 16.00 ', title_style)
- sheet2.merge_range('A11:D11', 'Total Ventas Internas afectadas sólo alícuota reducida 8.00 ', title_style)
- sheet2.merge_range('A12:D12', 'Total Ventas Internas afectadas por alícuota general más adicional 31.00 ',
- title_style)
- sheet2.merge_range('A13:D13', 'Total Notas de Crédito o Devoluciones aplicadas en Ventas ', title_style)
- sheet2.merge_range('A14:D14', 'Total Notas de Débito o recargos aplicadas en Ventas ', title_style)
- sheet2.merge_range('A15:D15', 'Total de Dèbitos Fiscales ', title_style)
- sheet2.merge_range('A16:D16', 'Total IGTF Percibido ', title_style)
+ sheet2.merge_range("A7:D7", "DEBITOS FISCALES", title_style)
+ sheet2.merge_range(
+ "A8:D8", "Total Ventas Internas No Gravadas ", title_style
+ )
+ sheet2.merge_range("A9:D9", "Total Ventas de Exportación ", title_style)
+ sheet2.merge_range(
+ "A10:D10",
+ "Total Ventas Internas afectadas sólo alícuota general 16.00 ",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A11:D11",
+ "Total Ventas Internas afectadas sólo alícuota reducida 8.00 ",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A12:D12",
+ "Total Ventas Internas afectadas por alícuota general más adicional 31.00 ",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A13:D13",
+ "Total Notas de Crédito o Devoluciones aplicadas en Ventas ",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A14:D14",
+ "Total Notas de Débito o recargos aplicadas en Ventas ",
+ title_style,
+ )
+ sheet2.merge_range("A15:D15", "Total de Dèbitos Fiscales ", title_style)
+ sheet2.merge_range("A16:D16", "Total IGTF Percibido ", title_style)
# CREDITOS FISCALES
- sheet2.merge_range('A19:D19', 'Total Compras Internas No Gravadas ', title_style)
- sheet2.merge_range('A20:D20', 'Total Compras de Importaciòn', title_style)
- sheet2.merge_range('A21:D21', 'Total Compras Internas afectadas sólo alícuota general 16.00 ', title_style)
- sheet2.merge_range('A22:D22', 'Total Compras Internas afectadas sólo alícuota reducida 8.00 ', title_style)
- sheet2.merge_range('A23:D23', 'Total Compras Internas afectadas por alícuota general más adicional 31.00',
- title_style)
- sheet2.merge_range('A24:D24', 'Total Notas de Crédito aplicadas en Compras', title_style)
- sheet2.merge_range('A25:D25', 'Total Notas de Débito aplicadas en Compras ', title_style)
- sheet2.merge_range('A26:D26', 'Total de Crèditos Fiscales ', title_style)
- sheet2.merge_range('A27:D27', 'Total IGTF Pagado', title_style)
+ sheet2.merge_range(
+ "A19:D19", "Total Compras Internas No Gravadas ", title_style
+ )
+ sheet2.merge_range("A20:D20", "Total Compras de Importaciòn", title_style)
+ sheet2.merge_range(
+ "A21:D21",
+ "Total Compras Internas afectadas sólo alícuota general 16.00 ",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A22:D22",
+ "Total Compras Internas afectadas sólo alícuota reducida 8.00 ",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A23:D23",
+ "Total Compras Internas afectadas por alícuota general más adicional 31.00",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A24:D24", "Total Notas de Crédito aplicadas en Compras", title_style
+ )
+ sheet2.merge_range(
+ "A25:D25", "Total Notas de Débito aplicadas en Compras ", title_style
+ )
+ sheet2.merge_range("A26:D26", "Total de Crèditos Fiscales ", title_style)
+ sheet2.merge_range("A27:D27", "Total IGTF Pagado", title_style)
# AUTOLIQUIDACION
- sheet2.merge_range('A30:D30', 'AUTOLIQUIDACION', title_style)
- sheet2.merge_range('A31:D31', 'Total Cuota Tributaria ', title_style)
- sheet2.merge_range('A32:D32', 'Excedente de Crèdito Fiscal para el mes Siguiente', title_style)
- sheet2.merge_range('A33:D33', 'Retenciones Acumuladas por Descontar ', title_style)
- sheet2.merge_range('A34:D34', 'Retenciones del Perìodo', title_style)
- sheet2.merge_range('A35:D35', 'Total Retenciones', title_style)
- sheet2.merge_range('A36:D36', 'Retenciones del IVA Soportadas y Descontadas', title_style)
- sheet2.merge_range('A37:D37', 'Saldos de Retenciones del IVA no Aplicadas', title_style)
- sheet2.merge_range('A38:D38', 'Total a Pagar', title_style)
+ sheet2.merge_range("A30:D30", "AUTOLIQUIDACION", title_style)
+ sheet2.merge_range("A31:D31", "Total Cuota Tributaria ", title_style)
+ sheet2.merge_range(
+ "A32:D32",
+ "Excedente de Crèdito Fiscal para el mes Siguiente",
+ title_style,
+ )
+ sheet2.merge_range(
+ "A33:D33", "Retenciones Acumuladas por Descontar ", title_style
+ )
+ sheet2.merge_range("A34:D34", "Retenciones del Perìodo", title_style)
+ sheet2.merge_range("A35:D35", "Total Retenciones", title_style)
+ sheet2.merge_range(
+ "A36:D36", "Retenciones del IVA Soportadas y Descontadas", title_style
+ )
+ sheet2.merge_range(
+ "A37:D37", "Saldos de Retenciones del IVA no Aplicadas", title_style
+ )
+ sheet2.merge_range("A38:D38", "Total a Pagar", title_style)
+ # (primer numero celdas hacia abajo, segundo numero columnas de lado )
+ sheet2.write(6, 5, "Base Imponible", title_style)
+ sheet2.write(7, 5, " 0 ", title_style)
+ sheet2.write(8, 5, " 1 ", title_style)
+ sheet2.write(9, 5, " 2 ", title_style)
+ sheet2.write(10, 5, " 3 ", title_style)
+ sheet2.write(11, 5, " 4 ", title_style)
+ sheet2.write(12, 5, " 5 ", title_style)
+ sheet2.write(13, 5, " 6 ", title_style)
+ sheet2.write(14, 5, " 7 ", title_style)
+ sheet2.write(15, 5, " 8 ", title_style)
+ sheet2.write(6, 6, "Dèbito Fiscal", title_style)
+ sheet2.write(7, 6, " 0 ", title_style)
+ sheet2.write(8, 6, " 1 ", title_style)
+ sheet2.write(9, 6, " 2 ", title_style)
+ sheet2.write(10, 6, " 3 ", title_style)
+ sheet2.write(11, 6, " 4 ", title_style)
+ sheet2.write(12, 6, " 5 ", title_style)
+ sheet2.write(13, 6, " 6 ", title_style)
+ sheet2.write(14, 6, " 7 ", title_style)
+ sheet2.write(15, 6, " 8 ", title_style)
# (primer numero celdas hacia abajo, segundo numero columnas de lado )
- sheet2.write(6, 5, 'Base Imponible', title_style)
- sheet2.write(7, 5, ' 0 ', title_style)
- sheet2.write(8, 5, ' 1 ', title_style)
- sheet2.write(9, 5, ' 2 ', title_style)
- sheet2.write(10, 5, ' 3 ', title_style)
- sheet2.write(11, 5, ' 4 ', title_style)
- sheet2.write(12, 5, ' 5 ', title_style)
- sheet2.write(13, 5, ' 6 ', title_style)
- sheet2.write(14, 5, ' 7 ', title_style)
- sheet2.write(15, 5, ' 8 ', title_style)
-
- sheet2.write(6, 6, 'Dèbito Fiscal', title_style)
- sheet2.write(7, 6, ' 0 ', title_style)
- sheet2.write(8, 6, ' 1 ', title_style)
- sheet2.write(9, 6, ' 2 ', title_style)
- sheet2.write(10, 6, ' 3 ', title_style)
- sheet2.write(11, 6, ' 4 ', title_style)
- sheet2.write(12, 6, ' 5 ', title_style)
- sheet2.write(13, 6, ' 6 ', title_style)
- sheet2.write(14, 6, ' 7 ', title_style)
- sheet2.write(15, 6, ' 8 ', title_style)
+ sheet2.write(18, 5, "Base Imponible", title_style)
+ sheet2.write(19, 5, " 0 ", title_style)
+ sheet2.write(20, 5, " 1 ", title_style)
+ sheet2.write(21, 5, " 2 ", title_style)
+ sheet2.write(22, 5, " 3 ", title_style)
+ sheet2.write(23, 5, " 4 ", title_style)
+ sheet2.write(24, 5, " 5 ", title_style)
+ sheet2.write(25, 5, " 6 ", title_style)
+ sheet2.write(26, 5, " 7 ", title_style)
- # (primer numero celdas hacia abajo, segundo numero columnas de lado )
- sheet2.write(18, 5, 'Base Imponible', title_style)
- sheet2.write(19, 5, ' 0 ', title_style)
- sheet2.write(20, 5, ' 1 ', title_style)
- sheet2.write(21, 5, ' 2 ', title_style)
- sheet2.write(22, 5, ' 3 ', title_style)
- sheet2.write(23, 5, ' 4 ', title_style)
- sheet2.write(24, 5, ' 5 ', title_style)
- sheet2.write(25, 5, ' 6 ', title_style)
- sheet2.write(26, 5, ' 7 ', title_style)
-
- sheet2.write(18, 6, 'Dèbito Fiscal', title_style)
- sheet2.write(19, 6, ' 0 ', title_style)
- sheet2.write(20, 6, ' 1 ', title_style)
- sheet2.write(21, 6, ' 2 ', title_style)
- sheet2.write(22, 6, ' 3 ', title_style)
- sheet2.write(23, 6, ' 4 ', title_style)
- sheet2.write(24, 6, ' 5 ', title_style)
- sheet2.write(25, 6, ' 6 ', title_style)
- sheet2.write(26, 6, ' 7 ', title_style)
+ sheet2.write(18, 6, "Dèbito Fiscal", title_style)
+ sheet2.write(19, 6, " 0 ", title_style)
+ sheet2.write(20, 6, " 1 ", title_style)
+ sheet2.write(21, 6, " 2 ", title_style)
+ sheet2.write(22, 6, " 3 ", title_style)
+ sheet2.write(23, 6, " 4 ", title_style)
+ sheet2.write(24, 6, " 5 ", title_style)
+ sheet2.write(25, 6, " 6 ", title_style)
+ sheet2.write(26, 6, " 7 ", title_style)
# (primer numero celdas hacia abajo, segundo numero columnas de lado )
# sheet2.write(18, 6, 'Dèbito Fiscal', title_style)
- sheet2.write(30, 6, ' 0 ', title_style)
- sheet2.write(31, 6, ' 1 ', title_style)
- sheet2.write(32, 6, ' 2 ', title_style)
- sheet2.write(33, 6, ' 3 ', title_style)
- sheet2.write(34, 6, ' 4 ', title_style)
- sheet2.write(35, 6, ' 5 ', title_style)
- sheet2.write(36, 6, ' 6 ', title_style)
- sheet2.write(37, 6, ' 7 ', title_style)
+ sheet2.write(30, 6, " 0 ", title_style)
+ sheet2.write(31, 6, " 1 ", title_style)
+ sheet2.write(32, 6, " 2 ", title_style)
+ sheet2.write(33, 6, " 3 ", title_style)
+ sheet2.write(34, 6, " 4 ", title_style)
+ sheet2.write(35, 6, " 5 ", title_style)
+ sheet2.write(36, 6, " 6 ", title_style)
+ sheet2.write(37, 6, " 7 ", title_style)
# Guardando en local el Excel generado
writer.save()
@@ -208,10 +256,10 @@ def generate_xls_report(self, workbook, data, account_vat):
content = buffer.read()
buffer.close()
- self.write({'content': base64.encodebytes(content)})
+ self.write({"content": base64.encodebytes(content)})
return {
- 'type': 'ir.actions.act_url',
- 'url': 'web/content/?model={}&field=content&download=true&id={}&filename=Resumen_IVA.xlsx'.format(
- self._name, self.id, self.date_from, self.date_to),
-
- }
+ "type": "ir.actions.act_url",
+ "url": "web/content/?model={}&field=content&download=true&id={}&filename=Resumen_IVA.xlsx".format(
+ self._name, self.id, self.date_from, self.date_to
+ ),
+ }
diff --git a/l10n_ve_withholding/__manifest__.py b/l10n_ve_withholding/__manifest__.py
index 1c093c80..9b4bce7b 100755
--- a/l10n_ve_withholding/__manifest__.py
+++ b/l10n_ve_withholding/__manifest__.py
@@ -6,45 +6,48 @@
#
###############################################################################
{
- 'name': "Localización Withholding Venezuela",
- 'description': """
+ "name": "Localización Withholding Venezuela",
+ "description": """
**Localización VENEZUELA Withholding**
¡Felicidades!. Este es el módulo Withholding para la implementación de
la **Localización Venezuela** que agrega características y datos
necesarios para un correcto ejercicio fiscal de su empresa.
""",
-
- 'author': "SINAPSYS GLOBAL SA || MASTERCORE SAS",
- 'website': "http://sinapsys.global",
- 'version': '15.0.0.13',
- 'category': 'Localization',
- 'license': 'AGPL-3',
- 'depends': [
- 'account', 'l10n_ve_base','account_withholding','account_withholding_automatic','account_debit_note'],
- 'data': [
- 'data/account_tax_withholding_template.xml',
- 'data/seniat_factor.xml',
- 'data/seniat_partner_type.xml',
- 'data/seniat_ut.xml',
- 'data/seniat_tabla_islr.xml',
- 'data/account_move_sequence.xml',
- 'reports/report_templates.xml',
- 'reports/report_withholding_certificate.xml',
- 'reports/report_withholding_certificate_iva.xml',
- 'reports/report_payment_group.xml',
- 'views/account_payment_view.xml',
- 'views/res_partner_view.xml',
- 'security/ir.model.access.csv',
- 'views/account_journal_view.xml',
- 'views/account_move_view.xml',
- 'views/seniat_ut_view.xml',
- 'views/seniat_factor_view.xml',
- 'views/seniat_partner_type_view.xml',
- 'views/seniat_tabla_islr_view.xml',
- 'views/account_payment_group_view.xml',
- 'views/product_template.xml',
+ "author": "SINAPSYS GLOBAL SA || MASTERCORE SAS",
+ "website": "https://github.com/OCA/l10n-venezuela",
+ "version": "15.0.0.13",
+ "category": "Localization",
+ "license": "AGPL-3",
+ "depends": [
+ "account",
+ "l10n_ve_base",
+ "account_withholding",
+ "account_withholding_automatic",
+ "account_debit_note",
+ ],
+ "data": [
+ "data/account_tax_withholding_template.xml",
+ "data/seniat_factor.xml",
+ "data/seniat_partner_type.xml",
+ "data/seniat_ut.xml",
+ "data/seniat_tabla_islr.xml",
+ "data/account_move_sequence.xml",
+ "reports/report_templates.xml",
+ "reports/report_withholding_certificate.xml",
+ "reports/report_withholding_certificate_iva.xml",
+ "reports/report_payment_group.xml",
+ "views/account_payment_view.xml",
+ "views/res_partner_view.xml",
+ "security/ir.model.access.csv",
+ "views/account_journal_view.xml",
+ "views/account_move_view.xml",
+ "views/seniat_ut_view.xml",
+ "views/seniat_factor_view.xml",
+ "views/seniat_partner_type_view.xml",
+ "views/seniat_tabla_islr_view.xml",
+ "views/account_payment_group_view.xml",
+ "views/product_template.xml",
#'views/withholding_distribution_view.xml',
],
-
}
diff --git a/l10n_ve_withholding/data/account_move_sequence.xml b/l10n_ve_withholding/data/account_move_sequence.xml
index c9784bf3..a51b7b2d 100755
--- a/l10n_ve_withholding/data/account_move_sequence.xml
+++ b/l10n_ve_withholding/data/account_move_sequence.xml
@@ -1,4 +1,4 @@
-
+
@@ -10,7 +10,7 @@
6
1
1
-
+
-
\ No newline at end of file
+
diff --git a/l10n_ve_withholding/data/account_tax_withholding_template.xml b/l10n_ve_withholding/data/account_tax_withholding_template.xml
index 819fcec7..a5db9b03 100755
--- a/l10n_ve_withholding/data/account_tax_withholding_template.xml
+++ b/l10n_ve_withholding/data/account_tax_withholding_template.xml
@@ -1,4 +1,4 @@
-
+
@@ -10,7 +10,7 @@
8
1
1
-
+
@@ -21,7 +21,7 @@
8
1
1
-
+
@@ -30,12 +30,14 @@
Retención de IVA en compras
16%
4
-
+
fixed
partner_tax
untaxed_amount
-
-
+
-
+
+ ]"
+ />
supplier
@@ -65,12 +71,14 @@
Retención ISLR
Retención ISLR
4
-
+
fixed
tabla_islr
untaxed_amount
-
-
+
-
+
+ ]"
+ />
supplier
diff --git a/l10n_ve_withholding/data/seniat_factor.xml b/l10n_ve_withholding/data/seniat_factor.xml
index 6f3a3cd5..ff92557c 100755
--- a/l10n_ve_withholding/data/seniat_factor.xml
+++ b/l10n_ve_withholding/data/seniat_factor.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/l10n_ve_withholding/data/seniat_partner_type.xml b/l10n_ve_withholding/data/seniat_partner_type.xml
index 4b2adcfd..db1cd773 100755
--- a/l10n_ve_withholding/data/seniat_partner_type.xml
+++ b/l10n_ve_withholding/data/seniat_partner_type.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/l10n_ve_withholding/data/seniat_tabla_islr.xml b/l10n_ve_withholding/data/seniat_tabla_islr.xml
index 04284d6a..9aba551c 100755
--- a/l10n_ve_withholding/data/seniat_tabla_islr.xml
+++ b/l10n_ve_withholding/data/seniat_tabla_islr.xml
@@ -1,4 +1,4 @@
-
+
@@ -27,13 +27,15 @@
002
Honorarios Profesionales
-
-
+
+
100
-
+
amount
1.b
-
+ ]"
+ />
003
Honorarios Profesionales
-
-
+
+
90
-
+
no_amount
1.a
-
-
+ ]"
+ />
+
004
Honorarios Profesionales
-
-
+
+
100
-
+
no_amount
1.b
-
+ ]"
+ />
005
Honorarios Profesionales
-
-
+
+
90
-
+
amount
1.a
-
+ ]"
+ />
006
Preparadores de Animales
-
-
+
+
90
-
+
no_amount
1.c
-
+ ]"
+ />
018
- Comisiones distintas a Remuneraciones Sueldos y Salarios
-
-
+ Comisiones distintas a Remuneraciones Sueldos y Salarios
+
+
100
-
+
amount
2.a
-
+ ]"
+ />
019
- Comisiones distintas a Remuneraciones Sueldos y Salarios
-
-
+ Comisiones distintas a Remuneraciones Sueldos y Salarios
+
+
100
-
+
no_amount
2.a
-
+ ]"
+ />
020
- Comisiones distintas a Remuneraciones Sueldos y Salarios
-
-
+ Comisiones distintas a Remuneraciones Sueldos y Salarios
+
+
100
-
+
no_amount
2.a
-
+ ]"
+ />
021
- Comisiones distintas a Remuneraciones Sueldos y Salarios
-
-
+ Comisiones distintas a Remuneraciones Sueldos y Salarios
+
+
100
-
+
no_amount
2.a
-
+ ]"
+ />
053
- Servicios (Incluyendo Suministros y Bienes)
-
-
+ Servicios (Incluyendo Suministros y Bienes)
+
+
100
-
+
amount
11
-
+ ]"
+ />
054
- Servicios (Incluyendo Suministros y Bienes)
-
-
+ Servicios (Incluyendo Suministros y Bienes)
+
+
100
-
+
no_amount
11
-
+ ]"
+ />
055
- Servicios (Incluyendo Suministros y Bienes)
-
-
+ Servicios (Incluyendo Suministros y Bienes)
+
+
100
-
+
no_amount
11
-
+ ]"
+ />
056
- Servicios (Incluyendo Suministros y Bienes)
-
-
+ Servicios (Incluyendo Suministros y Bienes)
+
+
100
-
+
amount
11
-
+ ]"
+ />
@@ -313,13 +368,15 @@
Pagos de los Administradores de bienes inmuebles a los Arrendadores de los bienes inmuebles situados en el país
-
-
+
+
100
-
+
amount
12
-
+ ]"
+ />
058
Pagos de los Administradores de bienes inmuebles a los Arrendadores de los bienes inmuebles situados en el país
-
-
+
+
100
-
+
no_amount
12
-
+ ]"
+ />
059
Pagos de los Administradores de bienes inmuebles a los Arrendadores de los bienes inmuebles situados en el país
-
-
+
+
100
-
+
no_amount
12
-
+ ]"
+ />
060
Pagos de los Administradores de bienes inmuebles a los Arrendadores de los bienes inmuebles situados en el país
-
-
+
+
100
-
+
amount
12
-
+ ]"
+ />
@@ -414,13 +481,15 @@
061
Arrendadamiento bienes Muebles
-
-
+
+
100
-
+
amount
13
-
+ ]"
+ />
062
Arrendadamiento bienes Muebles
-
-
+
+
100
-
+
no_amount
13
-
+ ]"
+ />
063
Arrendadamiento bienes Muebles
-
-
+
+
100
-
+
no_amount
13
-
+ ]"
+ />
064
Arrendadamiento bienes Muebles
-
-
+
+
100
-
+
no_amount
13
-
+ ]"
+ />
@@ -491,13 +570,15 @@
071
Fletes y Gastos de Transporte Nacional
-
-
+
+
100
-
+
amount
15
-
+ ]"
+ />
072
Fletes y Gastos de Transporte Nacional
-
-
+
+
100
-
+
no_amount
15
-
+ ]"
+ />
@@ -569,13 +654,15 @@
083
Publicidad y Propaganda
-
-
+
+
100
-
+
amount
19
-
+ ]"
+ />
084
Publicidad y Propaganda
-
-
+
+
100
-
+
no_amount
19
-
+ ]"
+ />
085
Publicidad y Propaganda
-
-
+
+
100
-
+
no_amount
19
-
+ ]"
+ />
@@ -628,20 +722,23 @@
086
Publicidad y Propaganda Radio
-
-
+
+
100
-
+
no_amount
19
-
+ ]"
+ />
diff --git a/l10n_ve_withholding/data/seniat_ut.xml b/l10n_ve_withholding/data/seniat_ut.xml
index d20ba42f..7d26b449 100755
--- a/l10n_ve_withholding/data/seniat_ut.xml
+++ b/l10n_ve_withholding/data/seniat_ut.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/l10n_ve_withholding/models/account_journal.py b/l10n_ve_withholding/models/account_journal.py
index 6e88cb04..3cf975a0 100755
--- a/l10n_ve_withholding/models/account_journal.py
+++ b/l10n_ve_withholding/models/account_journal.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2020-Present.
@@ -6,29 +5,30 @@
#
#
###############################################################################
-from odoo import models, fields, api, _
+from odoo import api, fields, models
class AccountJournal(models.Model):
_inherit = "account.journal"
sequence_control_id = fields.Many2one(
- 'ir.sequence',
- 'Sequence control number',
+ "ir.sequence",
+ "Sequence control number",
copy=False,
help="Checks numbering sequence.",
)
next_control_number = fields.Integer(
- 'Next Number Control',
- compute='_compute_next_control_number',
+ "Next Number Control",
+ compute="_compute_next_control_number",
)
current_control_number = fields.Integer(
- 'Current Number Control',
- compute='_compute_current_control_number',
+ "Current Number Control",
+ compute="_compute_current_control_number",
)
- apply_iva = fields.Boolean('¿Utilizar diario para Aplicar Retención IVA?')
- apply_islr = fields.Boolean('¿Utilizar diario para Aplicar Retención ISLR?')
- @api.depends('sequence_control_id')
+ apply_iva = fields.Boolean("¿Utilizar diario para Aplicar Retención IVA?")
+ apply_islr = fields.Boolean("¿Utilizar diario para Aplicar Retención ISLR?")
+
+ @api.depends("sequence_control_id")
def _compute_next_control_number(self):
for rec in self:
if rec.sequence_control_id:
@@ -36,12 +36,13 @@ def _compute_next_control_number(self):
else:
rec.next_control_number = 0
- @api.depends('sequence_control_id')
+ @api.depends("sequence_control_id")
def _compute_current_control_number(self):
for rec in self:
if rec.sequence_control_id:
- rec.current_control_number = rec.sequence_control_id.\
- number_next_actual - rec.sequence_control_id.\
- number_increment
+ rec.current_control_number = (
+ rec.sequence_control_id.number_next_actual
+ - rec.sequence_control_id.number_increment
+ )
else:
rec.current_control_number = 0
diff --git a/l10n_ve_withholding/models/account_move.py b/l10n_ve_withholding/models/account_move.py
index fc8c5978..a962640d 100755
--- a/l10n_ve_withholding/models/account_move.py
+++ b/l10n_ve_withholding/models/account_move.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2020-Present.
@@ -6,40 +5,60 @@
#
#
###############################################################################
-from odoo import models, fields, api, _
-from odoo.exceptions import UserError, ValidationError
-from datetime import datetime
import logging
+from odoo import _, api, fields, models
+from odoo.exceptions import ValidationError
+
_logger = logging.getLogger(__name__)
+
class AccountMove(models.Model):
_inherit = "account.move"
l10n_ve_document_number = fields.Char(
- 'Control Number', size=80,
+ "Control Number",
+ size=80,
help="Number used to manage pre-printed invoices, by law you will"
- " need to put here this number to be able to declarate on"
- " Fiscal reports correctly.",store=True)
+ " need to put here this number to be able to declarate on"
+ " Fiscal reports correctly.",
+ store=True,
+ )
applied_withholding_tax = fields.Boolean(
- 'Retencion de IVA aplicada', compute='_compute_applied_withholding',
- store=True, copy=False, default=False)
+ "Retencion de IVA aplicada",
+ compute="_compute_applied_withholding",
+ store=True,
+ copy=False,
+ default=False,
+ )
applied_withholding_islr = fields.Boolean(
- 'Retencion de ISLR aplicada', compute='_compute_applied_withholding',
- store=True, copy=False, default=False)
+ "Retencion de ISLR aplicada",
+ compute="_compute_applied_withholding",
+ store=True,
+ copy=False,
+ default=False,
+ )
-
- @api.depends('amount_residual','amount_residual_signed',)
+ @api.depends(
+ "amount_residual",
+ "amount_residual_signed",
+ )
def _compute_applied_withholding(self):
for rec in self:
applied_withholding_tax = False
applied_withholding_islr = False
- if rec.move_type in ['in_invoice'] and rec.payment_group_ids:
- if rec._get_reconciled_payments().mapped(
- 'payment_group_id').filtered(lambda x: x.iva == True):
+ if rec.move_type in ["in_invoice"] and rec.payment_group_ids:
+ if (
+ rec._get_reconciled_payments()
+ .mapped("payment_group_id")
+ .filtered(lambda x: x.iva == True)
+ ):
applied_withholding_tax = True
- if rec._get_reconciled_payments().mapped(
- 'payment_group_id').filtered(lambda x: x.islr == True):
+ if (
+ rec._get_reconciled_payments()
+ .mapped("payment_group_id")
+ .filtered(lambda x: x.islr == True)
+ ):
applied_withholding_islr = True
rec.applied_withholding_tax = applied_withholding_tax
@@ -65,20 +84,25 @@ def get_taxes_values(self):
def _post(self, soft=True):
super(AccountMove, self)._post(soft)
for rec in self:
- if (rec.state == 'posted' and rec.\
- l10n_ve_document_number == False) or rec.\
- move_type == 'out_refund' and rec.l10n_ve_document_number == '':
- if rec.move_type in ['out_invoice', 'out_refund']:
+ if (
+ (rec.state == "posted" and rec.l10n_ve_document_number == False)
+ or rec.move_type == "out_refund"
+ and rec.l10n_ve_document_number == ""
+ ):
+ if rec.move_type in ["out_invoice", "out_refund"]:
if rec.journal_id.sequence_control_id:
- l10n_ve_document_number = rec.env[
- 'ir.sequence'].next_by_code(rec.journal_id.\
- sequence_control_id.code)
- rec.write({
- 'l10n_ve_document_number': l10n_ve_document_number})
+ l10n_ve_document_number = rec.env["ir.sequence"].next_by_code(
+ rec.journal_id.sequence_control_id.code
+ )
+ rec.write({"l10n_ve_document_number": l10n_ve_document_number})
else:
raise ValidationError(
- _("El diario por el cual está emitiendo la factura no"+
- " tiene secuencia para número de control"))
+ _(
+ "El diario por el cual está emitiendo la factura no"
+ + " tiene secuencia para número de control"
+ )
+ )
+
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
diff --git a/l10n_ve_withholding/models/account_payment.py b/l10n_ve_withholding/models/account_payment.py
index e2eb0e2f..5ec85857 100755
--- a/l10n_ve_withholding/models/account_payment.py
+++ b/l10n_ve_withholding/models/account_payment.py
@@ -1,106 +1,126 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2022-Present.
#
#
###############################################################################
-from odoo import models, fields, api, _
import logging
+from odoo import _, api, fields, models
+
_logger = logging.getLogger(__name__)
+
class AccountPayment(models.Model):
_inherit = "account.payment"
- #created to record retention percentages
- comment_withholding = fields.Char('Comment withholding')
- concept_withholding = fields.Char('Concept withholding')
+ # created to record retention percentages
+ comment_withholding = fields.Char("Comment withholding")
+ concept_withholding = fields.Char("Concept withholding")
withholding_distribution_ids = fields.One2many(
- 'withholding.distribution', 'payment_id',
- string='distribucion de retencion'
+ "withholding.distribution", "payment_id", string="distribucion de retencion"
+ )
+ withholding_number_state = fields.Boolean(
+ string=_("Número de retención editable"),
+ compute="_compute_withholding_number_readonly",
)
- withholding_number_state = fields.Boolean(string=_('Número de retención editable'),
- compute="_compute_withholding_number_readonly")
- @api.depends('payment_type','state')
+ @api.depends("payment_type", "state")
def _compute_withholding_number_readonly(self):
for rec in self:
state = True
- if rec.payment_type == 'inbound' and rec.state == 'draft':
+ if rec.payment_type == "inbound" and rec.state == "draft":
state = False
rec.withholding_number_state = state
def _get_fiscal_period(self, date):
- str_date = str(date).split('-')
- vals = 'AÑO '+str_date[0]+' MES '+str_date[1]
+ str_date = str(date).split("-")
+ vals = "AÑO " + str_date[0] + " MES " + str_date[1]
return vals
- @api.onchange('journal_id')
+ @api.onchange("journal_id")
def _onchange_compute_amount_currency(self):
for rec in self:
- pass
if rec.other_currency and rec.payment_group_id:
if rec.payment_group_id.payments_amount <= 0:
rec.amount = rec.payment_group_id.selected_finacial_debt
if rec.payment_group_id and rec.payment_group_id.payments_amount > 0:
rec.amount = 0
- payments_amount = rec.payment_group_id.selected_finacial_debt - \
- rec.payment_group_id.payments_amount
+ payments_amount = (
+ rec.payment_group_id.selected_finacial_debt
+ - rec.payment_group_id.payments_amount
+ )
rec.amount = rec.company_id.currency_id._convert(
- payments_amount, rec.currency_id, rec.company_id, rec.date)
+ payments_amount, rec.currency_id, rec.company_id, rec.date
+ )
if not rec.other_currency and rec.payment_group_id:
rec.amount = rec.payment_group_id.selected_finacial_debt
if rec.payment_group_id and rec.payment_group_id.payments_amount > 0:
payments_amount = rec.payment_group_id.payments_amount - rec.amount
- rec.amount = rec.payment_group_id.selected_finacial_debt - \
- payments_amount
+ rec.amount = (
+ rec.payment_group_id.selected_finacial_debt - payments_amount
+ )
- @api.onchange('date')
+ @api.onchange("date")
def _onchange_compute_amount_currency_date(self):
for rec in self:
if rec.other_currency and rec.payment_group_id:
rec.amount_company_currency = rec.currency_id._convert(
- rec.amount, rec.company_id.currency_id,
- rec.company_id, rec.date)
+ rec.amount, rec.company_id.currency_id, rec.company_id, rec.date
+ )
def _create_paired_internal_transfer_payment(self):
- ''' When an internal transfer is posted, a paired payment is created
+ """When an internal transfer is posted, a paired payment is created
with opposite payment_type and swapped journal_id & destination_journal_id.
Both payments liquidity transfer lines are then reconciled.
- '''
+ """
for payment in self:
- paired_payment = payment.copy({
- 'journal_id': payment.destination_journal_id.id,
- 'destination_journal_id': payment.journal_id.id,
- 'payment_type': payment.payment_type == 'outbound' and 'inbound' or 'outbound',
- 'move_id': None,
- 'ref': payment.ref,
- 'paired_internal_transfer_payment_id': payment.id,
- 'date': payment.date,
- 'exchange_rate': payment.exchange_rate,
- 'amount_company_currency': payment.amount_company_currency,
- })
+ paired_payment = payment.copy(
+ {
+ "journal_id": payment.destination_journal_id.id,
+ "destination_journal_id": payment.journal_id.id,
+ "payment_type": payment.payment_type == "outbound"
+ and "inbound"
+ or "outbound",
+ "move_id": None,
+ "ref": payment.ref,
+ "paired_internal_transfer_payment_id": payment.id,
+ "date": payment.date,
+ "exchange_rate": payment.exchange_rate,
+ "amount_company_currency": payment.amount_company_currency,
+ }
+ )
paired_payment.move_id._post(soft=False)
payment.paired_internal_transfer_payment_id = paired_payment
- body = _('This payment has been created from %s') % (
- payment.id, payment.name)
+ body = _(
+ "This payment has been created from %s"
+ ) % (payment.id, payment.name)
paired_payment.message_post(body=body)
- body = _('A second payment has been created: %s') % (
- paired_payment.id, paired_payment.name)
+ body = _(
+ "A second payment has been created: %s"
+ ) % (paired_payment.id, paired_payment.name)
payment.message_post(body=body)
- lines = (payment.move_id.line_ids + paired_payment.move_id.line_ids).filtered(
- lambda l: l.account_id == payment.destination_account_id and not l.reconciled)
+ lines = (
+ payment.move_id.line_ids + paired_payment.move_id.line_ids
+ ).filtered(
+ lambda l: l.account_id == payment.destination_account_id
+ and not l.reconciled
+ )
lines.reconcile()
def action_post(self):
for pay in self:
if pay.payment_group_id and pay.payment_group_id.to_pay_move_line_ids:
to_pay = pay.payment_group_id.to_pay_move_line_ids[0]
- if to_pay.move_id.move_type == 'in_refund' and pay.computed_withholding_amount:
- pay.write({
- 'payment_type': 'inbound',
- })
+ if (
+ to_pay.move_id.move_type == "in_refund"
+ and pay.computed_withholding_amount
+ ):
+ pay.write(
+ {
+ "payment_type": "inbound",
+ }
+ )
return super(AccountPayment, self).action_post()
diff --git a/l10n_ve_withholding/models/account_payment_group.py b/l10n_ve_withholding/models/account_payment_group.py
index bbcbd9cb..c14ba610 100755
--- a/l10n_ve_withholding/models/account_payment_group.py
+++ b/l10n_ve_withholding/models/account_payment_group.py
@@ -5,11 +5,10 @@
#
#
###############################################################################
-from odoo import models, api, fields, _
-from odoo.exceptions import ValidationError
-import json
import logging
+from odoo import api, fields, models
+
_logger = logging.getLogger(__name__)
@@ -19,42 +18,44 @@ class AccountPaymentGroup(models.Model):
# this field is to be used by vat retention
selected_debt_taxed = fields.Monetary(
- string='Selected Debt taxed',
- compute='_compute_selected_debt_taxed',
- )
- iva = fields.Boolean('¿Aplicar Retención IVA?')
- islr = fields.Boolean('¿Aplicar Retención ISLR?')
- regimen_islr_id = fields.Many2one(
- 'seniat.tabla.islr',
- 'Aplicativo ISLR'
+ string="Selected Debt taxed",
+ compute="_compute_selected_debt_taxed",
)
+ iva = fields.Boolean("¿Aplicar Retención IVA?")
+ islr = fields.Boolean("¿Aplicar Retención ISLR?")
+ regimen_islr_id = fields.Many2one("seniat.tabla.islr", "Aplicativo ISLR")
partner_regimen_islr_ids = fields.Many2many(
- 'seniat.tabla.islr',
- compute='_partner_regimenes_islr',
+ "seniat.tabla.islr",
+ compute="_partner_regimenes_islr",
)
- #This field is to be used by invoice in multicurrency
+ # This field is to be used by invoice in multicurrency
selected_finacial_debt = fields.Monetary(
- string='Selected Financial Debt',
- compute='_compute_selected_debt_financial',
+ string="Selected Financial Debt",
+ compute="_compute_selected_debt_financial",
)
selected_finacial_debt_currency = fields.Monetary(
- string='Selected Financial Debt in foreign currency',
- compute='_compute_selected_debt_financial',
+ string="Selected Financial Debt in foreign currency",
+ compute="_compute_selected_debt_financial",
)
debt_multicurrency = fields.Boolean(
- string='debt is in foreign currency?', default=False,
+ string="debt is in foreign currency?",
+ default=False,
)
- selected_debt_currency_id = fields.Many2one("res.currency",
- string='Selected Debt in foreign currency',
+ selected_debt_currency_id = fields.Many2one(
+ "res.currency",
+ string="Selected Debt in foreign currency",
)
withholding_distributin_islr = fields.Boolean(
- '¿Aplicar varios conceptos de ISLR?',
- default=False,)
+ "¿Aplicar varios conceptos de ISLR?",
+ default=False,
+ )
withholding_distributin_islr_ids = fields.One2many(
- 'withholding.distribution.islr', 'payment_group_id',
- string='Distribucion de conceptos')
+ "withholding.distribution.islr",
+ "payment_group_id",
+ string="Distribucion de conceptos",
+ )
- @api.onchange('withholding_distributin_islr')
+ @api.onchange("withholding_distributin_islr")
def _onchange_withholding_distributin_islr(self):
for rec in self:
if rec.withholding_distributin_islr:
@@ -63,56 +64,66 @@ def _onchange_withholding_distributin_islr(self):
if to_pay.move_id.invoice_line_ids:
for li in to_pay.move_id.invoice_line_ids:
if not li.product_id.product_tmpl_id.disable_islr:
- withholding_distributin_islr_ids.append((0, 0, {
- 'payment_group_id': rec.id,
- 'move_line_id': li.id,
- }))
+ withholding_distributin_islr_ids.append(
+ (
+ 0,
+ 0,
+ {
+ "payment_group_id": rec.id,
+ "move_line_id": li.id,
+ },
+ )
+ )
rec.withholding_distributin_islr_ids = withholding_distributin_islr_ids
else:
rec.withholding_distributin_islr_ids = False
- @api.depends('partner_id.seniat_regimen_islr_ids')
+ @api.depends("partner_id.seniat_regimen_islr_ids")
def _partner_regimenes_islr(self):
"""
Lo hacemos con campo computado y no related para que solo se setee
y se exija si es pago a proveedor
"""
for rec in self:
- if rec.partner_type == 'supplier':
+ if rec.partner_type == "supplier":
rec.partner_regimen_islr_ids = rec.partner_id.seniat_regimen_islr_ids
else:
- rec.partner_regimen_islr_ids = rec.env['seniat.tabla.islr']
+ rec.partner_regimen_islr_ids = rec.env["seniat.tabla.islr"]
@api.depends(
- 'to_pay_move_line_ids.amount_residual',
- 'to_pay_move_line_ids.amount_residual_currency',
- 'to_pay_move_line_ids.currency_id',
- 'to_pay_move_line_ids.move_id',
- 'payment_date',
- 'currency_id',
+ "to_pay_move_line_ids.amount_residual",
+ "to_pay_move_line_ids.amount_residual_currency",
+ "to_pay_move_line_ids.currency_id",
+ "to_pay_move_line_ids.move_id",
+ "payment_date",
+ "currency_id",
)
def _compute_selected_debt_taxed(self):
for rec in self:
selected_debt_taxed = 0.0
for line in rec.to_pay_move_line_ids._origin:
- #this is conditional used to vat retention
+ # this is conditional used to vat retention
for li in line.move_id.line_ids:
- if li.name in ['IVA (16.0%) compras','IVA (8.0%) compras','IVA (31.0%) compras']:
- if line.move_id.move_type == 'in_refund':
+ if li.name in [
+ "IVA (16.0%) compras",
+ "IVA (8.0%) compras",
+ "IVA (31.0%) compras",
+ ]:
+ if line.move_id.move_type == "in_refund":
selected_debt_taxed += li.credit
else:
selected_debt_taxed += li.debit
rec.selected_debt_taxed = selected_debt_taxed
@api.depends(
- 'to_pay_move_line_ids.amount_residual',
- 'to_pay_move_line_ids.amount_residual_currency',
- 'to_pay_move_line_ids.currency_id',
- 'to_pay_move_line_ids.move_id',
- 'payment_date',
- 'currency_id',
- 'partner_id',
- 'selected_debt',
+ "to_pay_move_line_ids.amount_residual",
+ "to_pay_move_line_ids.amount_residual_currency",
+ "to_pay_move_line_ids.currency_id",
+ "to_pay_move_line_ids.move_id",
+ "payment_date",
+ "currency_id",
+ "partner_id",
+ "selected_debt",
)
def _compute_selected_debt_financial(self):
for rec in self:
@@ -124,34 +135,60 @@ def _compute_selected_debt_financial(self):
selected_finacial_debt_currency += line.amount_residual_currency
rec.debt_multicurrency = True
rec.selected_debt_currency_id = line.move_id.currency_id.id
- elif line.move_id.currency_id.id != rec.company_id.currency_id.id and rec.debt_multicurrency:
+ elif (
+ line.move_id.currency_id.id != rec.company_id.currency_id.id
+ and rec.debt_multicurrency
+ ):
selected_finacial_debt_currency += line.amount_residual_currency
rec.debt_multicurrency = True
else:
rec.debt_multicurrency = False
if rec.debt_multicurrency:
last_rate = 0
- last_rate = self.env['res.currency.rate'].search([
- ('currency_id', '=', rec.selected_debt_currency_id.id),
- ('name', '=', rec.payment_date)
- ], limit=1).rate
+ last_rate = (
+ self.env["res.currency.rate"]
+ .search(
+ [
+ ("currency_id", "=", rec.selected_debt_currency_id.id),
+ ("name", "=", rec.payment_date),
+ ],
+ limit=1,
+ )
+ .rate
+ )
if last_rate == 0:
- last_rate = self.env['res.currency.rate'].search([
- ('currency_id', '=', rec.selected_debt_currency_id.id),
- ], limit=1).rate
+ last_rate = (
+ self.env["res.currency.rate"]
+ .search(
+ [
+ (
+ "currency_id",
+ "=",
+ rec.selected_debt_currency_id.id,
+ ),
+ ],
+ limit=1,
+ )
+ .rate
+ )
if last_rate == 0:
last_rate = 1
rate = round((1 / last_rate), 4)
- finacial_debt_currency = selected_finacial_debt_currency*rate
+ finacial_debt_currency = selected_finacial_debt_currency * rate
selected_finacial_debt += finacial_debt_currency
else:
selected_finacial_debt += line.amount_residual
- #selected_debt += line.move_id.amount_residual
- sign = rec.partner_type == 'supplier' and -1.0 or 1.0
+ # selected_debt += line.move_id.amount_residual
+ sign = rec.partner_type == "supplier" and -1.0 or 1.0
rec.selected_finacial_debt = selected_finacial_debt * sign
rec.selected_finacial_debt_currency = selected_finacial_debt_currency * sign
- @api.depends('selected_debt', 'debt_multicurrency','selected_finacial_debt', 'unreconciled_amount',)
+ @api.depends(
+ "selected_debt",
+ "debt_multicurrency",
+ "selected_finacial_debt",
+ "unreconciled_amount",
+ )
def _compute_to_pay_amount(self):
for rec in self:
if rec.selected_finacial_debt != rec.selected_debt:
@@ -159,7 +196,7 @@ def _compute_to_pay_amount(self):
else:
rec.to_pay_amount = rec.selected_debt + rec.unreconciled_amount
- @api.onchange('to_pay_amount')
+ @api.onchange("to_pay_amount")
def _inverse_to_pay_amount(self):
for rec in self:
if rec.selected_finacial_debt != rec.selected_debt:
diff --git a/l10n_ve_withholding/models/account_tax.py b/l10n_ve_withholding/models/account_tax.py
index 4c0845f3..7e762bfb 100755
--- a/l10n_ve_withholding/models/account_tax.py
+++ b/l10n_ve_withholding/models/account_tax.py
@@ -1,11 +1,8 @@
-from odoo import models, fields, api, _
-from odoo.exceptions import UserError, ValidationError
+import logging
from ast import literal_eval
-from odoo.tools.safe_eval import safe_eval
-from dateutil.relativedelta import relativedelta
-import datetime
-import logging
+from odoo import _, fields, models
+from odoo.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
@@ -14,105 +11,140 @@ class AccountTax(models.Model):
_inherit = "account.tax"
amount_type = fields.Selection(
- selection_add=([
- ('partner_tax', 'Alícuota en el Partner'),
- ]), ondelete={'partner_tax': 'set default'}
+ selection_add=(
+ [
+ ("partner_tax", "Alícuota en el Partner"),
+ ]
+ ),
+ ondelete={"partner_tax": "set default"},
)
withholding_type = fields.Selection(
- selection_add=([
- ('tabla_islr', 'Tabla ISLR'),
- ('partner_tax', 'Alícuota en el Partner'),
- ]), ondelete={'tabla_islr': 'set default', 'partner_tax': 'set default'}
+ selection_add=(
+ [
+ ("tabla_islr", "Tabla ISLR"),
+ ("partner_tax", "Alícuota en el Partner"),
+ ]
+ ),
+ ondelete={"tabla_islr": "set default", "partner_tax": "set default"},
)
def get_withholding_vals(self, payment_group):
commercial_partner = payment_group.commercial_partner_id
force_withholding_amount_type = None
- if self.withholding_type == 'partner_tax' and payment_group.iva == True:
+ if self.withholding_type == "partner_tax" and payment_group.iva == True:
alicuota_retencion = self.get_partner_alicuot(commercial_partner)
alicuota = int(alicuota_retencion) / 100.0
force_withholding_amount_type = self.withholding_amount_type
vals = super(AccountTax, self).get_withholding_vals(
- payment_group, force_withholding_amount_type)
+ payment_group, force_withholding_amount_type
+ )
base_amount = payment_group.selected_debt_taxed
base_invoice = [
- x.balance * -1.0 for x in payment_group.to_pay_move_line_ids][0]
+ x.balance * -1.0 for x in payment_group.to_pay_move_line_ids
+ ][0]
amount = base_amount * (alicuota)
to_pay = payment_group.to_pay_move_line_ids[0]
withholdable_invoiced_amount = 0.00
distribution = []
foreign_currency = False
- iva_retencion = 0.00
if to_pay:
selected_debt_taxed = 0.0
if to_pay.currency_id.id != payment_group.company_id.currency_id.id:
- foreign_currency =True
+ foreign_currency = True
taxes = [
- 'IVA (16.0%) compras','IVA (8.0%) compras',
- 'IVA (31.0%) compras',
+ "IVA (16.0%) compras",
+ "IVA (8.0%) compras",
+ "IVA (31.0%) compras",
]
if to_pay.move_id.line_ids:
for abg in to_pay.move_id.line_ids:
if abg.name in taxes:
tax_amount = abg.debit
- alic = alicuota
- withholding_amount = abg.debit*alicuota
+ withholding_amount = abg.debit * alicuota
invoice_amount = 0.00
- for abg_base in to_pay.move_id.line_ids.filtered(lambda x: x.tax_ids.name in [abg.name]):
- withholdable_invoiced_amount += abg_base.debit if to_pay.move_id.move_type != 'in_refund' else abg_base.credit
- invoice_amount += abg_base.debit if to_pay.move_id.move_type != 'in_refund' else abg_base.credit
+ for abg_base in to_pay.move_id.line_ids.filtered(
+ lambda x: x.tax_ids.name in [abg.name]
+ ):
+ withholdable_invoiced_amount += (
+ abg_base.debit
+ if to_pay.move_id.move_type != "in_refund"
+ else abg_base.credit
+ )
+ invoice_amount += (
+ abg_base.debit
+ if to_pay.move_id.move_type != "in_refund"
+ else abg_base.credit
+ )
if foreign_currency:
- selected_debt_taxed += abg.amount_currency if abg.amount_currency >= 0 else -abg.amount_currency
+ selected_debt_taxed += (
+ abg.amount_currency
+ if abg.amount_currency >= 0
+ else -abg.amount_currency
+ )
else:
- selected_debt_taxed += abg_base.debit if to_pay.move_id.move_type == 'in_refund' else abg_base.credit
- tax = abg.name.split('(')[1].split('%')[0]
- exent_amount_ids = to_pay.move_id.line_ids\
- .filtered(lambda x: x.tax_ids\
- .filtered(lambda y: y.amount == 0.00))
+ selected_debt_taxed += (
+ abg_base.debit
+ if to_pay.move_id.move_type == "in_refund"
+ else abg_base.credit
+ )
+ tax = abg.name.split("(")[1].split("%")[0]
+ exent_amount_ids = to_pay.move_id.line_ids.filtered(
+ lambda x: x.tax_ids.filtered(lambda y: y.amount == 0.00)
+ )
base_exento = 0
for exent in exent_amount_ids:
if exent.tax_ids:
if exent.tax_ids[0].amount == 0.00:
base_exento += exent.debit
if exent.credit:
- base_exento += (exent.credit * -1.00)
- distribution.append((0, 0, {
- 'invoice_amount': invoice_amount,
- 'tax_amount': tax_amount,
- 'alic': float(tax),
- 'withholding_amount': withholding_amount,
- 'untaxed_amount': base_exento
- }))
+ base_exento += exent.credit * -1.00
+ distribution.append(
+ (
+ 0,
+ 0,
+ {
+ "invoice_amount": invoice_amount,
+ "tax_amount": tax_amount,
+ "alic": float(tax),
+ "withholding_amount": withholding_amount,
+ "untaxed_amount": base_exento,
+ },
+ )
+ )
if distribution:
- vals['withholding_distribution_ids'] = distribution
- currency_tax = selected_debt_taxed*alicuota
- vals['amount'] = currency_tax
- vals['currency_id'] = to_pay.currency_id.id
- vals['amount_company_currency'] = amount
- vals['comment_withholding'] = "%s x %s" % (base_amount, alicuota)
- vals['total_amount'] = base_invoice
- vals['withholdable_invoiced_amount'] = withholdable_invoiced_amount
- vals['withholdable_base_amount'] = base_amount
- vals['period_withholding_amount'] = amount
+ vals["withholding_distribution_ids"] = distribution
+ currency_tax = selected_debt_taxed * alicuota
+ vals["amount"] = currency_tax
+ vals["currency_id"] = to_pay.currency_id.id
+ vals["amount_company_currency"] = amount
+ vals["comment_withholding"] = "%s x %s" % (base_amount, alicuota)
+ vals["total_amount"] = base_invoice
+ vals["withholdable_invoiced_amount"] = withholdable_invoiced_amount
+ vals["withholdable_base_amount"] = base_amount
+ vals["period_withholding_amount"] = amount
- elif self.withholding_type == 'tabla_islr':
+ elif self.withholding_type == "tabla_islr":
ctx = self._context.copy()
- default_regimen_islr_id = ctx.get('default_regimen_islr_id', None)
+ default_regimen_islr_id = ctx.get("default_regimen_islr_id", None)
if default_regimen_islr_id:
- regimen = self.env['seniat.tabla.islr'].search([
- ('id', '=', default_regimen_islr_id),], limit=1)
+ regimen = self.env["seniat.tabla.islr"].search(
+ [
+ ("id", "=", default_regimen_islr_id),
+ ],
+ limit=1,
+ )
else:
regimen = payment_group.regimen_islr_id
- vals = super(AccountTax, self).get_withholding_vals(
- payment_group)
- default_regimen_islr_id = ctx.get('default_regimen_islr_id', None)
+ vals = super(AccountTax, self).get_withholding_vals(payment_group)
+ default_regimen_islr_id = ctx.get("default_regimen_islr_id", None)
to_pay = payment_group.to_pay_move_line_ids[0]
- selected_debt_untaxed = to_pay.move_id.\
- amount_untaxed_signed if to_pay.move_id.\
- amount_untaxed_signed >= 0 else -to_pay.\
- move_id.amount_untaxed_signed
+ selected_debt_untaxed = (
+ to_pay.move_id.amount_untaxed_signed
+ if to_pay.move_id.amount_untaxed_signed >= 0
+ else -to_pay.move_id.amount_untaxed_signed
+ )
if default_regimen_islr_id:
lines_base = 0
for line in payment_group.withholding_distributin_islr_ids:
@@ -129,21 +161,21 @@ def get_withholding_vals(self, payment_group):
product_off.append(li.name)
if product_off:
for abg in to_pay.move_id.line_ids:
- if to_pay.move_id.move_type == 'in_refund':
- amount_off += abg.credit
+ if to_pay.move_id.move_type == "in_refund":
+ amount_off += abg.credit
else:
amount_off += abg.debit
selected_debt_untaxed = (
- to_pay.move_id.amount_untaxed_signed * -1.00) - amount_off
+ to_pay.move_id.amount_untaxed_signed * -1.00
+ ) - amount_off
base = selected_debt_untaxed
- base_withholding = base * (
- regimen.withholding_base_percentage / 100)
+ base_withholding = base * (regimen.withholding_base_percentage / 100)
withholding_percentage = 0.0
base_ut = 0.0
subtracting = 0.0
withholding = 0.0
for band in regimen.banda_calculo_ids:
- if band.type_amount == 'ut':
+ if band.type_amount == "ut":
base_ut = base / regimen.seniat_ut_id.amount
else:
base_ut = base
@@ -152,31 +184,30 @@ def get_withholding_vals(self, payment_group):
elif base_ut > band.amount_minimum and band.amount_maximum == 0.0:
withholding_percentage = band.withholding_percentage / 100
- if regimen.type_subtracting == 'amount' and \
- band.type_amount == 'ut':
- subtracting = band.withholding_amount * \
- regimen.seniat_ut_id.amount
+ if regimen.type_subtracting == "amount" and band.type_amount == "ut":
+ subtracting = band.withholding_amount * regimen.seniat_ut_id.amount
- elif regimen.type_subtracting == 'amount' and \
- band.type_amount == 'bs':
+ elif regimen.type_subtracting == "amount" and band.type_amount == "bs":
subtracting = band.withholding_amount
if subtracting > 0.0:
- withholding = (base_withholding *
- withholding_percentage) - subtracting
+ withholding = (base_withholding * withholding_percentage) - subtracting
else:
withholding = base_withholding * withholding_percentage
- vals['concept_withholding'] = str(regimen.code_seniat)+' - '+str(regimen.activity_name)
- vals['comment_withholding'] = str(withholding_percentage*100)+"%"
- vals['total_amount'] = base
- vals['withholdable_invoiced_amount'] = base
- vals['withholdable_base_amount'] = base_withholding
- vals['period_withholding_amount'] = withholding
+ vals["concept_withholding"] = (
+ str(regimen.code_seniat) + " - " + str(regimen.activity_name)
+ )
+ vals["comment_withholding"] = str(withholding_percentage * 100) + "%"
+ vals["total_amount"] = base
+ vals["withholdable_invoiced_amount"] = base
+ vals["withholdable_base_amount"] = base_withholding
+ vals["period_withholding_amount"] = withholding
else:
vals = super(AccountTax, self).get_withholding_vals(
- payment_group, force_withholding_amount_type)
+ payment_group, force_withholding_amount_type
+ )
return vals
def get_partner_alicuota_percepcion(self, partner, date):
@@ -190,62 +221,81 @@ def get_partner_alicuot(self, partner):
if partner.vat_retention:
alicuot = partner.vat_retention
else:
- raise UserError(_(
- 'Si utiliza Cálculo de impuestos igual a "Alícuota en el '
- 'Partner", debe setear el campo de retención de IVA'
- ' en la ficha del partner, seccion Compra'))
+ raise UserError(
+ _(
+ 'Si utiliza Cálculo de impuestos igual a "Alícuota en el '
+ 'Partner", debe setear el campo de retención de IVA'
+ " en la ficha del partner, seccion Compra"
+ )
+ )
return alicuot
- #TODO:Ubicar una mejor forma de hacer el inherit
+ # TODO:Ubicar una mejor forma de hacer el inherit
def create_payment_withholdings(self, payment_group):
- for tax in self.filtered(lambda x: x.withholding_type != 'none'):
- payment_withholding = self.env[
- 'account.payment'].search([
- ('payment_group_id', '=', payment_group.id),
- ('tax_withholding_id', '=', tax.id),
- ('automatic', '=', True),
- ], limit=1)
- if (
- tax.withholding_user_error_message and
- tax.withholding_user_error_domain):
+ for tax in self.filtered(lambda x: x.withholding_type != "none"):
+ payment_withholding = self.env["account.payment"].search(
+ [
+ ("payment_group_id", "=", payment_group.id),
+ ("tax_withholding_id", "=", tax.id),
+ ("automatic", "=", True),
+ ],
+ limit=1,
+ )
+ if tax.withholding_user_error_message and tax.withholding_user_error_domain:
try:
domain = literal_eval(tax.withholding_user_error_domain)
except Exception as e:
- raise ValidationError(_(
- 'Could not eval rule domain "%s".\n'
- 'This is what we get:\n%s' % (
- tax.withholding_user_error_domain, e)))
- domain.append(('id', '=', payment_group.id))
+ raise ValidationError(
+ _(
+ 'Could not eval rule domain "%s".\n'
+ "This is what we get:\n%s"
+ % (tax.withholding_user_error_domain, e)
+ )
+ )
+ domain.append(("id", "=", payment_group.id))
if payment_group.search(domain):
raise ValidationError(tax.withholding_user_error_message)
- _logger.warning('------------------------------- PENDEINTE')
+ _logger.warning("------------------------------- PENDEINTE")
_logger.warning(payment_group)
if payment_group.withholding_distributin_islr_ids:
- _logger.warning('-------------------------')
- _logger.warning(payment_group.withholding_distributin_islr_ids.mapped('regimen_islr_id'))
+ _logger.warning("-------------------------")
+ _logger.warning(
+ payment_group.withholding_distributin_islr_ids.mapped(
+ "regimen_islr_id"
+ )
+ )
if payment_withholding:
- payment_withholdings = self.env[
- 'account.payment'].search([
- ('payment_group_id', '=', payment_group.id),
- ('tax_withholding_id.withholding_type', '=', 'tabla_islr'),
- ('automatic', '=', True),])
+ payment_withholdings = self.env["account.payment"].search(
+ [
+ ("payment_group_id", "=", payment_group.id),
+ ("tax_withholding_id.withholding_type", "=", "tabla_islr"),
+ ("automatic", "=", True),
+ ]
+ )
for p in payment_withholdings:
p.unlink()
- for islr in payment_group.withholding_distributin_islr_ids.mapped('regimen_islr_id'):
- vals = tax.with_context(default_regimen_islr_id = islr.id).get_withholding_vals(payment_group)
+ for islr in payment_group.withholding_distributin_islr_ids.mapped(
+ "regimen_islr_id"
+ ):
+ vals = tax.with_context(
+ default_regimen_islr_id=islr.id
+ ).get_withholding_vals(payment_group)
currency = payment_group.currency_id
- period_withholding_amount = currency.round(vals.get(
- 'period_withholding_amount', 0.0))
- previous_withholding_amount = currency.round(vals.get(
- 'previous_withholding_amount'))
+ period_withholding_amount = currency.round(
+ vals.get("period_withholding_amount", 0.0)
+ )
+ previous_withholding_amount = currency.round(
+ vals.get("previous_withholding_amount")
+ )
# withholding can not be negative
- computed_withholding_amount = max(0, (
- period_withholding_amount - previous_withholding_amount))
+ computed_withholding_amount = max(
+ 0, (period_withholding_amount - previous_withholding_amount)
+ )
if not computed_withholding_amount:
# if on refresh no more withholding, we delete if it exists
- #if payment_withholding:
+ # if payment_withholding:
# payment_withholding.unlink()
continue
@@ -253,43 +303,55 @@ def create_payment_withholdings(self, payment_group):
# al final vimos con varios clientes que este monto base
# debe ser la base imponible de lo que se está pagando en este
# voucher
- vals['withholding_base_amount'] = vals.get(
- 'withholdable_advanced_amount') + vals.get(
- 'withholdable_invoiced_amount')
- if vals.get('currency_id') == payment_group.company_id.currency_id.id:
- vals['amount'] = computed_withholding_amount
- vals['computed_withholding_amount'] = computed_withholding_amount
+ vals["withholding_base_amount"] = vals.get(
+ "withholdable_advanced_amount"
+ ) + vals.get("withholdable_invoiced_amount")
+ if (
+ vals.get("currency_id")
+ == payment_group.company_id.currency_id.id
+ ):
+ vals["amount"] = computed_withholding_amount
+ vals["computed_withholding_amount"] = computed_withholding_amount
# por ahora no imprimimos el comment, podemos ver de llevarlo a
# otro campo si es de utilidad
- vals.pop('comment')
- #if payment_withholding:
- #payment_withholding.write(vals)
- #pass
- #else:
+ vals.pop("comment")
+ # if payment_withholding:
+ # payment_withholding.write(vals)
+ # pass
+ # else:
payment_method = self.env.ref(
- 'account_withholding.'
- 'account_payment_method_out_withholding')
- if tax.withholding_type == 'tabla_islr':
- journal = self.env['account.journal'].search([
- ('company_id', '=', tax.company_id.id),
- ('outbound_payment_method_line_ids.payment_method_id','=', payment_method.id),
- ('type', 'in', ['cash', 'bank']),
- ('apply_islr', '=', True),
- ], limit=1)
+ "account_withholding." "account_payment_method_out_withholding"
+ )
+ if tax.withholding_type == "tabla_islr":
+ journal = self.env["account.journal"].search(
+ [
+ ("company_id", "=", tax.company_id.id),
+ (
+ "outbound_payment_method_line_ids.payment_method_id",
+ "=",
+ payment_method.id,
+ ),
+ ("type", "in", ["cash", "bank"]),
+ ("apply_islr", "=", True),
+ ],
+ limit=1,
+ )
if not journal:
- raise UserError(_(
- 'No journal for withholdings found on company %s') % (
- tax.company_id.name))
+ raise UserError(
+ _("No journal for withholdings found on company %s")
+ % (tax.company_id.name)
+ )
- method = journal._get_available_payment_method_lines('outbound').filtered(
- lambda x: x.code == 'withholding')
+ method = journal._get_available_payment_method_lines(
+ "outbound"
+ ).filtered(lambda x: x.code == "withholding")
- vals['journal_id'] = journal.id
- vals['payment_method_line_id'] = method.id
- vals['payment_type'] = 'outbound'
- vals['partner_type'] = payment_group.partner_type
- vals['partner_id'] = payment_group.partner_id.id
+ vals["journal_id"] = journal.id
+ vals["payment_method_line_id"] = method.id
+ vals["payment_type"] = "outbound"
+ vals["partner_type"] = payment_group.partner_type
+ vals["partner_id"] = payment_group.partner_id.id
payment_withholding = payment_withholding.create(vals)
else:
@@ -299,13 +361,16 @@ def create_payment_withholdings(self, payment_group):
# y terminar dando error en el asiento por debitos y creditos no
# son iguales, algo parecido hace odoo en el compute_all de taxes
currency = payment_group.currency_id
- period_withholding_amount = currency.round(vals.get(
- 'period_withholding_amount', 0.0))
- previous_withholding_amount = currency.round(vals.get(
- 'previous_withholding_amount'))
+ period_withholding_amount = currency.round(
+ vals.get("period_withholding_amount", 0.0)
+ )
+ previous_withholding_amount = currency.round(
+ vals.get("previous_withholding_amount")
+ )
# withholding can not be negative
- computed_withholding_amount = max(0, (
- period_withholding_amount - previous_withholding_amount))
+ computed_withholding_amount = max(
+ 0, (period_withholding_amount - previous_withholding_amount)
+ )
if not computed_withholding_amount:
# if on refresh no more withholding, we delete if it exists
@@ -317,49 +382,64 @@ def create_payment_withholdings(self, payment_group):
# al final vimos con varios clientes que este monto base
# debe ser la base imponible de lo que se está pagando en este
# voucher
- vals['withholding_base_amount'] = vals.get(
- 'withholdable_advanced_amount') + vals.get(
- 'withholdable_invoiced_amount')
- if vals.get('currency_id') == payment_group.company_id.currency_id.id:
- vals['amount'] = computed_withholding_amount
- vals['computed_withholding_amount'] = computed_withholding_amount
+ vals["withholding_base_amount"] = vals.get(
+ "withholdable_advanced_amount"
+ ) + vals.get("withholdable_invoiced_amount")
+ if vals.get("currency_id") == payment_group.company_id.currency_id.id:
+ vals["amount"] = computed_withholding_amount
+ vals["computed_withholding_amount"] = computed_withholding_amount
# por ahora no imprimimos el comment, podemos ver de llevarlo a
# otro campo si es de utilidad
- vals.pop('comment')
+ vals.pop("comment")
if payment_withholding:
payment_withholding.write(vals)
else:
payment_method = self.env.ref(
- 'account_withholding.'
- 'account_payment_method_out_withholding')
- if tax.withholding_type == 'partner_tax':
- journal = self.env['account.journal'].search([
- ('company_id', '=', tax.company_id.id),
- ('outbound_payment_method_line_ids.payment_method_id',
- '=', payment_method.id),
- ('type', 'in', ['cash', 'bank']),
- ('apply_iva', '=', True),
- ], limit=1)
- if tax.withholding_type == 'tabla_islr':
- journal = self.env['account.journal'].search([
- ('company_id', '=', tax.company_id.id),
- ('outbound_payment_method_line_ids.payment_method_id','=', payment_method.id),
- ('type', 'in', ['cash', 'bank']),
- ('apply_islr', '=', True),
- ], limit=1)
+ "account_withholding." "account_payment_method_out_withholding"
+ )
+ if tax.withholding_type == "partner_tax":
+ journal = self.env["account.journal"].search(
+ [
+ ("company_id", "=", tax.company_id.id),
+ (
+ "outbound_payment_method_line_ids.payment_method_id",
+ "=",
+ payment_method.id,
+ ),
+ ("type", "in", ["cash", "bank"]),
+ ("apply_iva", "=", True),
+ ],
+ limit=1,
+ )
+ if tax.withholding_type == "tabla_islr":
+ journal = self.env["account.journal"].search(
+ [
+ ("company_id", "=", tax.company_id.id),
+ (
+ "outbound_payment_method_line_ids.payment_method_id",
+ "=",
+ payment_method.id,
+ ),
+ ("type", "in", ["cash", "bank"]),
+ ("apply_islr", "=", True),
+ ],
+ limit=1,
+ )
if not journal:
- raise UserError(_(
- 'No journal for withholdings found on company %s') % (
- tax.company_id.name))
+ raise UserError(
+ _("No journal for withholdings found on company %s")
+ % (tax.company_id.name)
+ )
- method = journal._get_available_payment_method_lines('outbound').filtered(
- lambda x: x.code == 'withholding')
+ method = journal._get_available_payment_method_lines(
+ "outbound"
+ ).filtered(lambda x: x.code == "withholding")
- vals['journal_id'] = journal.id
- vals['payment_method_line_id'] = method.id
- vals['payment_type'] = 'outbound'
- vals['partner_type'] = payment_group.partner_type
- vals['partner_id'] = payment_group.partner_id.id
+ vals["journal_id"] = journal.id
+ vals["payment_method_line_id"] = method.id
+ vals["payment_type"] = "outbound"
+ vals["partner_type"] = payment_group.partner_type
+ vals["partner_id"] = payment_group.partner_id.id
payment_withholding = payment_withholding.create(vals)
return True
diff --git a/l10n_ve_withholding/models/product_template.py b/l10n_ve_withholding/models/product_template.py
index 43f18cb1..b69017fd 100755
--- a/l10n_ve_withholding/models/product_template.py
+++ b/l10n_ve_withholding/models/product_template.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2022-Present.
@@ -6,12 +5,10 @@
#
#
###############################################################################
-from odoo import models, fields, api
+from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
-
- disable_islr = fields.Boolean('No sujeto a ISLR')
-
+ disable_islr = fields.Boolean("No sujeto a ISLR")
diff --git a/l10n_ve_withholding/models/res_company.py b/l10n_ve_withholding/models/res_company.py
index a36d1997..a8c55b16 100755
--- a/l10n_ve_withholding/models/res_company.py
+++ b/l10n_ve_withholding/models/res_company.py
@@ -1,15 +1,15 @@
-from odoo import models, fields
+from odoo import models
class ResCompany(models.Model):
- _inherit = 'res.company'
+ _inherit = "res.company"
def _localization_use_withholdings(self):
- """ This method is to be inherited by localizations and return True
- if localization use documents """
+ """This method is to be inherited by localizations and return True
+ if localization use documents"""
self.ensure_one()
- if self.country_id == self.env.ref('base.ve'):
+ if self.country_id == self.env.ref("base.ve"):
return True
else:
return False
diff --git a/l10n_ve_withholding/models/res_partner.py b/l10n_ve_withholding/models/res_partner.py
index 7f2e674f..ccfe021a 100755
--- a/l10n_ve_withholding/models/res_partner.py
+++ b/l10n_ve_withholding/models/res_partner.py
@@ -5,28 +5,32 @@
#
#
###############################################################################
-from odoo import models, fields
import logging
+
+from odoo import fields, models
+
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
- vat_retention = fields.Selection([
- ('75', ' 75%'),
- ('100', '100%'),
- ],
- 'Retención I.V.A',
+ vat_retention = fields.Selection(
+ [
+ ("75", " 75%"),
+ ("100", "100%"),
+ ],
+ "Retención I.V.A",
)
seniat_partner_type_id = fields.Many2one(
- 'seniat.partner.type',
- 'Tipo de persona para la retención ISLR',
+ "seniat.partner.type",
+ "Tipo de persona para la retención ISLR",
)
seniat_regimen_islr_ids = fields.Many2many(
- 'seniat.tabla.islr',
- 'seniat_tabla_islr_partner_rel',
- 'partner_id', 'seniat_tabla_islr_id',
- string='Régimen ISLR Aplicar',
+ "seniat.tabla.islr",
+ "seniat_tabla_islr_partner_rel",
+ "partner_id",
+ "seniat_tabla_islr_id",
+ string="Régimen ISLR Aplicar",
domain="[('seniat_partner_type_id', '=', seniat_partner_type_id)]",
)
diff --git a/l10n_ve_withholding/models/seniat_islr.py b/l10n_ve_withholding/models/seniat_islr.py
index 95f11a6a..dbacee8f 100755
--- a/l10n_ve_withholding/models/seniat_islr.py
+++ b/l10n_ve_withholding/models/seniat_islr.py
@@ -5,153 +5,154 @@
#
#
###############################################################################
-from odoo import models, fields, api, _
import logging
+
+from odoo import api, fields, models
+
_logger = logging.getLogger(__name__)
+
class SeniatUnidadTributaria(models.Model):
- _name = 'seniat.ut'
- _description = 'Modelo para registrar el valor de la Unidad Tributaria'
- _rec_name = 'amount'
+ _name = "seniat.ut"
+ _description = "Modelo para registrar el valor de la Unidad Tributaria"
+ _rec_name = "amount"
date = fields.Date(
- 'Fecha',
+ "Fecha",
required=True,
)
amount = fields.Float(
- 'Valor de la Unidad',
+ "Valor de la Unidad",
required=True,
)
ref = fields.Text(
- 'Referencia de la gaceta',
+ "Referencia de la gaceta",
required=True,
)
-
+
+
class SeniatTipoPersonaISLR(models.Model):
- _name = 'seniat.partner.type'
- _description = 'Tipo de persona a aplicar la retención ISLR'
+ _name = "seniat.partner.type"
+ _description = "Tipo de persona a aplicar la retención ISLR"
name = fields.Char(
- 'Nombre Persona',
+ "Nombre Persona",
required=True,
)
code = fields.Char(
- 'Abreviado',
+ "Abreviado",
required=True,
)
+
class SeniatFactor(models.Model):
- _name = 'seniat.factor'
- _description = 'Modelo para registrar el valor del factor de calculo ISLR'
- _rec_name = 'amount'
+ _name = "seniat.factor"
+ _description = "Modelo para registrar el valor del factor de calculo ISLR"
+ _rec_name = "amount"
date = fields.Date(
- 'Fecha',
+ "Fecha",
required=True,
)
amount = fields.Float(
- 'Valor del factor',
+ "Valor del factor",
required=True,
)
+
class BandaCaculo(models.Model):
- _name = 'banda.calculo'
- _description = 'Modelo para registrar la banda de calculo del ISLR'
- _rec_name = 'complete_percentage'
+ _name = "banda.calculo"
+ _description = "Modelo para registrar la banda de calculo del ISLR"
+ _rec_name = "complete_percentage"
amount_minimum = fields.Float(
- 'Monto mayor a ',
- help="Monto para expresar la cantidad que no entra a retención"
+ "Monto mayor a ",
+ help="Monto para expresar la cantidad que no entra a retención",
)
amount_maximum = fields.Float(
- 'Monto menor a ',
- help="Monto para expresar la cantidad que no entra a retención"
+ "Monto menor a ",
+ help="Monto para expresar la cantidad que no entra a retención",
)
- type_amount = fields.Selection([
- ('ut', 'Unidad Tributaria'),
- ('bs', 'Bolivares'),
- ], 'Tipo de monto',
- help='Tipo por el cual expresan los montos minimos o maximos'
+ type_amount = fields.Selection(
+ [
+ ("ut", "Unidad Tributaria"),
+ ("bs", "Bolivares"),
+ ],
+ "Tipo de monto",
+ help="Tipo por el cual expresan los montos minimos o maximos",
)
withholding_percentage = fields.Float(
- 'Porcentaje de retención',
- help='% Base Retención'
- )
- withholding_amount = fields.Float(
- 'Pagos Mayor a Bs.',
- help='Monto Retención'
+ "Porcentaje de retención", help="% Base Retención"
)
+ withholding_amount = fields.Float("Pagos Mayor a Bs.", help="Monto Retención")
complete_percentage = fields.Char(
- 'Porcentaje de retención',
- compute='_compute_complete_percentage',
+ "Porcentaje de retención",
+ compute="_compute_complete_percentage",
)
- type_subtracting_rel = fields.Selection([
- ('no_amount', 'Sin Sustraendo'),
- ('amount', 'Con Sustraendo'),
- ], 'Tipo Calculo'
+ type_subtracting_rel = fields.Selection(
+ [
+ ("no_amount", "Sin Sustraendo"),
+ ("amount", "Con Sustraendo"),
+ ],
+ "Tipo Calculo",
)
- @api.depends('withholding_percentage')
+ @api.depends("withholding_percentage")
def _compute_complete_percentage(self):
for rec in self:
- rec.complete_percentage = str(rec.withholding_percentage)+'%'
+ rec.complete_percentage = str(rec.withholding_percentage) + "%"
class SeniatTablaIslr(models.Model):
- _name = 'seniat.tabla.islr'
- _description = 'Modelo para registrar los argumentos de calculo ISLR'
- _rec_name = 'complete_name'
+ _name = "seniat.tabla.islr"
+ _description = "Modelo para registrar los argumentos de calculo ISLR"
+ _rec_name = "complete_name"
code_seniat = fields.Char(
- 'Código SENIAT',
+ "Código SENIAT",
size=6,
required=True,
- help='Código del régimen de retención del ISLR.'
+ help="Código del régimen de retención del ISLR.",
)
activity_name = fields.Char(
- 'Actividad',
+ "Actividad",
required=True,
- help='Actividad para Archivo XML - Según Manual Seniat'
- )
- seniat_partner_type_id = fields.Many2one(
- 'seniat.partner.type',
- 'Tipo de persona'
+ help="Actividad para Archivo XML - Según Manual Seniat",
)
+ seniat_partner_type_id = fields.Many2one("seniat.partner.type", "Tipo de persona")
factor_id = fields.Many2one(
- 'seniat.factor',
- 'Factor Calculo',
+ "seniat.factor",
+ "Factor Calculo",
)
withholding_base_percentage = fields.Float(
- 'Porcentaje Base de retención',
- help='% Base Retención'
+ "Porcentaje Base de retención", help="% Base Retención"
)
- type_subtracting = fields.Selection([
- ('no_amount', 'Sin Sustraendo'),
- ('amount', 'Con Sustraendo'),
- ], 'Tipo Calculo'
+ type_subtracting = fields.Selection(
+ [
+ ("no_amount", "Sin Sustraendo"),
+ ("amount", "Con Sustraendo"),
+ ],
+ "Tipo Calculo",
)
banda_calculo_ids = fields.Many2many(
- 'banda.calculo',
- 'seniat_tabla_islr_banda_rel',
- 'seniat_tabla_islr_id', 'banda_calculo_id' ,
- string='Banda de calculo',
- help='Banda de calculo para la retención del ISLR'
+ "banda.calculo",
+ "seniat_tabla_islr_banda_rel",
+ "seniat_tabla_islr_id",
+ "banda_calculo_id",
+ string="Banda de calculo",
+ help="Banda de calculo para la retención del ISLR",
)
complete_name = fields.Char(
- 'Código SENIAT',
- compute='_compute_complete_name',
- )
- seniat_ut_id = fields.Many2one(
- 'seniat.ut',
- 'Valor Unidad Tributaria'
+ "Código SENIAT",
+ compute="_compute_complete_name",
)
+ seniat_ut_id = fields.Many2one("seniat.ut", "Valor Unidad Tributaria")
code_identification_seniat = fields.Char(
string="Código Identificación Seniat",
help="Código Identificación Seniat",
)
- @api.depends('code_seniat', 'activity_name')
+ @api.depends("code_seniat", "activity_name")
def _compute_complete_name(self):
for rec in self:
- rec.complete_name = '%s - %s' % (
- rec.code_seniat, rec.activity_name)
+ rec.complete_name = "%s - %s" % (rec.code_seniat, rec.activity_name)
diff --git a/l10n_ve_withholding/models/withholding_distribution.py b/l10n_ve_withholding/models/withholding_distribution.py
index a578dff9..ba0c4bec 100644
--- a/l10n_ve_withholding/models/withholding_distribution.py
+++ b/l10n_ve_withholding/models/withholding_distribution.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2023-Present.
@@ -6,21 +5,20 @@
#
#
###############################################################################
-from odoo import models, fields, api, _
-
import logging
+from odoo import fields, models
+
_logger = logging.getLogger(__name__)
-class withholdingDistribution(models.Model):
- _name = 'withholding.distribution'
- _description = 'withholding distribution'
- payment_id = fields.Many2one(
- 'account.payment', string='Pago')
- invoice_amount = fields.Float('Base')
- tax_amount = fields.Float('Monto Impuesto')
- alic = fields.Float('alicuota')
- withholding_amount = fields.Float('Monto Retenido')
- untaxed_amount = fields.Float('Monto exento')
+class withholdingDistribution(models.Model):
+ _name = "withholding.distribution"
+ _description = "withholding distribution"
+ payment_id = fields.Many2one("account.payment", string="Pago")
+ invoice_amount = fields.Float("Base")
+ tax_amount = fields.Float("Monto Impuesto")
+ alic = fields.Float("alicuota")
+ withholding_amount = fields.Float("Monto Retenido")
+ untaxed_amount = fields.Float("Monto exento")
diff --git a/l10n_ve_withholding/models/withholding_distribution_islr.py b/l10n_ve_withholding/models/withholding_distribution_islr.py
index 6dbbae29..1358f754 100644
--- a/l10n_ve_withholding/models/withholding_distribution_islr.py
+++ b/l10n_ve_withholding/models/withholding_distribution_islr.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
##############################################################################
# Author: SINAPSYS GLOBAL SA || MASTERCORE SAS
# Copyleft: 2023-Present.
@@ -6,39 +5,40 @@
#
#
###############################################################################
-from odoo import models, fields, api, _
-
import logging
+from odoo import fields, models
+
_logger = logging.getLogger(__name__)
+
class withholdingDistributionIslr(models.Model):
- _name = 'withholding.distribution.islr'
- _description = 'withholding distribution ISLR'
+ _name = "withholding.distribution.islr"
+ _description = "withholding distribution ISLR"
- payment_group_id = fields.Many2one(
- 'account.payment.group', string='Pago')
+ payment_group_id = fields.Many2one("account.payment.group", string="Pago")
move_line_id = fields.Many2one(
- 'account.move.line', 'Linea de factura',)
+ "account.move.line",
+ "Linea de factura",
+ )
currency_id = fields.Many2one(
- comodel_name='res.currency',
- string='Currency',
- related='move_line_id.currency_id'
+ comodel_name="res.currency",
+ string="Currency",
+ related="move_line_id.currency_id",
)
price_subtotal = fields.Monetary(
- string='Subtotal',currency_field='currency_id',
- related='move_line_id.price_subtotal', store=True,
- )
- regimen_islr_id = fields.Many2one(
- 'seniat.tabla.islr',
- 'Aplicativo ISLR'
+ string="Subtotal",
+ currency_field="currency_id",
+ related="move_line_id.price_subtotal",
+ store=True,
)
+ regimen_islr_id = fields.Many2one("seniat.tabla.islr", "Aplicativo ISLR")
product_id = fields.Many2one(
- comodel_name='product.product',
- string='Product',
- related='move_line_id.product_id',
+ comodel_name="product.product",
+ string="Product",
+ related="move_line_id.product_id",
)
partner_regimen_islr_ids = fields.Many2many(
- 'seniat.tabla.islr',
- related='payment_group_id.partner_regimen_islr_ids',
- )
\ No newline at end of file
+ "seniat.tabla.islr",
+ related="payment_group_id.partner_regimen_islr_ids",
+ )
diff --git a/l10n_ve_withholding/reports/report_payment_group.xml b/l10n_ve_withholding/reports/report_payment_group.xml
index 4aa47797..d478f38e 100755
--- a/l10n_ve_withholding/reports/report_payment_group.xml
+++ b/l10n_ve_withholding/reports/report_payment_group.xml
@@ -1,28 +1,41 @@
-
+
-
+
-
-
-
-
+
+
+
+
- Observaciones:
+ Observaciones:
@@ -41,20 +54,27 @@
-
-
+
+
-
R.I.F: -
+
R.I.F: -
-
-
+
+