I am new to Odoo (Python ) that is why I am struggling to do this task, I hope you can shred light on it. Thanks in advance, let me explain : Some products are taxed with a special tax called REBU (sales). The value of this tax depends on the purchase cost and the sales price as follows, example: item 1 is purchased in REBU by: 100e. item 1 is sold in REBU for 300e. Journal items must be: base exempt = 100e = purchase cost. base taxed: ( sale price - purchase cost ) / 1.21 = (300-100)/1.21 = 165.289e tax: ( sale price - purchase cost ) - base taxed = ( 300 - 100 ) - 165.289 = 34.711 It is simple math but it is difficult to modify the JOURNAL ITEMS of the invoice accordingly. note: the invoice lines are correct, no need to be modified, only journal items. I attach screenshots of how both look like now: My thinking: I use a REBU (sales) tax at 0% so the sales order and invoice lines are correct (my client must not know how much taxes I pay for that sale, otherwise he could figure out my purchase cost). Then when a product is invoiced with this REBU (sales) tax, in the journal items of this invoice we should split the "base" into two bases as I previously explained, and the tax as explained as well. We could apply one tax called "exempt" at 0% to the exempt base and another tax called "REBU" at 21% for the taxed base so all math is good I tried this, my code so far: I have a condition to know if it is REBU or not The purchase cost is in: "lot.x_serial_purchase_precio" We try to apply two taxes to the new two bases in journal lines. Note: it is not working good. Code: https://docs.google.com/document/d/...ouid=107541502685755287748&rtpof=true&sd=true I tried to split the base into two bases, one to be taxed by 21%, and another to be exempt of any tax. Continue reading...