On 17 Jan 21:45, NotZippy wrote:
> 
> 
> On Saturday, 17 January 2015 18:23:01 UTC-8, Mark Hayden wrote:
> >
> >
> > On 17 Jan 2015 18:05, "NotZippy" <[email protected] <javascript:>> wrote:
> > >
> > > Hi
> > >
> > > This topic was touched in a very long thread here 
> > https://groups.google.com/forum/#!msg/tryton/MgFedysKKFQ/20jh4pAXgMIJ 
> > specifically the message from Cédric Krier 
> > >
> > > I don't think list price should be moved to variant but more the 
> > > possibility to add an extra per variant. And this is very, very easy to 
> > > do now because the design was thought for that. 
> > >
> > > How might this be implemented, so that existing modules respect this ? 
> > From what I can see the sales module calls Product.get_sale_price, which 
> > pulls the price from product.list_price, how can that be changed or 
> > intercepted ?
> >
> > It seems the most logical place would be to make a module to override 
> > Product.get_sale_price.  The sale price can be altered from the 
> > product.list_price  for various reasons, and that is probably where it is 
> > best done perhaps? It could be done in sales  but you might want a sale 
> > prices outside the context of a sale, for example when generating product 
> > pages of an online store.
> >
> >
> > Appreciate your response I think the direction I want to go is to modify 
> the list_price returned by the product. From what I see I can specify a 
> product has this attribute by defining the following 
> 
> class Product:
>     __name__ = "product.product"
>     list_price = fields.Function(fields.Numeric('List Price',
>         digits=(16, 4)), 'get_product_list_price')
> 
>     @classmethod
>     def get_product_list_price(product, pool,trytonid):
>         print "Get product {0} second {1} third {2}".format(product, 
> pool,trytonid)
>         return 666
> 
> 
> Now at this point I want to check the product attributes (module) to see if 
> an attribute for the list_price is defined for the product, if not then 
> return the product templates list price.

This sounds wrong to use attribute for that. You should probably add a
field (extra_cost) on product.product that will be added to the template
list_price.


-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Reply via email to