Commit graph

764 commits

Author SHA1 Message Date
Aurélien Delobelle
86a3ae3c2f clean
- basket.add_withdraw takes a positive amount
- move models and formatters definitions with their siblings
2017-05-18 12:49:39 +02:00
Aurélien Delobelle
a0503d0c53 Refactor K-Psul basket (big part)
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.
2017-05-18 02:13:42 +02:00
Aurélien Delobelle
bacc079778 Merge branch 'master' into aureplop/kpsul_js_refactor 2017-05-16 16:48:12 +02:00
Aurélien Delobelle
bc71e1628a keep eslint quiet 2017-05-16 12:27:39 +02:00
Ludovic Stephan
6a6fc38ead Add selection reset to cancel_opes 2017-05-15 21:10:39 -03:00
Ludovic Stephan
43e772363e Extend history options 2017-05-15 19:29:12 -03:00
Ludovic Stephan
93c8844b3f typo 2017-05-15 19:28:24 -03:00
Ludovic Stephan
c2da055b60 Remove duplicate ws updates 2017-05-15 18:59:18 -03:00
Aurélien Delobelle
95a8b484e0 Merge branch 'Aufinal/fix_history' into 'master'
Fix asynchronous calls with resetSettings

See merge request !229
2017-05-15 23:43:28 +02:00
Ludovic Stephan
647b32e727 Move displayAddcost function 2017-05-15 17:52:49 -03:00
Ludovic Stephan
ac33e6302e Fix addExistingPurchase + few other bugs 2017-05-15 17:39:33 -03:00
Ludovic Stephan
ad42687293 Fix tranfers page 2017-05-15 15:27:46 -03:00
Ludovic Stephan
f4cb1e2e83 Add opesonly option 2017-05-15 14:17:58 -03:00
Martin Pepin
6871945dcd Merge branch 'aureplop/fix_perms' into 'master'
Fix UserGroupForm

Closes #161

See merge request !228
2017-05-15 11:29:33 +02:00
Ludovic Stephan
bf0e345301 Fix asynchronous calls with resetSettings
The `resetSettings` function now returns the ajax object, allowing to
chain other calls to it, e.g. the `getHistory` function.
2017-05-14 23:50:09 -03:00
Ludovic Stephan
c12c705f8b Bind ForestDisplay to initial data 2017-05-14 20:18:31 -03:00
Aurélien Delobelle
e0b1db1e1e more robust tests 2017-05-14 22:19:25 +02:00
Ludovic Stephan
31b742fdb7 Move ws update to respective classes 2017-05-14 17:19:09 -03:00
Martin Pepin
5d8427e601 Merge branch 'aureplop/fewer_requests' into 'master'
Moins de requêtes

See merge request !217
2017-05-12 21:13:35 +02:00
Aurélien Delobelle
4ac7b30bdd Fix UserGroupForm + tests for this form.
- Non-K-Fêt group membership is no longer erased by the account edit
  form.
- Add some tests to ensure proposed choices in this form corresponds to
  K-Fêt groups + test case for #161.

Fixes #161
2017-05-12 16:55:18 +02:00
Aurélien Delobelle
b1e46792c8 (little) cleaning of order_create view 2017-05-10 13:11:47 +02:00
Aurélien Delobelle
b0e7ebfbc5 fix typo + pep8 + del future imports 2017-05-10 12:49:14 +02:00
Ludovic Stephan
5c5fc6da1b Merge branch 'aureplop/less_prices_history' into 'master'
Less articles prices history

Closes #142

See merge request !224
2017-04-25 14:32:18 +02:00
Ludovic Stephan
8b8a3f8a25 Update button in history 2017-04-24 14:46:16 -03:00
Ludovic Stephan
16dbfed977 Add chidren div in display 2017-04-24 14:12:03 -03:00
Ludovic Stephan
5096e5f129 Adapt ArticleManager 2017-04-24 13:25:18 -03:00
Ludovic Stephan
46ac82fd27 Adapt history to changes 2017-04-24 13:25:07 -03:00
Ludovic Stephan
e283439ebc Create ForestDisplay class
- Store templates, container and data
- All display functions removed from ModelForest
2017-04-24 13:21:56 -03:00
Ludovic Stephan
20d635137c Merge remote-tracking branch 'origin/aureplop/kpsul_js_refactor' into Aufinal/refactor_history 2017-04-24 11:30:01 -03:00
Aurélien Delobelle
2eee8f58aa Merge branch 'master' into aureplop/fewer_requests 2017-04-17 20:45:01 +02:00
Ludovic Stephan
b2a5dfd682 Move permission check 2017-04-14 12:51:58 -03:00
Ludovic Stephan
100686457b Change select_related for future compatibility 2017-04-14 12:47:15 -03:00
Ludovic Stephan
b544d6c5b3 Better alignment 2017-04-14 12:45:38 -03:00
Ludovic Stephan
659b20891e Add filter to cancel_opes 2017-04-14 12:43:59 -03:00
Ludovic Stephan
034a661444 Tweaks on kfet.js 2017-04-14 12:12:43 -03:00
Ludovic Stephan
de865c61aa Move container clearing 2017-04-14 11:36:52 -03:00
Aurélien Delobelle
b0d35667b3 Merge branch 'master' into aureplop/kpsul_js_refactor 2017-04-14 15:56:44 +02:00
Aurélien Delobelle
7db497d095 Less articles prices history
- Prices given with order_to_inventory are saved to db only if they are
  updated (it doesn't create a new price row each time)

Fixes #142.
2017-04-13 16:34:29 +02:00
Aurélien Delobelle
9668f1d1ec Account: check_negative() -> update_negative() 2017-04-13 15:48:13 +02:00
Aurélien Delobelle
18425b82c2 Check negative on cancellation.
- 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.
2017-04-13 15:15:59 +02:00
Aurélien Delobelle
06572f0bb5 Order create use Scale.
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.
2017-04-13 14:11:44 +02:00
Aurélien Delobelle
3f4a1adbb9 Fewer queries on stats/scales + Fix
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
2017-04-12 18:03:31 +02:00
Aurélien Delobelle
e97e0081d7 Fewer queries on stats of an account balance.
- Remove labels, should be replaced to an anchor to the relative
  operation in history.
- Add select_related as necessary.
2017-04-11 23:13:54 +02:00
Aurélien Delobelle
b5cc26bb1b Merge branch 'master' into aureplop/fewer_requests 2017-04-11 22:46:18 +02:00
Aurélien Delobelle
b357283f87 Merge branch 'master' into aureplop/clean_channels 2017-04-11 00:32:07 +02:00
Martin Pepin
a68002d0f6 Merge branch 'aureplop/fix_double_js' into 'master'
Fix stats on some browsers

See merge request !219
2017-04-10 23:59:02 +02:00
Ludovic Stephan
8c02e5da0c Trigger event on history itself 2017-04-10 15:40:29 -03:00
Ludovic Stephan
2eba6892a2 Revert "Change event triggered when canceling opes"
This reverts commit ce3d8aa6f7.
2017-04-10 15:34:57 -03:00
Ludovic Stephan
ce3d8aa6f7 Change event triggered when canceling opes 2017-04-10 15:08:17 -03:00
Ludovic Stephan
84d478271b Compatibility changes on history.js 2017-04-10 12:34:43 -03:00