Nan,
I think that text documentation is very useful.
A zero tax example is not much helpful. Commands "return 0" do not
make difference between 0 and 100 * 0.
It does not reveal to the reader, whether the matter have been
understand correctly. Example with fixed taxes 5% / 10% inland
clients and 6% / 12% abroad clients or 7% / 14% the product "Egypt
tour" for all clients, this example can be very short and much better
to understand, why can be useful the paramerer product.
-- begin a short inspirative example
from tax.modules.processor import * # this imports also Decimal
without try/else
class Processor(BaseProcessor):
method="YOUR_MODULE_NAME"
def by_price_and_product(self, taxclass, price, product=None):
percent = Decimal(str(product.name == 'Egypt tour' and 14 or \
(self.order.bill_country.name == 'Hawai' and 10 or
12)))
return price * (percent / 100) / (taxclass.name != 'food' and
1 or 2)
-- end
> > Nan, you forgot to change
> > self.tax = processor.by_orderitem(self)
> Where was this change omitted?
Here
if self.product.taxable:
- self.unit_tax = processor.by_price(taxclass,
self.unit_price)
+ self.unit_tax = processor.by_price_and_product(taxclass,
self.unit_price, product=self.product)
self.tax = processor.by_orderitem(self)
> I have no objections to renaming it...
I am not sure, what shorter to use instead of name
"by_price_and_product". We can decide it later. Maybe someone has an
idea.
Thanks. I have a language handicap.
--
You received this message because you are subscribed to the Google Groups
"Satchmo users" 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/satchmo-users?hl=en.