Hi guys, Thanks to you both: you saved my day. I was struggling to understand getpaid to have it work with a basic tax system; your posts didn't just help me: you made all the work for me.
THanks thanks thanks I owe you. Marc On Jul 23, 7:07 am, Darryl Dixon <[email protected]> wrote: > Hannes, > > You are very welcome, I'm glad to have been able to provide some small > practical assistance. > > regards, > Darryl Dixon > Winterhouse Consulting Ltdhttp://www.winterhouseconsulting.com > > On Thu, Jul 23, 2009 at 5:02 PM, Hannes Calitz <[email protected]> wrote: > > Darryl, I have to thank you for the help in this matter. I took your code, > > edited it, and it worked once off. Again, thank you SO much. > > > 2009/7/22 Hannes Calitz <[email protected]> > > > Awesome thanks. This really has helped a lot. > > >> 2009/7/22 Darryl Dixon <[email protected]> > > >>> I created mine as an egg, 'getpaid.gst' which is probably what you also > >>> want to do. If I recall correctly, I made the basic structure with > >>> Paster's > >>> 'basic namespace package' or similar (eg: python-2.4.5/bin/paster create > >>> basic_namespace). Then add it to your buildout as a development egg. Erm, > >>> if > >>> you aren't too familiar with buildout then you may be in for a little bit > >>> of > >>> a learning curve... :-/ > > >>> D > > >>> On Wed, Jul 22, 2009 at 5:38 PM, Hannes Calitz <[email protected]>wrote: > > >>>> Sweet. Thanks Darryl > > >>>> As I have never started a plug in from scratch (I have always just > >>>> copied an existing plug in and edited it), I don't quite know where to > >>>> start. Would I just create a normal Plone Product and add these two > >>>> files to > >>>> it? > > >>>> 2009/7/22 Darryl Dixon <[email protected]> > > >>>> Hi Hannes, > > >>>>> This is/should be relatively straightforward. In NZ we have a flat GST > >>>>> regime of 12.5% and I wrote a tax plugin to add this to all orders. It > >>>>> was > >>>>> only very small. I don't know if my way was 'right' but It Works For > >>>>> Me(tm) > > >>>>> dix...@ganymede:~/src/getpaid.gst/getpaid/gst$ cat overrides.zcml > >>>>> <configure xmlns="http://namespaces.zope.org/zope"> > > >>>>> <!-- Taxes --> > >>>>> <utility factory=".tax.TaxUtility" /> > > >>>>> </configure> > > >>>>> dix...@ganymede:~/src/getpaid.gst/getpaid/gst$ cat tax.py > >>>>> import decimal > >>>>> from zope.interface import implements > > >>>>> from getpaid.core.interfaces import ITaxUtility > > >>>>> from getpaid.gst import getpaidgstMessageFactory as _ > > >>>>> class TaxUtility(object): > >>>>> implements(ITaxUtility) > > >>>>> def getCost(self, order): > >>>>> """Calculate GST at 12.5% on the subtotal and any shipping > >>>>> costs""" > >>>>> return float(order.getSubTotalPrice() + > >>>>> order.getShippingCost()) * self.tax_rate > > >>>>> def getTaxes(self, order): > >>>>> return [{'value' : self.getCost(order), 'name' : > >>>>> self.tax_name}] > > >>>>> def getTaxOnSum(self, sum): > >>>>> """Return the GST value of a price, rounded to the nearest > >>>>> cent""" > >>>>> return float('%.2f' % (sum * self.tax_rate)) > > >>>>> @property > >>>>> def tax_rate(self): > >>>>> return 0.125 > > >>>>> @property > >>>>> def tax_name(self): > >>>>> return _(u"GST") > > >>>>> dix...@ganymede:~/src/getpaid.gst/getpaid/gst$ cat __init__.py > > >>>>> from zope.i18nmessageid import MessageFactory > > >>>>> getpaidgstMessageFactory = MessageFactory('getpaid.gst') > > >>>>> Hope this helps, > > >>>>> regards, > >>>>> Darryl Dixon > >>>>> Winterhouse Consulting Ltd > >>>>>http://www.winterhouseconsulting.com > > >>>>> On Wed, Jul 22, 2009 at 5:11 PM, hannesc <[email protected]> wrote: > > >>>>>> I need to start developing some sort of Tax add-on for GetPaid, and by > >>>>>> the look of things, it seems that just perhaps I will have to dive > >>>>>> into the PloneGetPaid code itself. What I basically need to start > >>>>>> developing is a plugin that adds 14% VAT to all orders. > > >>>>>> Before I start working on such a plugin, I wanted to know if anyone > >>>>>> has already started something similar that I could perhaps look at > >>>>>> before starting on a something from scratch. > > >>>>>> Thanks > >>>>>> Hannes --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "getpaid-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/getpaid-dev?hl=en -~----------~----~----~----~------~----~------~--~---
