Hello,

The code doing the computation of the taxes is currently implmented
three times (in account_invoice, sale and purchase).  The first step
in solving issue4115 is to unify this into the tax object.

So I wrote the following patch:

   http://codereview.tryton.org/9561002/

The idea of the refactorization is that the Tax object can compute the
taxes of objects that implements a defined protocol (it's somehow
related to duck typing). Those objects should have:

   - get_tax_context: a method that defines the context in which tax
     are computed
   - a tax_date: used by Tax to compute if the tax is applicable on
     said date
   - tax_type: used by Tax to compute the base_code/base_sign/etc
   - currency: in order to correctly round the figures
- taxable_components: a list of objects that have the following properties:
       - taxes: We have to know which taxes should be applied :)
       - unit_price
       - quantity

The review shows how I implemented it in the current objects.

I you have any ideas/issues please let me know.

--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: nicolas.evr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: signature.asc
Description: Digital signature

Reply via email to