Merge lp:~unifield-team/unifield-wm/us-948b into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/us-948b
Merge into: lp:unifield-wm
Diff against target: 118 lines (+39/-15)
3 files modified
register_accounting/account_bank_statement.py (+1/-1)
register_accounting/account_cash_statement.py (+35/-13)
register_accounting/register_tools.py (+3/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-948b
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+287439@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2777. By Vincent GREINER

US-948 [IMP] update cash behaviour: always cary over end of month balance (whereas frozen or not)

2776. By Vincent GREINER

US-948 carry over CashBox Balance at cashbox confirm (frozen)

2775. By Vincent GREINER

US-948 [FIX] draft/open register always carry end of month balance (manual accountant) to next register

2774. By Vincent GREINER

US-948 [IMP] next register creation: carry over IB for bank AND cash, take always the manual accountant amout as reference

2773. By Vincent GREINER

US-948/US-645 [FIX] next register create wizard: carry other the end month bal to the next register IB using the adhoc field (when eom not frozen/no entries, no total amount for msf_calculated_balance => pick bank statement balance)

2772. By Vincent GREINER

US-948 [FIX]

1: carry over end of month balance even if 0. (was wrongly not carry over with vals.get() default False)

2: carry over end of month balance to next registers if
   the source register is not 'end of month balance' frozen

2771. By Vincent GREINER

US-948/1 [FIX] cancel US-645 as the true issue is the point 2) of US-948

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'register_accounting/account_bank_statement.py'
2--- register_accounting/account_bank_statement.py 2016-02-22 16:20:10 +0000
3+++ register_accounting/account_bank_statement.py 2016-02-29 08:12:45 +0000
4@@ -423,7 +423,7 @@
5 """
6 Confirm that the closing balance could not be editable.
7 """
8- if not context:
9+ if context is None:
10 context = {}
11 if isinstance(ids, (int, long)):
12 ids = [ids]
13
14=== modified file 'register_accounting/account_cash_statement.py'
15--- register_accounting/account_cash_statement.py 2015-12-22 07:49:20 +0000
16+++ register_accounting/account_cash_statement.py 2016-02-29 08:12:45 +0000
17@@ -96,18 +96,26 @@
18
19 # @@@end
20 # Observe register state
21+ prev_reg = False
22 prev_reg_id = vals.get('prev_reg_id', False)
23 if prev_reg_id:
24 prev_reg = self.browse(cr, uid, [prev_reg_id], context=context)[0]
25 # if previous register closing balance is freezed, then retrieving previous closing balance
26 # US_410: retrieving previous closing balance even closing balance is not freezed
27 # if prev_reg.closing_balance_frozen:
28+ # US-948: carry over for bank, and always carry over bank
29+ # accountant manual field
30 if journal.type == 'bank':
31- vals.update({'balance_start': prev_reg.balance_end_real})
32+ vals.update({'balance_start': prev_reg.balance_end_real, })
33 res_id = osv.osv.create(self, cr, uid, vals, context=context)
34 # take on previous lines if exists (or discard if they come from sync)
35- if prev_reg_id and not sync_update:
36+ if journal.type == 'cash' and prev_reg_id and not sync_update:
37 create_cashbox_lines(self, cr, uid, [prev_reg_id], ending=True, context=context)
38+ if prev_reg:
39+ # Since US-948: created register IB is previous cashbox balance
40+ self.write(cr, uid, [res_id],
41+ {'balance_start': prev_reg.balance_end_cash, },
42+ context=context)
43 # update balance_end
44 self._get_starting_balance(cr, uid, [res_id], context=context)
45 return res_id
46@@ -116,16 +124,26 @@
47 if context is None:
48 context = {}
49
50- if not context.get('sync_update_execution') and vals.get('balance_end_real', False):
51- new_vals = {'balance_start': vals['balance_end_real']}
52- to_write_id_list = []
53- for id in ids:
54- args = [('prev_reg_id', '=', id)]
55- search_ids = self.search(cr, uid, args, context=context)
56- to_write_id_list.extend(search_ids)
57- self.write(cr, uid, to_write_id_list, new_vals, context=context)
58+ if not context.get('sync_update_execution'):
59+ if 'balance_end_real' in vals:
60+ new_vals = {'balance_start': vals['balance_end_real']}
61+ # US-948/2: carry over end of month balance to next registers if
62+ # the source register is not 'end of month balance' frozen
63+ # note: the last carry over is processed via
64+ # 'button_confirm_closing_bank_balance' button
65+ to_write_id_list = []
66+ for r in self.read(cr, uid, ids, ['closing_balance_frozen', ],
67+ context=context):
68+ if not r['closing_balance_frozen']:
69+ args = [('prev_reg_id', '=', r['id'])]
70+ search_ids = self.search(cr, uid, args, context=context)
71+ if search_ids:
72+ to_write_id_list.extend(search_ids)
73+ self.write(cr, uid, to_write_id_list, new_vals, context=context)
74
75- return super(account_cash_statement, self).write(cr, uid, ids, vals, context=context)
76+ res = super(account_cash_statement, self).write(cr, uid, ids, vals,
77+ context=context)
78+ return res
79
80 def button_open_cash(self, cr, uid, ids, context=None):
81 if not context:
82@@ -245,7 +263,8 @@
83 """
84 Sum of opening balance (balance_start) and sum of cash transaction (total_entry_encoding)
85 """
86- # Prepare some values
87+ if context is None:
88+ context = {}
89 res = {}
90 for st in self.browse(cr, uid, ids):
91 amount = (st.balance_start or 0.0) + (st.total_entry_encoding or 0.0)
92@@ -255,7 +274,10 @@
93 next_st_ids = self.search(cr, uid, [('prev_reg_id', '=', st.id)])
94 for next_st in self.browse(cr, uid, next_st_ids):
95 if next_st.state != 'confirm':
96- self.write(cr, uid, [next_st.id], {'balance_start': amount})
97+ # US-948: since cash register is not eom bal
98+ # frozen, carry over Cashbox balance
99+ # (when creating next register or updating)
100+ self.write(cr, uid, [next_st.id], {'balance_start': st.balance_end_cash})
101 return res
102
103 def _get_sum_entry_encoding(self, cr, uid, ids, field_name=None, arg=None, context=None):
104
105=== modified file 'register_accounting/register_tools.py'
106--- register_accounting/register_tools.py 2015-11-16 14:27:39 +0000
107+++ register_accounting/register_tools.py 2016-02-29 08:12:45 +0000
108@@ -366,7 +366,9 @@
109 starting_vals.update({'number': 0.0,})
110 cashbox_line_obj.create(cr, uid, starting_vals, context=context)
111 # update new register balance_start
112- balance = st_obj._get_starting_balance(cr, uid, [next_reg_id], context=context)[next_reg_id].get('balance_start', False)
113+ # US-948: carry over CashBox Balance at confirm
114+ #balance = st_obj._get_starting_balance(cr, uid, [next_reg_id], context=context)[next_reg_id].get('balance_start', False)
115+ balance = st.balance_end_cash
116 if balance:
117 st_obj.write(cr, uid, [next_reg_id], {'balance_start': balance}, context=context)
118 return True

Subscribers

People subscribed via source and target branches