K-Psul
- Improve article autocompletion.
ArticleManager
- "selected" property becomes a reference to an article in the data properties.
ForestDisplay
- Add data property "object" linked to object being represented
- Use class to identify objects instead of id. Allow multiple displays of same ModelForest.
- New get_class method returns the class selector to find an object container in the DOM.
- New get_dom method returns the DOM element from an object in the ModelForest.
Cancellation view
- Fix 500 on cancel with already canceled opes/transfers
K-Psul - Basket refactor
- Almost done.
ModelForest
- Add create method (based on previous get_or_create). Direction defaults to 0.
- Add delete method.
- Methods find, traverse, update, delete can also take a model (class) as first
argument. String representation of model still works.
- Fix child linking to parent in create method.
ModelForest -> ForestDisplay
- (One-way data binding) Changes on a ModelForest are directly reflected on
listening ForestDisplay(s).
- ArticleManager and KHistory become simpler.
Config
- Add addcost key, shorthand for double addcost keys check.
K-Psul
- Improve display for basket summary and previous operation.
- Clean js code / duplicates.
- Some components gains chance to trigger/handle events. They are really happy.
Eg basket amounts and summary are updated thanks to these events if the
selected account is changed.
Formatters
- Fixes addcost and amount display.
History
- Fix options management (api_options were overrided and K-Psul displayed more
than the last day history).
- Fix data display, thanks to formatters fixes and modelforest fixes.
- Like perform operations, cancel_operations can add/remove an account
from negative accounts system.
- Balances checks are now performed against real_balance instead of
balance.
So if someone with a balance_offset go, for real, to positive land (ie even
without taking into account the balance offset), its account is removed from
the negative system.
- Fix bug on real_balance when negative exists but balance_offset is
not set.
Fixes#156.
Order create view use WeekScale. No query improvements, only shorter
code.
Scale/ScaleMixin:
- Two methods directly relative to the Scale class move to... the Scale
class.
- Fix order create on Chrome.
Scales:
- Fix #chunks when used with std_chunk=True (there was one too many at
the beginning)
- Scale.end gives the end of the last chunk (instead of its start)
So scale.begin -> scale.end gives the full range of the scale.
`kfet_day` now returns an aware datetime.
ScaleMixin:
- new method `get_by_chunks` which use only one query and ranks
elements according to the scale. Elements are returned by a generator
for each scale chunk (and all chunks are returned as a generator too).
ArticlesStatSales and AccountStatOperations use this new method to
avoid issuing #scale_chunks queries.
ArticleStat:
- fixed on Chrome
- AccountNegative use new AccountNegativeManager which select_related
account, cofprofile and user for instances accessed via
AccountNegative.objects.
- Compute sum of negatives with python instead of an SQL statement
(since we already got the data with a previous query).
- Fix bug on account property `real_balance` (happened if
an account has a relative AccountNegative instance but balance_offset
to NULL).
- More compliant to PEP8
- When Account model is queried with Account.objects, it always add
.select_related('cofprofile_user', 'negative').
- Eg benefits: history doesn't do anymore one request by account to
fill the account filter.
Important
Using this workaround (systemically append select_related) can be
dangerous normally, however a certain number of properties in
cofprofile and user are frequently used (as firstname or lastname), and
the benefits seems greater.