Skip to content

Commit

Permalink
[IMP] l10n_ar_stock: add the possibility of force arba cuit and password
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelZilli committed Nov 22, 2022
1 parent 763bb4c commit 2bfbbe3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions l10n_ar_stock/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(_(
Expand All @@ -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' % (
Expand Down
4 changes: 4 additions & 0 deletions l10n_ar_stock/models/stock_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)
4 changes: 2 additions & 2 deletions l10n_ar_stock/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -248,7 +248,7 @@ def get_arba_file_data(
cuit,

# ORIGEN_RAZON_SOCIAL
company.name[:50],
self._context.get('force_arba_name')[:50] or company.name[:50],

# EMISOR_TENEDOR: 0=no, 1=si
# TODO implementar
Expand Down
1 change: 1 addition & 0 deletions l10n_ar_stock/views/stock_book_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<field name="l10n_ar_cai_due" attrs="{'invisible': [('lines_per_voucher', '!=', 0)]}"/>
<field name="report_partner_id"/>
<field name="report_signature_section"/>
<field name="arba_cot" attrs="{'invisible': [('report_partner_id', '==', False)]}"/>
</field>
</field>
</record>
Expand Down

0 comments on commit 2bfbbe3

Please sign in to comment.