Skip to content

[FIX] l10n_ar_website_sale_ux: fix AR responsibility field hidden for new customers#461

Closed
JrAdhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-120471-jr
Closed

[FIX] l10n_ar_website_sale_ux: fix AR responsibility field hidden for new customers#461
JrAdhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-120471-jr

Conversation

@JrAdhoc

@JrAdhoc JrAdhoc commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Problem

When a new customer (no ARCA responsibility type set) reached the billing address step in the website checkout, the ARCA Responsibility field was hidden and could not be filled in. Since the field is mandatory for AR companies, the checkout would fail.

Root cause

PR #452 added and responsibility to the outer t-if condition as a workaround for an AttributeError: 'bool' object has no attribute 'name' in a client's database. This condition hides the entire div when the partner has no responsibility set (empty recordset = falsy), creating a catch-22: the field is mandatory, but it's hidden so it can never be filled.

Additionally, the add/separator approach used in #452 kept res_company.country_id.code == 'AR' in the evaluated expression, which is the original variable that may not be available in QWeb context for all users (fixed correctly in #450 by switching to request.env.company).

Fix

Two changes in the same template:

  1. Restore the t-if replacement approach (as in [ADD] l10n_ar_website_sale_ux: add portal address templates for company checkout fix #450): set the attribute directly instead of appending, so res_company is no longer evaluated and the div is visible for all billing forms in AR companies regardless of whether responsibility is already set.

  2. Guard responsibility.name in the read-only branch: add a safe expression responsibility and responsibility.name or '' on the t-else paragraph to handle cases where responsibility is a bool False instead of a recordset.

Test plan

  • New customer with no ARCA responsibility: the responsibility select should be visible at the billing address step and fillable.
  • Existing customer with responsibility set: the field displays the current value correctly.
  • Existing customer who cannot edit (has issued documents): the read-only paragraph renders without error even if responsibility is unset.

… new customers

- Replace t-if attribute (instead of adding to it) so res_company is not
  evaluated in QWeb context where it may be absent for some users.
- Remove 'and responsibility' condition that hid the div when partner had
  no responsibility set, preventing new customers from filling a mandatory
  field and completing checkout.
- Add a second xpath to guard responsibility.name in the read-only branch
  against a bool False value.
Copilot AI review requested due to automatic review settings June 12, 2026 16:19
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the AR-specific responsibility section in the portal address form to avoid missing-context errors and to safely render when the partner has no responsibility set.

Changes:

  • Replace res_company usage with request.env.company in the AR billing block condition.
  • Guard responsibility.name rendering to avoid failures when responsibility is falsy.
  • Expand/clarify the intent via an updated XML comment.

Comment thread l10n_ar_website_sale_ux/views/portal_address_templates.xml
Comment thread l10n_ar_website_sale_ux/views/portal_address_templates.xml

@zaoral zaoral left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the PR @JrAdhoc!
@roboadhoc bump r+

roboadhoc pushed a commit that referenced this pull request Jun 12, 2026
… new customers

- Replace t-if attribute (instead of adding to it) so res_company is not
  evaluated in QWeb context where it may be absent for some users.
- Remove 'and responsibility' condition that hid the div when partner had
  no responsibility set, preventing new customers from filling a mandatory
  field and completing checkout.
- Add a second xpath to guard responsibility.name in the read-only branch
  against a bool False value.

closes #461

Signed-off-by: Katherine Zaoral - kz (#l10n) <kz@adhoc.com.ar>
@roboadhoc roboadhoc closed this in b4f905f Jun 12, 2026
roboadhoc added a commit that referenced this pull request Jun 12, 2026
@roboadhoc roboadhoc deleted the 19.0-h-120471-jr branch June 12, 2026 19:48
@roboadhoc roboadhoc added the 18.1 label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants