Merge lp:~unifield-team/unifield-wm/us_234 into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/us_234
Merge into: lp:unifield-wm
Diff against target: 114 lines (+41/-18)
3 files modified
account_reconciliation/account_move_line.py (+8/-3)
register_accounting/account_bank_statement.py (+7/-0)
register_accounting/wizard/down_payment.py (+26/-15)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us_234
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+269027@code.launchpad.net
To post a comment you must log in.
lp:~unifield-team/unifield-wm/us_234 updated
2569. By Stephane Codazzi <email address hidden>

Change reconciliation check method

2570. By Stephane Codazzi <email address hidden>

Change reconciliation check method

Unmerged revisions

2570. By Stephane Codazzi <email address hidden>

Change reconciliation check method

2569. By Stephane Codazzi <email address hidden>

Change reconciliation check method

2568. By Stephane Codazzi <email address hidden>

US_234: Add invoice down payment expended amout for check register line and po

2567. By Stephane Codazzi <email address hidden>

Change Down payment verification and check verification on hardpost

2566. By Stephane Codazzi <email address hidden>

Change Down payment verification and check verification on hardpost

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_reconciliation/account_move_line.py'
2--- account_reconciliation/account_move_line.py 2014-10-27 13:40:35 +0000
3+++ account_reconciliation/account_move_line.py 2015-09-03 10:20:31 +0000
4@@ -89,6 +89,7 @@
5 # UTP-752: Add an attribute to reconciliation element if different instance levels
6 previous_level = False
7 different_level = False
8+ already_reconciled = True
9 for line in self.browse(cr, uid, ids, context=context):
10 # Do level check only if we don't know if more than 1 different level exists between lines
11 if not different_level:
12@@ -97,8 +98,11 @@
13 if previous_level != line.instance_id.id:
14 different_level = True
15 company_currency_id = line.company_id.currency_id
16- if line.reconcile_id:
17- raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
18+
19+ if not line.reconcile_id:
20+ already_reconciled = False
21+ # if line.reconcile_id:
22+ # raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
23 if line.reconcile_partial_id:
24 for line2 in line.reconcile_partial_id.line_partial_ids:
25 if not line2.reconcile_id:
26@@ -110,7 +114,8 @@
27 else:
28 unmerge.append(line.id)
29 total += (line.debit_currency or 0.0) - (line.credit_currency or 0.0)
30-
31+ if already_reconciled:
32+ raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
33 if self.pool.get('res.currency').is_zero(cr, uid, company_currency_id, total):
34 res = self.reconcile(cr, uid, merges+unmerge, context=context)
35 return res
36
37=== modified file 'register_accounting/account_bank_statement.py'
38--- register_accounting/account_bank_statement.py 2015-08-28 16:01:14 +0000
39+++ register_accounting/account_bank_statement.py 2015-09-03 10:20:31 +0000
40@@ -2289,6 +2289,13 @@
41 """
42 Write some statement line into some account move lines in posted state.
43 """
44+
45+ wdp_obj = self.pool.get('wizard.down.payment')
46+ lines = self.browse(cr, uid, ids, context=context)
47+ for line in lines:
48+ wdp_obj.check_register_line_and_po(cr, uid, line['id'],
49+ line['down_payment_id']['id'],
50+ context=context)
51 return self.posting(cr, uid, ids, 'hard', context=context)
52
53 def button_temp_posting(self, cr, uid, ids, context=None):
54
55=== modified file 'register_accounting/wizard/down_payment.py'
56--- register_accounting/wizard/down_payment.py 2014-02-13 09:41:43 +0000
57+++ register_accounting/wizard/down_payment.py 2015-09-03 10:20:31 +0000
58@@ -44,7 +44,8 @@
59
60 def check_register_line_and_po(self, cr, uid, absl_id, po_id, context=None):
61 """
62- Verify that register line amount is not superior to (PO total_amount - all used down payments - open/paid invoices).
63+ Verify that register line amount is not superior to
64+ (PO total_amount - all used down payments - open/paid invoices).
65 Check partner on register line AND PO (should be equal)
66 """
67 # Some verifications
68@@ -66,22 +67,32 @@
69 if po.get('partner_id', [False])[0] != absl.partner_id.id:
70 raise osv.except_osv(_('Error'), _('Third party from Down payment and Purchase Order are different!'))
71 total = po.get('amount_total', 0.0)
72- for dp in po_obj.read(cr, uid, po.get('down_payment_ids', []), ['amount_currency', 'down_payment_amount']):
73- move_ids = [x.id or None for x in absl.move_ids]
74- operator = 'in'
75- if len(move_ids) == 1:
76- operator = '='
77- move_line_ids = self.pool.get('account.move.line').search(cr, uid, [('account_id', '=', absl.account_id.id),
78- ('move_id', operator, move_ids)])
79- if dp.get('id') not in move_line_ids:
80- total -= (dp.get('amount_currency', 0.0) - dp.get('down_payment_amount', 0.0))
81+
82+ absl_obj = self.pool.get('account.bank.statement.line')
83+ args = [('down_payment_id', '=', po_id)]
84+ lines_ids = absl_obj.search(cr, uid, args, context=context)
85+ lines_amount = 0
86+
87+ for line in absl_obj.read(cr, uid, lines_ids, ['id', 'amount'],
88+ context=context):
89+ if absl_id != line['id']:
90+ lines_amount += line['amount']
91+
92 # Cut away open and paid invoice linked to this PO
93 invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('purchase_ids', 'in', [po_id]), ('state', 'in', ['paid', 'open'])])
94- for inv in self.pool.get('account.invoice').read(cr, uid, invoice_ids, ['amount_total']):
95- total -= inv.get('amount_total', 0.0)
96- if (-1 * absl.amount) > total:
97- raise osv.except_osv(_('Warning'),
98- _('Maximum amount should be: %s. Register line amount is higher than (PO - unexpended DPs - open/paid INV).') % (total))
99+ for inv in self.pool.get('account.invoice').read(cr, uid, invoice_ids, ['amount_total', 'down_payment_ids']):
100+ lines_amount -= inv.get('amount_total', 0.0)
101+ dp_ids = inv.get('down_payment_ids', None)
102+ for dp in self.pool.get('account.move.line').read(cr, uid, dp_ids, ['down_payment_amount']):
103+ lines_amount += dp.get('down_payment_amount', 0.0)
104+
105+ total_amount = lines_amount + absl.amount
106+ if (total + total_amount) < 0:
107+ raise osv.except_osv(_('Warning'),
108+ _('Maximum amount should be: %s. Register' +
109+ ' line amount is higher than (PO - ' +
110+ 'unexpended DPs - open/paid INV).')
111+ % (total + lines_amount))
112 return True
113
114 def button_validate(self, cr, uid, ids, context=None):

Subscribers

People subscribed via source and target branches