Login  Register

Re: Price Agreements with customers

Posted by cjhowe on Aug 06, 2006; 9:43am
URL: http://ofbiz.116.s1.nabble.com/Price-Agreements-with-customers-tp170273p170278.html

To obtain the benefit of tracking, why not create a
"join" entity between agreement and pricerule.

I did some work a few months ago on making some
business sense specific price rule screens.  I can't
remember if the latest svn has errors in it or not.
I'll update it on Monday.  It's a work in progress but
it's on it's way.

https://sourceforge.net/projects/ezofbiz

I think you'll run into many problems with having
essentially 3 repositories for pricing.  Ideally, I
think it'd be better to consolidate the price rules
and the productPrice logic.  But of all the
hairbrained things I've proposed that's probably the
largest project as far as and individual's work goes
(ie not POC and have a monkey repeat it).

--- Jacopo Cappellato <[hidden email]> wrote:

> Hi Chris,
>
> price rules are not bypassed by this new feature.
> The agreement price (if available) simply overrides
> the default price
> but if there are price rules that apply they will be
> used.
> I agree with you that you could get the same goal
> using price rules, but
> in my opinion they are not well suited for this use
> case, i.e. the setup
> of a custom price list between a customer and the
> company.
> Using price rules this would involve the creation of
> a price rule
> header, price rule condition and price rule action
> for each product in
> the list.
> Also, by using the Agreement data model (that in my
> opinion is a natural
> fit here) it is easier to keep an history of price
> lists ("price list
> 2005", "price list 2006/2007" etc...) by using the
> agreement validity
> dates (and the new feature of copying an agreement
> into a new one).
>
> Jacopo
>
> Chris Howe wrote:
> > Can't this already be done using the price rules?
> > Better screens need to be made, but this
> functionality
> > is there with a lot more flexibility.
> >
> > --- Jacopo Cappellato <[hidden email]> wrote:
> >
> >> Can I go on and commit the patch?
> >>
> >> Jacopo
> >>
> >> Jacopo Cappellato wrote:
> >>> Hi all,
> >>>
> >>> I've implemented a new price list feature that
> can
> >> be used to set up
> >>> price lists for specific customers. It is based
> on
> >> the Agreement data
> >>> model.
> >>> There are only two relevant changes (please see
> >> the attached patch)
> >>> needed, and I'd really love to get your feedback
> >> about them before
> >>> committing:
> >>>
> >>> a) added a new price field to the
> >> AgreementProductAppl entity
> >>> b) added a new optional input parameter,
> >> "agreementId", to the
> >>> calculateProductPrice service; if the
> agreementId
> >> is passed, and if a
> >>> valid price for the product is found in the
> >> AgreementProductAppl entity,
> >>> this price overrides the default price in the
> >> ProductPrice entity.
> >>> Here are the steps needed to test this stuff:
> >>>
> >>> * create an agreement (of type sales) between
> the
> >> Company and the customer
> >>> * create an agreement item of type price list
> for
> >> a given currency
> >>> * associate products to the price list
> (agreement
> >> item) and set the
> >>> price there (this is a new field
> >> AgreementProductAppl.price)
> >>> * when you start a sales order, select the
> >> agreement
> >>> Jacopo
> >>>
> >>>
> >>>
> >
>
------------------------------------------------------------------------
> >>> Index:
> >> applications/party/entitydef/entitymodel.xml
> >
>
===================================================================

> >>> --- applications/party/entitydef/entitymodel.xml
> >> (revision 427048)
> >>> +++ applications/party/entitydef/entitymodel.xml
> >> (working copy)
> >>> @@ -242,6 +242,7 @@
> >>>        <field name="agreementId"
> >> type="id-ne"></field>
> >>>        <field name="agreementItemSeqId"
> >> type="id-ne"></field>
> >>>        <field name="productId"
> >> type="id-ne"></field>
> >>> +      <field name="price"
> >> type="currency-precise"></field>
> >>>        <prim-key field="agreementId"/>
> >>>        <prim-key field="agreementItemSeqId"/>
> >>>        <prim-key field="productId"/>
> >>> Index:
> >
>
applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> >
>
===================================================================
> >>> ---
> >
>
applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> >> (revision 427048)
> >>> +++
> >
>
applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

> >> (working copy)
> >>> @@ -876,6 +876,7 @@
> >>>                    
> >> priceContext.put("prodCatalogId",
> >> this.getProdCatalogId());
> >>>                    
> priceContext.put("webSiteId",
> >> cart.getWebSiteId());
> >>>                    
> >> priceContext.put("productStoreId",
> >> cart.getProductStoreId());
> >>> +                  
> >> priceContext.put("agreementId",
> >> cart.getAgreementId());
> >>>                      Map priceResult =
> >> dispatcher.runSync("calculateProductPrice",
> >> priceContext);
> >>>                      if
> >> (ServiceUtil.isError(priceResult)) {
> >>>                          throw new
> >> CartItemModifyException("There was an error while
> >> calculating the price: " +
> >> ServiceUtil.getErrorMessage(priceResult));
> >>> Index:
> >
>
applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh
> >
>
===================================================================
> >>> ---
> >
>
applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh
> >> (revision 427048)
> >>> +++
> >
>
applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh

> >> (working copy)
> >>> @@ -85,6 +85,7 @@
> >>>          priceContext.put("webSiteId",
> webSiteId);
> >>>          priceContext.put("prodCatalogId",
> >> catalogId);
> >>>          priceContext.put("productStoreId",
> >> productStoreId);
> >>> +        priceContext.put("agreementId",
> >> cart.getAgreementId());
> >>>          priceContext.put("checkIncludeVat",
> "Y");
> >>>          priceMap =
> >> dispatcher.runSync("calculateProductPrice",
> >> priceContext);
> >>>  
> >>> Index:
> >
>
applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
> >
>
===================================================================
> >>> ---
> >
>
applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
> >> (revision 427048)
> >>> +++
> >
>
applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh

> >> (working copy)
> >>> @@ -170,6 +170,7 @@
> >>>          priceContext.put("webSiteId",
> webSiteId);
> >>>          priceContext.put("productStoreId",
> >> productStoreId);
> >>>          priceContext.put("checkIncludeVat",
> "Y");
> >>> +        priceContext.put("agreementId",
> >> cart.getAgreementId());
> >>>          priceMap =
> >> dispatcher.runSync("calculateProductPrice",
> >> priceContext);
> >>>          context.put("priceMap", priceMap);
> >>>      } else {
> >>> Index:
> >
>
applications/product/servicedef/services_pricepromo.xml
>
=== message truncated ===