diff --git a/l10n_ar_ux/__manifest__.py b/l10n_ar_ux/__manifest__.py
index 8711eb7b4..fcc569e49 100644
--- a/l10n_ar_ux/__manifest__.py
+++ b/l10n_ar_ux/__manifest__.py
@@ -1,6 +1,6 @@
{
'name': 'Argentinian Accounting UX',
- 'version': "16.0.1.11.0",
+ 'version': "16.0.1.12.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
diff --git a/l10n_ar_ux/controllers/portal.py b/l10n_ar_ux/controllers/portal.py
index 1a0038bfd..435ab0ee0 100644
--- a/l10n_ar_ux/controllers/portal.py
+++ b/l10n_ar_ux/controllers/portal.py
@@ -17,7 +17,6 @@ class L10nArCustomerPortal(CustomerPortal):
def details_form_validate(self, data):
""" When adding either document_type or document_number, this two should be setted """
error, error_message = super().details_form_validate(data)
-
vat = data.get('vat')
identification_type = data.get('l10n_latam_identification_type_id')
if identification_type and not vat:
@@ -32,15 +31,32 @@ def details_form_validate(self, data):
error_message.extend(write_message)
return error, error_message
+ def values_preprocess_ar(self, values):
+ new_values = dict()
+ partner_fields = request.env['res.partner']._fields
+
+ for k, v in values.items():
+ # Convert the values for many2one fields to integer since they are used as IDs
+ if k in partner_fields and partner_fields[k].type == 'many2one':
+ new_values[k] = bool(v) and int(v)
+ # Store empty fields as `False` instead of empty strings `''` for consistency with other applications like
+ # Contacts.
+ elif v == '':
+ new_values[k] = False
+ else:
+ new_values[k] = v
+
+ return new_values
+
@route()
def account(self, redirect=None, **post):
+
if post:
error, _error_message = self.details_form_validate(post)
- if not error:
- post.pop('commercial_partner_id', False)
- post.pop('vat', False)
- post.pop('l10n_latam_identification_type_id', False)
- post.pop('l10n_ar_afip_responsibility_type_id', False)
+
+ #Procesamos los datos del post para asignar correctamente los valores de los campos many2one
+ if post and request.httprequest.method == 'POST':
+ post = self.values_preprocess_ar(post)
response = super().account(redirect=redirect, **post)
identification_types = request.env['l10n_latam.identification.type'].sudo().search([])
@@ -48,8 +64,12 @@ def account(self, redirect=None, **post):
uid = request.session.uid
partner = request.env['res.users'].browse(uid).partner_id if uid else request.env['res.partner']
partner = partner.with_context(show_address=1).sudo()
+
response.qcontext.update({
+ 'afip_responsibility': post.get('l10n_ar_afip_responsibility_type_id'),
+ 'identification_type': post.get('l10n_latam_identification_type_id'),
'identification_types': identification_types,
'afip_responsibilities': afip_responsibilities,
- 'partner': partner})
+ 'partner': partner,
+ 'partner_can_edit_vat': partner.can_edit_vat()})
return response
diff --git a/l10n_ar_ux/views/portal_templates.xml b/l10n_ar_ux/views/portal_templates.xml
index b9c52b57a..62828f1da 100644
--- a/l10n_ar_ux/views/portal_templates.xml
+++ b/l10n_ar_ux/views/portal_templates.xml
@@ -19,7 +19,7 @@
-
+
@@ -27,7 +27,7 @@