Le 14/01/2015 15:08, Jacopo Cappellato a écrit :
Hi Nicolas,

your definition of the UomConvSource looks good to me; my only concern would be 
that of introducing an entity that duplicates most of the data of 
UomConversionDated; so maybe I would be more inclined to modifying the existing 
UomConversionDated entity as you have described.
Hi Jacopo, you spot exactly the more difficult point on my proposition.
It's easy to change the UomConversionDated's pk :

 uomId *
 uomIdTo *
 fromDate *

To

 uomConversionDatedId *
 uomId
 uomIdTo
 fromDate

Update service and screen is like walk around a grassland in with the sheep.
Create the migration service is funny to complete missing data ... but convert the pk constraint on the database model for existing site ... arf. I can create an sql script and call directly the sql parser, I doubt on the quality and the respect of

{quote https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices}
Deprecating entities
Whenever we deprecate an entity in OFBiz there are certain things that MUST be done or all committers should reject the patch:

1. rename the entity to deprecate by adding an "Old" prefix to it, then
   specify a table-name attribute on the entity so it still points to
   the same table in the database
2. create a new entity the replaces the old one, and comment on that fact
3. Implement a service to move data from the old/deprecated entity to
   the new one

{quote}

With luck, this entity haven't relation fk constraint with other entity.

Clearly I'm not happy to create a new entity with copy/past field, it's a simple and security solution :! , so your suggest is precious to have the better compromise.

I can try to test a migration (but only on derby and postgres)

Nicolas


Jacopo

On Jan 13, 2015, at 4:32 PM, Nicolas Malin <[email protected]> wrote:

Hi,

With the current customer project I need to manage some currency conversion 
rate during a period, a purpose and between two party.
The main case is the Euro company who work with American Supplier and sign a 
agreement exchange rate to stabilize their invoicing and payment instead of 
follow the stock exchange.

At this time the first two has covered by UomConversionDated, but nothing is 
present two indicate what is my currency conversion rate with an other company.

It's easy to solve with Agreement entity, a dedicate agreementTypeId and add an 
assoc entity AgreementUomConversionDatedAppl.
An other problem, it's impossible to define different rate for the same 
currency at the same date like this
uomId uomIdTo fromDate                   rate
     EUR       USD 2015-01-01 00:00:00  1.200 -> use by an agreement between 
MyCompany - Mc Company
     EUR       USD 2015-01-01 00:00:00  1.258 -> use by an agreement between 
MyCompany - Mc Society
     EUR       USD 2015-01-01 00:00:00  1.248 -> use by an agreement between 
MySubsidiaryCompany - Mc Society

My first idea would be move UomConversionDated on single pk 
uomConversionDatedId but I prefer to adding a new entity like :

UomConvSource
  uomConvSourceId *
  uomId
  uomIdTo
  fromDate
  thruDate
  conversionFactor
  customMethodId
  decimalScale
  roundingMode
  purposeEnumId

And :
AgreementUomConvSourceAppl
  agreementId *
  uomConvSourceId *

With this, I will do add helper service to resolve the conversion rate from a 
context with the step :
  * scanning Agreement
  * scanning UomConversionDated
  * scanning UomConversion

Any remarks and suggest are welcome as usual ;)

--
#jeSuisCharlie (et j'emmerde les lobbotomisés)
<siteon0.jpg>
Nicolas Malin
Responsable Interplanétaire de la reproduction des crevettes licorne en 
apesanteur astral
[email protected]
3bis rue des Isles 37270 VERETZ 02 47 50 30 54
Apache OFBiz |  ofbiz-fr |  | réseau LE

Reply via email to