You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Jonatan Soto <se...@gmail.com> on 2010/07/01 17:57:45 UTC

Multiple internal organizations on top

Hi all,

I have a few doubts on how Ofbiz handles internal organizations. My business
logic needs to setup two internal organizations at the top level. One is the
responsible for B2C operations (company1) and the other for B2B operations
(company2). Company1 has to purchase products from Company2 and then
Company2 has to replicate and split the PO to different providers. So
Company2 acts as a supplier of Company1. I did the following steps:

1. Create catalog1 for company1 (B2C web sales purposes)
2. Create catalog2 for company2 with exactly the same products (B2B)
3. Create a party1 and set up a relationship as employee to company2.
4. Create store1 for company1 with catalog1
5. Create store2 for company2 with catalog2

When I log in using party1 I'm able to see all catalogs and change the
default organization.  So the question is, how can I restrict the  access
and actions that belongs to a specific organization?
Note that I checked the code and I found some files (eg.
CatalogScreens.xml#FindProdCatalog) where I would be able to insert specific
business logic, but I don't know if it is possible to configure that without
touching the code.

Any suggestions/ideas of how to do it are very welcome.

Thanks in advance.

-----

Jonatan Soto

Re: Multiple internal organizations on top

Posted by David-DiSiD Technologies <dc...@disid.com>.
Answered inline.


jonatan soto wrote:
> 
> I think I was absolutely wrong about this. As I can see, I believe the
> default database might be used as normal. So I am thinking to use the
> default database for Company1 and only one tenant for Company2. It would
> be
> correct?
> 

Yes, it's right in your scenario.
Just note that the database for Company1 will contain the tenant data.


jonatan soto wrote:
> 
> And again a new doubt raised, how can I synchronize data between
> databases?
> I mean, there are several tables that I would like to synchronize (eg:
> Product) so perhaps a good approach would be, firstly identify which
> entities should be sync and then implement something (SECA's?) for each.
> Is
> this a good solution or I am complicating myself?
> 

Yes, I think for this purpose a good approach is to use SECA's, just recall
the same event changing the delegator.

-----
David Cervera - dcervera at disid dot com
DiSiD Technologies, S.L. - http://www.disid.com
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Multiple-internal-organizations-on-top-tp2275366p2290013.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Multiple internal organizations on top

Posted by Jonatan Soto <se...@gmail.com>.
Answering to myself....

On Thu, Jul 15, 2010 at 10:02 AM, Jonatan Soto <se...@gmail.com>wrote:

> Actually that's what I have done for now. What I need is to load different
> ext data to each tenant. So I am thinking if it is possible to create a
> different reader (eg: ext_Company1, ext_Company2).
>

It's done. Is was really easy, I had only to create a new entity-data-reader
in entityengine.xml and then split/adapt my existing ext data changing the
reader-name of every ofbiz-component.xml file that I've previously defined.
I guess I misunderstood the post I mentioned before where BJ was discussing
a similar situation.


>
> I also have another doubt related to the databases needed. As I followed
> the multitenancy support specified on the wiki I've created  a normal
> database (default), and the tetants databases (DEMO1, DEMO2). I understand
> that the default database is only necessary to store the tenants
> information, so I think it's mandatory to create it. Is that right? In that
> case, may I only create the default database specifying only
> the group-name="org.ofbiz.tenant" in the delegator?
>

I think I was absolutely wrong about this. As I can see, I believe the
default database might be used as normal. So I am thinking to use the
default database for Company1 and only one tenant for Company2. It would be
correct?

And again a new doubt raised, how can I synchronize data between databases?
I mean, there are several tables that I would like to synchronize (eg:
Product) so perhaps a good approach would be, firstly identify which
entities should be sync and then implement something (SECA's?) for each. Is
this a good solution or I am complicating myself?


>
> Thanks a lot for your support!
>
>
> On Thu, Jul 15, 2010 at 9:13 AM, David-DiSiD Technologies <
> dcervera@disid.com> wrote:
>
>>
>> Hi Jonatan,
>>
>> You can load your own data (ext data) into a tenant database executing the
>> next command in $OFBIZ_HOME:
>>
>>
>>    java -Xmx512m -XX:MaxPermSize=128m -jar ofbiz.jar -install -readers=ext
>> -delegator=default#${tenantId}
>>
>>
>> Where ${tenantId} is the ID of the tenant where you want to load your
>> data.
>>
>> Is this that you need?
>>
>> -----
>> David Cervera - dcervera at disid dot com
>>
>> DiSiD Technologies, S.L. -  http://www.disid.com www.disid.com
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/Multiple-internal-organizations-on-top-tp2275366p2289756.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> -----
>
> Jonatan Soto
>



-- 
-----

Jonatan Soto

Re: Multiple internal organizations on top

Posted by Jonatan Soto <se...@gmail.com>.
Actually that's what I have done for now. What I need is to load different
ext data to each tenant. So I am thinking if it is possible to create a
different reader (eg: ext_Company1, ext_Company2).

I also have another doubt related to the databases needed. As I followed the
multitenancy support specified on the wiki I've created  a normal database
(default), and the tetants databases (DEMO1, DEMO2). I understand that the
default database is only necessary to store the tenants information, so I
think it's mandatory to create it. Is that right? In that case, may I only
create the default database specifying only
the group-name="org.ofbiz.tenant" in the delegator?

Thanks a lot for your support!


On Thu, Jul 15, 2010 at 9:13 AM, David-DiSiD Technologies <
dcervera@disid.com> wrote:

>
> Hi Jonatan,
>
> You can load your own data (ext data) into a tenant database executing the
> next command in $OFBIZ_HOME:
>
>
>    java -Xmx512m -XX:MaxPermSize=128m -jar ofbiz.jar -install -readers=ext
> -delegator=default#${tenantId}
>
>
> Where ${tenantId} is the ID of the tenant where you want to load your data.
>
> Is this that you need?
>
> -----
> David Cervera - dcervera at disid dot com
>
> DiSiD Technologies, S.L. -  http://www.disid.com www.disid.com
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Multiple-internal-organizations-on-top-tp2275366p2289756.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>



-- 
-----

Jonatan Soto

Re: Multiple internal organizations on top

Posted by David-DiSiD Technologies <dc...@disid.com>.
Hi Jonatan,

You can load your own data (ext data) into a tenant database executing the
next command in $OFBIZ_HOME:


    java -Xmx512m -XX:MaxPermSize=128m -jar ofbiz.jar -install -readers=ext
-delegator=default#${tenantId}


Where ${tenantId} is the ID of the tenant where you want to load your data.

Is this that you need?

-----
David Cervera - dcervera at disid dot com

DiSiD Technologies, S.L. -  http://www.disid.com www.disid.com 
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Multiple-internal-organizations-on-top-tp2275366p2289756.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Multiple internal organizations on top

Posted by Jonatan Soto <se...@gmail.com>.
After a little thinking of that I chose the multi tenancy option. But now a
new problem has been raised and it's regarding to data loading. I have my
own data as ext and I want to split/adapt it in order to fill the different
tenants with it.

As I read in another posts I found that this topic was discussed before
http://www.mail-archive.com/user@ofbiz.apache.org/msg27231.html

How can I achieve this? Is there another solutions?


Thanks in advance.


On Fri, Jul 2, 2010 at 1:14 AM, BJ Freeman <bj...@free-man.net> wrote:

> [That's a possible solution. Another one may be to have two running
> instances
>
> of Ofbiz using different DB, I think it will be more versatile because it
> allows me to handle the logic for one company separated to the other and I
> would be able to exchange data  through webservices for example , but the
> work and maintenance is multiplied by two plus the webservice development
> and testing.]
> actually you can create a component that access both db at the same time,
> since the dbs are accessed by delegators. no webservices necessary.
> like when the PO is generated, you add an SECA to call the new component
> code that would add the PO to the other database as an order.
>
> since it is run at system level and not accessed by users it is secure.
>
>
>
> =========================
> BJ Freeman
> http://bjfreeman.elance.com
> Strategic Power Office with Supplier Automation  <
> http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
>
> Systems Integrator-- Glad to Assist
>
> Chat  Y! messenger: bjfr33man
> Linkedin <
> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
> >
>
>
> Jonatan Soto sent the following on 7/1/2010 3:17 PM:
>
>  That's a possible solution. Another one may be to have two running
>> instances
>> of Ofbiz using different DB, I think it will be more versatile because it
>> allows me to handle the logic for one company separated to the other and I
>> would be able to exchange data  through webservices for example , but the
>> work and maintenance is multiplied by two plus the webservice development
>> and testing.
>>
>>
>


-- 
-----

Jonatan Soto

Re: Multiple internal organizations on top

Posted by BJ Freeman <bj...@free-man.net>.
[That's a possible solution. Another one may be to have two running 
instances
of Ofbiz using different DB, I think it will be more versatile because it
allows me to handle the logic for one company separated to the other and I
would be able to exchange data  through webservices for example , but the
work and maintenance is multiplied by two plus the webservice development
and testing.]
actually you can create a component that access both db at the same 
time, since the dbs are accessed by delegators. no webservices necessary.
like when the PO is generated, you add an SECA to call the new component 
code that would add the PO to the other database as an order.

since it is run at system level and not accessed by users it is secure.


=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Jonatan Soto sent the following on 7/1/2010 3:17 PM:
> That's a possible solution. Another one may be to have two running instances
> of Ofbiz using different DB, I think it will be more versatile because it
> allows me to handle the logic for one company separated to the other and I
> would be able to exchange data  through webservices for example , but the
> work and maintenance is multiplied by two plus the webservice development
> and testing.
>


Re: Multiple internal organizations on top

Posted by Jonatan Soto <se...@gmail.com>.
comments inline

On Thu, Jul 1, 2010 at 7:13 PM, BJ Freeman <bj...@free-man.net> wrote:

> lets start with how these companies related tax wise.
>
usually one is the corporation and one is the S corp.
> or One corporation is the Top and the other corporation is a profit center.
> if both companies are related tax wise  then you would setup different
> facility and do stock transfers.
>

In fact Company2 is a kind of a bridge company. It should do:

   - Handle PO's from Company1
   - Treat PO's and generate PO's for different providers. These providers
   and Company2 are located in a different country of Company1 (that's why the
   existence of Company2, because it reduces customs expenses and bureaucracy)
   - Real providers invoice to Company2 and when the merchandise arrive to
   the international carrier facility, Company2 must unify all of them and then
   invoice to Company1.
   - The final invoice should be presented at customs of origin country a
   destination country.


> If the companies are not related tax wise, then the company that supplies
> to company one is a supplier to Company 1.
> you can not run both companies in the same application due to financial
> reporting without heavy modification to the code.
>

I don't need an exhaustive accounting and financial tracking and monitoring
of Company2. I just need to keep the PO and invoices. But I know this way of
doing things is a bit messy.


>
> Company 2has the role of supplier and is selected for each product.
> this is done through the menus for a product at UI level.
>
> This creates a supplier Product link to the product.
>
> A ProductID that can be in many catalogs.
>


It's all done. For now, i have defined two suppliers for each, the real one
as main supplier and Company2 as alternative supplier.


>
> As a note you could run both companies if not related using the multitenacy
> feature just introduced.
> then each company would share the code but have seperate databases.


That's a possible solution. Another one may be to have two running instances
of Ofbiz using different DB, I think it will be more versatile because it
allows me to handle the logic for one company separated to the other and I
would be able to exchange data  through webservices for example , but the
work and maintenance is multiplied by two plus the webservice development
and testing.


>
>
> =========================
> BJ Freeman
> http://bjfreeman.elance.com
> Strategic Power Office with Supplier Automation  <
> http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
>
> Systems Integrator-- Glad to Assist
>
> Chat  Y! messenger: bjfr33man
> Linkedin <
> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
> >
>
>
> Jonatan Soto sent the following on 7/1/2010 8:57 AM:
>
>  Hi all,
>>
>> I have a few doubts on how Ofbiz handles internal organizations. My
>> business
>> logic needs to setup two internal organizations at the top level. One is
>> the
>> responsible for B2C operations (company1) and the other for B2B operations
>> (company2). Company1 has to purchase products from Company2 and then
>> Company2 has to replicate and split the PO to different providers. So
>> Company2 acts as a supplier of Company1. I did the following steps:
>>
>> 1. Create catalog1 for company1 (B2C web sales purposes)
>> 2. Create catalog2 for company2 with exactly the same products (B2B)
>> 3. Create a party1 and set up a relationship as employee to company2.
>> 4. Create store1 for company1 with catalog1
>> 5. Create store2 for company2 with catalog2
>>
>> When I log in using party1 I'm able to see all catalogs and change the
>> default organization.  So the question is, how can I restrict the  access
>> and actions that belongs to a specific organization?
>> Note that I checked the code and I found some files (eg.
>> CatalogScreens.xml#FindProdCatalog) where I would be able to insert
>> specific
>> business logic, but I don't know if it is possible to configure that
>> without
>> touching the code.
>>
>> Any suggestions/ideas of how to do it are very welcome.
>>
>> Thanks in advance.
>>
>> -----
>>
>> Jonatan Soto
>>
>>
>
BTW, what's exactly the purpose of changing the default organization? It
would be a very tedious task to use this for my custom implementation?

Thanks a lot for your time BJ.
-----

Jonatan Soto

Re: Multiple internal organizations on top

Posted by BJ Freeman <bj...@free-man.net>.
lets start with how these companies related tax wise.
usually one is the corporation and one is the S corp.
or One corporation is the Top and the other corporation is a profit center.
if both companies are related tax wise  then you would setup different 
facility and do stock transfers.

If the companies are not related tax wise, then the company that 
supplies to company one is a supplier to Company 1.
you can not run both companies in the same application due to financial 
reporting without heavy modification to the code.

Company 2has the role of supplier and is selected for each product.
this is done through the menus for a product at UI level.

This creates a supplier Product link to the product.

A ProductID that can be in many catalogs.

As a note you could run both companies if not related using the 
multitenacy feature just introduced.
then each company would share the code but have seperate databases.

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin 
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Jonatan Soto sent the following on 7/1/2010 8:57 AM:
> Hi all,
>
> I have a few doubts on how Ofbiz handles internal organizations. My business
> logic needs to setup two internal organizations at the top level. One is the
> responsible for B2C operations (company1) and the other for B2B operations
> (company2). Company1 has to purchase products from Company2 and then
> Company2 has to replicate and split the PO to different providers. So
> Company2 acts as a supplier of Company1. I did the following steps:
>
> 1. Create catalog1 for company1 (B2C web sales purposes)
> 2. Create catalog2 for company2 with exactly the same products (B2B)
> 3. Create a party1 and set up a relationship as employee to company2.
> 4. Create store1 for company1 with catalog1
> 5. Create store2 for company2 with catalog2
>
> When I log in using party1 I'm able to see all catalogs and change the
> default organization.  So the question is, how can I restrict the  access
> and actions that belongs to a specific organization?
> Note that I checked the code and I found some files (eg.
> CatalogScreens.xml#FindProdCatalog) where I would be able to insert specific
> business logic, but I don't know if it is possible to configure that without
> touching the code.
>
> Any suggestions/ideas of how to do it are very welcome.
>
> Thanks in advance.
>
> -----
>
> Jonatan Soto
>