~mikel-martin/c2c-rd-addons/6.1

« back to all changes in this revision

Viewing changes to chricar_account_move_line_deloitte/fix date and period.sql

  • Committer: openerp@bazaar.camptocamp.net
  • Date: 2011-09-20 13:59:04 UTC
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: openerp@bazaar.camptocamp.net-20110920135904-mkt0de1c649502fo
[ADD] import utility form Klinger accounting

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
select account_id,amn.date,amn.journal_id,amn.id,'neutral',amn.period_id,credit,'valid'
 
2
select aj.name,sum(credit)
 
3
  from account_move_line aml,
 
4
       account_move am,
 
5
       account_journal aj,
 
6
       account_move amn,  -- neutral move
 
7
       account_journal ajn
 
8
 where aj.id = am.journal_id
 
9
   and aj.name != 'Deloitte'
 
10
   and aml.move_id = am.id
 
11
   and am.period_id = amn.period_id
 
12
   and ajn.name = 'Deloitte neutral'
 
13
   and ajn.id = amn.journal_id
 
14
   and aml.state='valid' and account_id=18 and am.period_id=42
 
15
group by aj.name
 
16
;
 
17
select account_id,amn.date,amn.journal_id,amn.id,'neutral',amn.period_id,credit,am.state,aj.name,am.to_check,am.type,aml.move_id
 
18
--select aj.name,sum(credit)
 
19
  from account_move_line aml,
 
20
       account_move am,
 
21
       account_journal aj,
 
22
       account_move amn,  -- neutral move
 
23
       account_journal ajn
 
24
 where aj.id = am.journal_id
 
25
   and aj.name != 'Deloitte'
 
26
   and aml.move_id = am.id
 
27
   and am.period_id = amn.period_id
 
28
   and ajn.name = 'Deloitte neutral'
 
29
   and ajn.id = amn.journal_id
 
30
--   and am.state='posted'
 
31
   and aml.state='valid'
 
32
and account_id=18 and am.period_id=42
 
33
--group by aj.name
 
34
;
 
35
 
 
36
update account_move
 
37
set to_check=False
 
38
where to_check is  null
 
39
  and state='draft';
 
40
 
 
41
select am.id,am.period_id,am.ref,aml.name , am.date,aml.period_id,aml.date, aml.date- am.date
 
42
  from account_move am,
 
43
       account_move_line aml
 
44
 where am.id = aml.move_id
 
45
   and am.period_id != aml.period_id
 
46
order by am.ref;
 
47
 
 
48
update account_move_line aml
 
49
  set date = (select date from account_move am
 
50
                         where aml.move_id = am.id
 
51
                           and aml.date != am.date)
 
52
where id in (select aml.id from account_move am,
 
53
       account_move_line aml
 
54
 where am.id = aml.move_id
 
55
   and am.period_id != aml.period_id
 
56
   and aml.date != am.date);
 
57
 
 
58
update account_move amd
 
59
  set period_id = (select id from account_period where amd.date between date_start and date_stop)
 
60
where period_id != (select id from account_period where amd.date between date_start and date_stop);
 
61
 
 
62
update account_move_line amd
 
63
  set period_id = (select id from account_period where amd.date between date_start and date_stop)
 
64
where period_id != (select id from account_period where amd.date between date_start and date_stop)
 
65
  and date is not null;
 
66