Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] l10n_uy_edi_stock: version 17.0 #244

Open
wants to merge 4 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions l10n_uy_edi_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
"name": """Uruguay - E-Remitos""",
'version': "16.0.1.1.0",
'version': "17.0.1.0.0",
'category': 'Accounting/Localizations/EDI',
'countries': ['uy'],
'sequence': 12,
'author': 'Adhoc',
'description': """
Este modulo permite a los usuarios hacer e-remitos en el sistemas que son
reportados a la DGI
""",
'depends': [
'l10n_uy_edi',
'l10n_uy_ux',
'stock_account',
'sale_stock',
],
'data': [
'data/l10n_latam.document.type.csv',
'views/cfe_template.xml',
'views/stock_picking_views.xml',
'views/l10n_uy_edi_document_views.xml',
],
'installable': False,
'installable': True,
'auto_install': False,
'application': False,
'license': 'LGPL-3',
Expand Down
11 changes: 6 additions & 5 deletions l10n_uy_edi_stock/data/l10n_latam.document.type.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
id,active
l10n_uy_account.dc_e_remito_expo,False
l10n_uy_account.dc_e_remito,True
l10n_uy_account.dc_e_remito_de_exportación_contingencia,False
l10n_uy_account.dc_ e_remito_contingencia,False
"id","internal_type"
"l10n_uy.dc_remito","stock_picking"
"l10n_uy.dc_e_remito_expo","stock_picking"
"l10n_uy.dc_e_remito","stock_picking"
"l10n_uy.dc_e_remito_de_exportación_contingencia","stock_picking"
"l10n_uy.dc_e_remito_contingencia","stock_picking"
3 changes: 3 additions & 0 deletions l10n_uy_edi_stock/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from . import l10n_latam_document_type
from . import l10n_uy_addenda
from . import l10n_uy_edi_document
from . import stock_picking
10 changes: 10 additions & 0 deletions l10n_uy_edi_stock/models/l10n_latam_document_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class L10nLatamDocumentType(models.Model):

_inherit = 'l10n_latam.document.type'

internal_type = fields.Selection(selection_add=[
('stock_picking', 'Remito'),
])
13 changes: 13 additions & 0 deletions l10n_uy_edi_stock/models/l10n_uy_addenda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from odoo import models, fields


class L10nUyAddenda(models.Model):

_inherit = "l10n_uy_edi.addenda"

apply_on = fields.Selection(
selection_add=[
('stock.picking', 'Delivery Guide'),
],
ondelete={'stock.picking': 'set default'}
)
59 changes: 59 additions & 0 deletions l10n_uy_edi_stock/models/l10n_uy_edi_document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from odoo import _, models, fields, api
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_repr


class L10nUyEdiDocument(models.Model):

_inherit = 'l10n_uy_edi.document'

picking_id = fields.Many2one("stock.picking", readonly=True)

# Related fields from origin record
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")
company_id = fields.Many2one(related="picking_id.company_id")
partner_id = fields.Many2one(related="picking_id.partner_id")

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, 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
"""
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_get_cfe_tag(self, picking):
picking.ensure_one()
cfe_code = int(picking.l10n_latam_document_type_id.code)
if cfe_code in [181]:
return 'eRem'
elif cfe_code in [124]:
#no implemented
return 'eRem_Exp'
else:
return False

@api.model
def _get_stock_legends(self, addenda_type, picking_id):
""" This method is similar of what we have in l10n_uy_edi adapted for pickings"""
# Segun las pruebas que realice en uruware se puede colocar info adicional soolamente al producto
# y la addenda que se imprime aparte
res = []
addendas = picking_id.l10n_uy_edi_stock_addenda_ids.search([('type', '=', addenda_type), ('apply_on', '=', 'stock.picking')])
for addenda in addendas:
res.append("{ %s }" % addenda.content if addenda.is_legend else addenda.content)
return "\n".join(res)
Loading