field-service icon indicating copy to clipboard operation
field-service copied to clipboard

fsm_location.partner_id field in form view prevents creation when debug is active

Open are-agilebg opened this issue 11 months ago • 8 comments

Hi,

I have found this strage behavior in the module fieldservice, which affects 15.0 and 16.0 branches (probably even 17.0 but I haven't checked).

Steps to reproduce on Runboat:

  • activate the debug mode (put the debug=1 parameter in the URL, use the browser extension, whatever)
  • go to 'Field Service > Master Data > Locations'
  • click on 'Create'
  • fill 'Name', 'Related Owner' and 'Billed Customer'
  • click on 'Save'

An error will prevent saving the record showing: 'Invalid fields: Related Partner'.

The problem is that the field is readonly=True, required=True and False since it hasn't been created.

This is particularly nasty in instances that uses base_technical_features to always show technical fields even to users without administration privileges.

The same problem cannot exist in version 14.0 which declares the field required=False in the view.

I'm not opening a PR now since I'm afraid I could be missing something: let me know If I'm right at seeing it as a bug or not.

are-agilebg avatar Mar 12 '24 15:03 are-agilebg

confirmed in 15.0 It difficults set up and usage, should we PR remove the read only?

pcastelovigo avatar Jun 12 '24 10:06 pcastelovigo

Same happens with Workers

  • activate the debug mode (put the debug=1 parameter in the URL, use the browser extension, whatever)
  • go to 'Field Service > Master Data > Workers'
  • click on 'Create'
  • fill field 'Name'
  • click on 'Save'

Error 'Invalid fields: Related Partner'.

as @pcastelovigo saids make sense make 'Related Partner' field editable,

if not, how can I link a field service worker with their user (res.user), so that the worker can login and see their work orders, or with the hr_employee?

qupro avatar Jun 12 '24 12:06 qupro

Hi this seems identical to https://github.com/OCA/field-service/pull/1163 which was a fix for 16.0; you could backport it to 15.0

Indeed same problem in the worker form; I did not see it in that initial 16.0 PR (which was only for locations) as I already have a worker form rework in the project I was working on

houzefa-abba avatar Jul 12 '24 14:07 houzefa-abba

https://github.com/OCA/field-service/pull/1164 & https://github.com/OCA/field-service/pull/1165 came right after on 16.0 location partners; could also make sense to backport them to 15.0

houzefa-abba avatar Jul 12 '24 14:07 houzefa-abba

I can confirm it is still present in 16.0.1.7, there are some others fields that are in readonly state, like fsm_location and fsm_person in the res.partner model, those are required to set the customer or employee as worker.

pcserviceshn avatar Jul 20 '24 18:07 pcserviceshn

Same behavior, I can't assign contact to the worker configuration

pleirb avatar Jul 26 '24 16:07 pleirb

El mismo comportamiento, no puedo asignar contacto a la configuración del trabajador.

It's a problem in the fsm.person.form view Just change readonly from 1 to 0 on this line: <field name="partner_id" groups="base.group_no_one" readonly="0"/>

pleirb avatar Jul 26 '24 16:07 pleirb

I have tested @pcastelovigo commits and are ok, but...

Why do these related contact fields only have to be visible in debug mode?

If a non-developer user wants to associate a newly created worker with an existing contact (for example, a company employee), he cannot.

I think it would be better if it worked like the employee app, where there is a field where you can associate an employee with a user without developer mode active.

qupro avatar Jul 30 '24 11:07 qupro