Skip to content

Commit 0d451de

Browse files
committed
[FIX] l10n_ar_stock_ux: fix + minor improvements
1. arreglamos el if de calculo de barcode 2. pasamos a depender de declared value. Lo definimos así porque: a) si bien no es obligatorio el dato, por uso y costumbre se usa un montón b) además que si no para mandar un valor a COT deberíamos hacer un chino c) eventualmente el declared value podría estar como campo en stock_ux y todo el cálculo automático en módulo separado (y extra?)
1 parent 040b82e commit 0d451de

6 files changed

Lines changed: 17 additions & 15 deletions

File tree

l10n_ar_stock_delivery/views/report_deliveryslip.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<template id="report_delivery_document" inherit_id="l10n_ar_stock_ux.report_delivery_document">
44

55
<t name="number_of_packages" position="after">
6-
<span t-if="o._fields.get('number_of_packages') and o.number_of_packages and o.weight"> - </span>
6+
<span t-if="o.number_of_packages and o.weight"> - </span>
77
<t t-if="o.weight">
8-
<br t-if="o._fields.get('number_of_packages') and not o.number_of_packages"/><strong>Weight:</strong>
8+
<br t-if="not o.number_of_packages"/><strong>Weight:</strong>
99
<span t-field="o.weight"/>
1010
<span t-field="o.weight_uom_name"/>
1111
</t>

l10n_ar_stock_ux/__manifest__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"l10n_ar_stock",
1111
"l10n_ar_ux",
1212
"stock_picking_invoice_link",
13+
"stock_ux",
14+
# esta dependencia es solo por el campo declared value para:
15+
# a) reporte de remito
16+
# b) mandar valor declarado a wizard de COT
17+
# eventualmente se podría moer dicho campo a stock_ux y evitar esta dependencia
18+
"stock_declared_value",
1319
],
1420
"data": [
1521
"security/res_groups.xml",

l10n_ar_stock_ux/models/stock_picking.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import datetime
22
import logging
3-
import re
43
import xml.etree.ElementTree as ET
54

65
import requests
@@ -86,19 +85,16 @@ def _compute_l10n_ar_afip_barcode(self):
8685
for rec in self:
8786
barcode = False
8887
if (
89-
rec.picking_type_id.l10n_ar_sequence_id.prefix and rec.l10n_ar_cai_data["cai_expiration_date"]
90-
if rec.l10n_ar_cai_data
91-
else rec.picking_type_id.l10n_ar_cai_expiration_date and rec.l10n_ar_cai_data["cai_authorization_code"]
92-
if rec.l10n_ar_cai_data
93-
else rec.picking_type_id.l10n_ar_cai_authorization_code
94-
# TODO REVISAR
95-
# and not rec.picking_type_id.lines_per_voucher
88+
rec.l10n_ar_delivery_guide_number
89+
and rec.document_type_id
90+
and rec.l10n_ar_cai_data
91+
and "cai_expiration_date" in rec.l10n_ar_cai_data
92+
and "cai_authorization_code" in rec.l10n_ar_cai_data
9693
):
9794
cae_due = rec.l10n_ar_cai_data["cai_expiration_date"].strftime("%Y%m%d")
9895
pos_number = self.env["account.move"]._l10n_ar_get_document_number_parts(
9996
rec.l10n_ar_delivery_guide_number, rec.document_type_id.code
10097
)["point_of_sale"]
101-
pos_number = int(re.sub("[^0-9]", "", rec.picking_type_id.l10n_ar_sequence_id.prefix))
10298
barcode = "".join(
10399
[
104100
str(rec.picking_type_id.report_partner_id.l10n_ar_vat or rec.company_id.partner_id.l10n_ar_vat),

l10n_ar_stock_ux/views/report_deliveryslip.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@
172172
<strong>Customer Reference:</strong>
173173
<span t-field="o.sudo().sale_id.client_order_ref"/>
174174
</t>
175-
<t t-if="o._fields.get('declared_value') and o.declared_value">
175+
<t t-if="o.declared_value">
176176
<br/>
177177
<strong>Declared Value:</strong>
178178
<span t-field="o.declared_value"/>
179179
</t>
180-
<t name="number_of_packages" t-if="o._fields.get('number_of_packages') and o.number_of_packages">
180+
<t name="number_of_packages" t-if="o.number_of_packages">
181181
<br/>
182182
<strong>Packages Qty:</strong>
183183
<span t-field="o.number_of_packages"/>

l10n_ar_stock_ux/views/stock_picking_views.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
<attribute name="invisible">True</attribute>
3838
</button>
3939
<button name="do_print_picking" position="after">
40-
<button name="%(action_arba_cot_wizard)d" string="Obtener COT (BETA)"
40+
<button name="%(action_arba_cot_wizard)d" string="Obtener COT"
4141
help="Obtener Código de Operaciones de Traslado (ARBA / Santa Fe)"
42+
context="{'default_importe': declared_value}"
4243
type="action"
4344
invisible="not l10n_ar_allow_send_delivery_guide or picking_type_code == 'incoming' or state != 'done' or cot"
4445
groups="l10n_ar_stock_ux.arba_cot_enabled"/>

l10n_ar_stock_ux/wizards/arba_cot_wizard.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class ArbaCotWizard(models.TransientModel):
3636
default="0",
3737
required=True,
3838
)
39-
# TODO implementar asistente de importe
4039
importe = fields.Float(
4140
string="Importe Neto",
4241
)

0 commit comments

Comments
 (0)