diff --git a/l10n_ar_ux/__manifest__.py b/l10n_ar_ux/__manifest__.py
index bb78d410a..7467e4d6d 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.13.0",
+ 'version': "16.0.1.14.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..997a16942 100644
--- a/l10n_ar_ux/controllers/portal.py
+++ b/l10n_ar_ux/controllers/portal.py
@@ -32,15 +32,28 @@ def details_form_validate(self, data):
error_message.extend(write_message)
return error, error_message
+ def values_preprocess_ar(self, values):
+ """ We preprocess the ar-post data to ensure the correct assignment of many2one fields."""
+ new_values = dict()
+ partner_fields = request.env['res.partner']._fields
+ ar_camp = ['l10n_ar_afip_responsibility_type_id', 'l10n_latam_identification_type_id', 'commercial_partner_id']
+
+ 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 k in ar_camp and partner_fields[k].type == 'many2one':
+ new_values[k] = bool(v) and int(v) or False
+
+ 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.update(self.values_preprocess_ar(post))
response = super().account(redirect=redirect, **post)
identification_types = request.env['l10n_latam.identification.type'].sudo().search([])
@@ -49,7 +62,10 @@ def account(self, redirect=None, **post):
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_respo_type': post.get('l10n_ar_afip_responsibility_type_id') or partner.l10n_ar_afip_responsibility_type_id.id,
+ 'latam_ident_type': post.get('l10n_latam_identification_type_id') or partner.l10n_latam_identification_type_id.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..d091bc90e 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 @@