From d48f93d7655040e0da4a3eea0eccd952d3950b47 Mon Sep 17 00:00:00 2001 From: Joel Zilli Date: Thu, 22 Sep 2022 15:11:23 +0000 Subject: [PATCH] [IMP] l10n_ar_stock: add the possibility of force arba cuit and password closes ingadhoc/argentina-sale#107 Signed-off-by: Bruno Zanotti --- l10n_ar_stock/__manifest__.py | 2 +- l10n_ar_stock/models/res_company.py | 4 ++-- l10n_ar_stock/models/stock_book.py | 4 ++++ l10n_ar_stock/models/stock_picking.py | 4 ++-- l10n_ar_stock/views/stock_book_views.xml | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/l10n_ar_stock/__manifest__.py b/l10n_ar_stock/__manifest__.py index e7f4568..f3ebae2 100644 --- a/l10n_ar_stock/__manifest__.py +++ b/l10n_ar_stock/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Remitos, COT y demas ajustes de stock para Argentina', - 'version': '13.0.1.21.0', + 'version': '13.0.1.22.0', 'category': 'Localization/Argentina', 'sequence': 14, 'author': 'ADHOC SA', diff --git a/l10n_ar_stock/models/res_company.py b/l10n_ar_stock/models/res_company.py index 4251f73..f1816c7 100644 --- a/l10n_ar_stock/models/res_company.py +++ b/l10n_ar_stock/models/res_company.py @@ -33,7 +33,7 @@ def arba_cot_connect(self): Method to be called """ self.ensure_one() - cuit = self.partner_id.ensure_vat() + cuit = self._context.get('force_arba_cuit') or self.partner_id.ensure_vat() if not self.arba_cot: raise UserError(_( @@ -51,7 +51,7 @@ def arba_cot_connect(self): # wrapper=None, cacert=None, trace=False, testing="" arba_cot_url = self.get_arba_cot_login_url(environment_type) ws.Usuario = cuit - ws.Password = self.arba_cot + ws.Password = self._context.get('force_arba_password') or self.arba_cot ws.Conectar(url=arba_cot_url) _logger.info( 'Connection getted to ARBA COT with url "%s" and CUIT %s' % ( diff --git a/l10n_ar_stock/models/stock_book.py b/l10n_ar_stock/models/stock_book.py index 9cb3b9b..c61a3e5 100644 --- a/l10n_ar_stock/models/stock_book.py +++ b/l10n_ar_stock/models/stock_book.py @@ -32,3 +32,7 @@ class StockBook(models.Model): help="Agregar al reporte una sección para añadir firma de confirmación de recepción.", default=False, ) + arba_cot = fields.Char( + 'Clave COT', + help='Si no está definido, se utilizará el valor del COT de a compañía', + ) diff --git a/l10n_ar_stock/models/stock_picking.py b/l10n_ar_stock/models/stock_picking.py index aafed9a..565ad2d 100644 --- a/l10n_ar_stock/models/stock_picking.py +++ b/l10n_ar_stock/models/stock_picking.py @@ -74,7 +74,7 @@ def get_arba_file_data( raise UserError(_( 'Los remitos seleccionados deben pertenecer a la misma ' 'compañía')) - cuit = company.partner_id.ensure_vat() + cuit = self._context.get('force_arba_cuit') or company.partner_id.ensure_vat() cuit_carrier = carrier_partner.ensure_vat() if cuit_carrier == cuit and not patente_vehiculo: @@ -248,7 +248,7 @@ def get_arba_file_data( cuit, # ORIGEN_RAZON_SOCIAL - company.name[:50], + self._context.get('force_arba_name') or company.name[:50], # EMISOR_TENEDOR: 0=no, 1=si # TODO implementar diff --git a/l10n_ar_stock/views/stock_book_views.xml b/l10n_ar_stock/views/stock_book_views.xml index 0369bfa..b13090c 100644 --- a/l10n_ar_stock/views/stock_book_views.xml +++ b/l10n_ar_stock/views/stock_book_views.xml @@ -11,6 +11,7 @@ +