Ticket #298 (closed enhancement: fixed)
triggers!
| Reported by: | carlos | Owned by: | enrique |
|---|---|---|---|
| Priority: | major | Milestone: | 0.3 |
| Component: | no component | Keywords: | |
| Cc: |
Description
Create calculated totals fields as actual fields of the common model. They should be created or updated after invoice insertion or update of a row with a trigger (AFTER INSERT|UPDATE TRIGGERS CALLING A STORED PROCEDURE ¿?).
Payments should trigger procedures too:
After INSERT|UPDATE a payment, paid and due totals in its parent model should be recalculated. If due becomes 0.0 (and not a less than zero value) the invoice "closed" value should be True.
Change History
comment:2 Changed 2 years ago by jzarate
- Owner set to jzarate
- Status changed from new to assigned
From the #296:
I think that all the calculations should be done with triggers instead of views. There are views that have date dependencies, that calculations maybe should remain as views.
comment:3 Changed 2 years ago by jzarate
some notes :
si hago
- update item set quantity
y luego
- update payment
obtengo el mismo resultado que con la consola
si hago
- update payment
obtengo el mismo resultado que con la consola, pero si despues hago
- update item
entonces los campos 'paid_amount' y 'due_amount' se me ponen null, mientras que si hago update item con la consola (despues de haber hecho update payment con la consola), los campos paid_amount y due_amount se quedan iguales (cosa que tampoco deberia pasar, porque ha cambiado el quantity de los items).
si borro un tax del item en la web, los campos "base_amount, discount_amount y todos los "amount" se me resetean a null.

