Skip to content

Commit

Permalink
wip3 limpieza
Browse files Browse the repository at this point in the history
  • Loading branch information
zaoral authored and mem-adhoc committed Nov 12, 2024
1 parent eea8c4f commit 606df14
Show file tree
Hide file tree
Showing 8 changed files with 499 additions and 208 deletions.
6 changes: 4 additions & 2 deletions l10n_uy_edi_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
'sequence': 12,
'author': 'Adhoc',
'depends': [
'l10n_uy_edi',
# 'l10n_uy_ux',
'stock_account',
# 'sale_stock',
'sale_stock',
'l10n_uy_edi'
],
'data': [
'data/l10n_latam.document.type.csv',
'views/cfe_template.xml',
'views/stock_picking_views.xml',
'views/l10n_uy_edi_document_views.xml',
],
'installable': True,
'auto_install': False,
Expand Down
2 changes: 1 addition & 1 deletion l10n_uy_edi_stock/models/l10n_latam_document_type.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from odoo import fields, models


class L10nAccountDocumentType(models.Model):
class L10nLatamDocumentType(models.Model):

_inherit = 'l10n_latam.document.type'

Expand Down
11 changes: 6 additions & 5 deletions l10n_uy_edi_stock/models/l10n_uy_addenda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
class L10nUyAddenda(models.Model):

_inherit = "l10n_uy_edi.addenda"

apply_on = fields.Selection(selection_add=[
('stock.picking', 'Delivery Guide'),
('all', 'All CFE'),
])

#Comentamos temeporalmente hasta que este mezclado l10n_uy_ux
# apply_on = fields.Selection(selection_add=[
# ('stock.picking', 'Delivery Guide'),
# ('all', 'All CFE'),
# ])
43 changes: 11 additions & 32 deletions l10n_uy_edi_stock/models/l10n_uy_edi_document.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from odoo import _, models
from odoo import _, models, fields
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_repr

Expand All @@ -7,29 +7,30 @@ class L10nUyEdiDocument(models.Model):

_inherit = 'l10n_uy_edi.document'

picking_id = fields.Many2one("stock.picking", readonly=True)
l10n_latam_document_type_id = fields.Many2one(related="picking_id.l10n_latam_document_type_id")
l10n_latam_document_number = fields.Char(related="picking_id.l10n_latam_document_number")

def _is_uy_remito_exp(self):
return self.l10n_latam_document_type_id.code == '124'

def _is_uy_remito_loc(self):
return self.l10n_latam_document_type_id.code == '181'


def _is_uy_remito_type_cfe(self):
return self.l10n_latam_document_type_id.internal_type in ['stock_picking']

def _uy_get_uuid(self):
def _uy_get_uuid(self, remito):
""" Extend to properly return picking info
Uruware UUID and also A4.1 NroInterno DGI field. Spec (V24)
Nº interno que referencia - ALFA50 - Sin validación al comprobante
"""
self.ensure_one()
if self.picking_id and not self.move_id:
res = self.picking_id._name + '-' + str(self.picking_id.id)
if self.company_id._l10n_uy_edi_get_environment_type() == 'testing':
res = 'sp' + str(self.picking_id.id) + '-' + self.env.cr.dbname
return res[:50]
return super()._uy_get_uuid()
remito.ensure_one()
res = remito._name + '-' + str(remito.id)
if self.company_id.l10n_uy_edi_ucfe_env == 'testing':
res = 'sp' + str(remito.id) + '-' + remito.env.cr.dbname
return res[:50]

def _uy_cfe_B4_IndFact(self, line):
""" B4: Indicador de facturación
Expand Down Expand Up @@ -59,17 +60,13 @@ def _uy_cfe_B4_IndFact(self, line):
if self._is_uy_remito_type_cfe():
# Solo implementamos por los momentos en el N/A
res = False

else:
return super()._uy_cfe_B4_IndFact()

return {'IndFact': res} if res else {}

def _uy_cfe_B8_DscItem(self, line):
""" B8 Descripcion Adicional del ítem. Maximo 1000 caracteres """
if self._is_uy_inv_type_cfe():
return super()._uy_cfe_B8_DscItem(line)

self.ensure_one()
res = []
for rec in line.l10n_uy_edi_addenda_ids:
Expand Down Expand Up @@ -98,24 +95,6 @@ def _uy_cfe_A_receptor(self):

return res

def _uy_cfe_C_totals(self):
self.ensure_one()
res = super()._uy_cfe_C_totals()

# A110 Tipo moneda transacción: Informar para todos menos para e-Rem loc
if self._is_uy_remito_loc():
res.pop('TpoMoneda')

# A124 Total Monto Total (NUM 17)
# - Si tipo de CFE= 124 (e-remito de exportación), Valor numérico de 15 enteros y 2 decimales:
# - sino, Valor numérico de 15 enteros y 2 decimales, ≥0 : C124 = SUM(C112:C118) + SUM(C121:C123)

# A111 Tipo de Cambio: Informar siempre que la moneda sea diferente al peso Uruguayo y no sea e-Rem Loc
if self._is_uy_remito_loc():
res.pop('TpoCambio')

return res

def _uy_get_cfe_tag(self):
self.ensure_one()
if self._is_uy_remito_loc():
Expand Down
Loading

0 comments on commit 606df14

Please sign in to comment.