Custom Party form

47 views
Skip to first unread message

Roei Erez

unread,
Sep 14, 2017, 5:45:07 PM9/14/17
to tryton
Hi all,

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.

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.

Would appreciate any opinion on what is a better attitude and if I am missing something here.

Cédric Krier

unread,
Sep 15, 2017, 1:25:07 PM9/15/17
to tryton
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/

Roei Erez

unread,
Sep 15, 2017, 4:25:07 PM9/15/17
to tryton
Thanks a lot!
I am glad option 1 is possible. Regarding "using the new view for the action that opens only the patient" one quick question:
I have an entry in the menu that opens tree view of patients.
How do I make the "new" action at that view to open the patient form?

Cédric Krier

unread,
Sep 15, 2017, 4:39:33 PM9/15/17
to tryton
On 2017-09-15 13:04, Roei Erez wrote:
> I am glad option 1 is possible. Regarding "using the new view for the action that opens only the patient" one quick question:
> I have an entry in the menu that opens tree view of patients.
> How do I make the "new" action at that view to open the patient form?

You must link the right form view to the action.
Reply all
Reply to author
Forward
0 new messages