OCA/edi

account_invoice_facturx: Mandatory country issue

houzefa-abba opened this issue · 7 comments

Hi, funky issue stemming from mandatory country in partner view in the account_invoice_facturx module:

From a company partner that does not have a country (this is the default case), one cannot add a contact because the country field is required in that contact creation form; but the country field itself is invisible (only visible for address creations).

To reproduce:

  • Invoicing > Customers > New > Set a name & save
  • Contacts & Addresses > Add > Select "Contact" > Set a name & save

Screenshot at 2023-09-25 15-04-40

What would be the right solution?

  • Mandatory country on all partners (view-side only ofc)
  • Mandatory country on addresses but not individual contacts, although this means we'd be open to Factur-X errors should that contact be invoiced itself
  • Default country selection system during Factur-X generation

cc @alexis-via @legalsylvain if you have some input on this please

For me, the right solution is your first option : Mandatory country on all partners (view-side only). This is what is implemented in account_invoice_facturx (and we have the same in intrastat_base). Maybe we missed some partner views and we should inherit an additional view...

Works for me, so this means we need to display the country field in that partner pop-up in my screenshot - country is available in address forms but not when selecting the first radio button "Contact"

If the country is set on the parent partner, it should automatically be set on the children contact (via default_country_id in the context of child_ids). So I'm very surprised by your bug.

Ahh good point! Ok so the actual problem is I can create a contact without country (zs1 in my screenshot)

I managed to reproduce the issue ; it happens when you create a partner and a child at the same time (without saving in between). If you haven't set the country_id field on the parent partner and you start to create the child with type=contact, then you can't close the child. I think a solution would be to set the field as required on the child only when the country_id field is visible. Then, when you save the parent partner, you will be blocked by the fact that you haven't set the country_id field on the parent ; then you set it, and odoo should sync the address between parent and child, which includes the country_id field (to be verified/tested).

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.