On 2017-09-14 14:24, Roei Erez wrote:
> In our application we have Patient model, which has a lot in common with Party model.
> We would like to add a tree view for patient and add a menu item.
> We would also like to create a dedicated form for adding/editing Patients.
> It seems like there are two ways to achieve that but we have problems in either ways:
>
> 1. Patient inherit from Party - we are able to enhance the party model with the Patient fields but we didn't find a way to customize the form for Patient that will show the added Patient fields and only some of the fields (the relevant ones) from Party model.
Just create a new view and use it for the action that opens only the
patient.
You can also update the Many2One widgets of other Model with the
attribute view_ids to use this new view.
This option could be a lot of work if you have many view to customize.
And other option is to make good usage of the 'states' to make extend
the standard view and show "patient" fields only when it is a patient.
> 2. Patient contains Party - This enables us to customize the Patient form but then the creation of a new Patient requires two steps: create a party and then add the Patient specific fields which make user experience less optimal.
This is a good option too. It is what we have choosen for many cases:
product-template, carrier-party, bank-party, employee-party,
company-party etc.
In the case of patient, I guess you will have to add a unique constraint
to ensure a party has only one patient.
--
Cédric Krier - B2CK SPRL
Email/Jabber:
cedric...@b2ck.com
Tel:
+32 472 54 46 59
Website:
http://www.b2ck.com/