ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacopo Cappellato <jacopo.cappell...@hotwaxmedia.com>
Subject Re: Party Relationship and Party Roles
Date Sun, 12 Oct 2014 05:09:33 GMT
Hi Mansour,

I will start with one example.
Let's say that in OFBiz we have two companies (i.e. two PartyGroup), "ABC inc" and "CDE inc",
that run two different stores selling goods to their customers; the only way to represent
that a given person "John Black" is customer of "ABC inc", but not of "CDE inc", is using
a party relationship: "John Black is a customer of the seller ABC inc". Now suppose that John
Black is also an employee of "CDE inc"; we can represent it with another party relationship:
"John Black is an employee of the employer CDE inc".
The "party role" entity should be used to specify what are the roles that a party can play.
In our example, for John Black we would have two roles: "customer" and "employee".

Summary:
* "party role": the roles that a given party *can* play
* "party relationship": the actual roles played by a given party (with respect to other parties).

Unfortunately in OFBiz, most of the screens and services are not implemented considering "party
relationships" but only "party roles". This simplification is a weakness of the current implementation.
For example, a screen that lists all the "customers" doesn't make much sense if you don't
specify the company that is selling goods. Currently, if in OFBiz a party has the role of
"customer" then the system considers the party is a customer in all the relationships.

In my opinion we should refactor this by:
a) deprecating the party role entity
b) modify the existing code that is using party roles to use party relationships
c) use an _NA_ party id to specify party relationship that apply to all parties
d) in order to do #b we will need to specify, in most of the applications, the company in
which the logged in user is connected: in this way if a user is associated to "ABC inc", in
the "find customer" screen she will only see parties that are customers of "ABC inc"
e) (optional) normalize the from/to positions in PartyRelationship by sorting them by role
type id (this would simplify lookups etc)

I hope it is useful information and I didn't add more confusion.

Jacopo

On Oct 11, 2014, at 11:57 PM, Mansour Al Akeel <mansour.alakeel@gmail.com> wrote:

> I consulted the Data Model Resource Book to refresh my memory about
> the modelling for the roles and relationship for Party.
> 
> In ofbiz, we have PartyRelationship between two parties. So each party
> ID is used as a key, combined with the relationship type. The book
> mentions on page 42, that when customizing the model, it's recommended
> to draw the relationship between party roles.
> 
> The part that I find confusing is, if we have the two party IDs in the
> party_role entity, why don't we create the relationship between two
> party roles, instead of duplicating the information in the
> party_relationship entity ? For example, currently we have,
> 
> party_relationship:
> - from party id
> - to party id
> - from role type id
> - to role type id
> - start date
> - end date .....
> 
> Can't we just use,
> party_relationship:
> -from role
> - to role
> - party relationship type
> 
> assuming John has the role of developer. IBM has the role of employer.
> We can use the directly in the party relationship. Using the current
> model, we need to add the role_type to the party_relationship. If John
> is no longer a developer, then we need to update in two entities, the
> party_relationship, and the roles.
> 
> I am not sure I understand the description in the book, and the design in ofbiz.
> 
> Can someone kindly clarify the picture for me ??
> 
> Thank you.


Mime
View raw message