OCA / field-service

Field Service Management
https://odoo-community.org/psc-teams/field-service-126
GNU Affero General Public License v3.0
148 stars 241 forks source link

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

Open are-agilebg opened 8 months ago

are-agilebg commented 8 months ago

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:

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.

pcastelovigo commented 5 months ago

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

qupro commented 5 months ago

Same happens with Workers

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?

houzefa-abba commented 4 months ago

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 commented 4 months ago

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

pcserviceshn commented 4 months ago

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.

pleirb commented 4 months ago

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

pleirb commented 4 months ago

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"/>

qupro commented 4 months ago

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.