You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.8 KiB

10 years ago
10 years ago
  1. # -*- encoding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Author: Nicolas Bessi.
  5. # Copyright Camptocamp SA 2011
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. ##############################################################################
  21. def migrate(cr, version):
  22. if not version:
  23. # only run at first install
  24. cr.execute("UPDATE account_move_line as acm "
  25. " SET last_rec_date ="
  26. " (SELECT date from account_move_line"
  27. " WHERE reconcile_id = acm.reconcile_id"
  28. " ORDER BY date DESC LIMIT 1)"
  29. " WHERE last_rec_date IS NULL"
  30. " AND reconcile_id IS NOT NULL;")
  31. cr.execute("UPDATE account_move_line as acm "
  32. " SET last_rec_date ="
  33. " (SELECT date from account_move_line"
  34. " WHERE reconcile_partial_id"
  35. " = acm.reconcile_partial_id"
  36. " ORDER BY date DESC LIMIT 1)"
  37. " WHERE last_rec_date IS NULL"
  38. " AND reconcile_partial_id IS NOT NULL;")