Merge lp:~openbig/bigconsulting/milestone1 into lp:bigconsulting
- milestone1
- Merge into addons
Proposed by
gpa(OpenERP)
Status: | Merged |
---|---|
Merged at revision: | 54 |
Proposed branch: | lp:~openbig/bigconsulting/milestone1 |
Merge into: | lp:bigconsulting |
Diff against target: |
955 lines (+453/-241) 5 files modified
account_invoice_cash_discount/__terp__.py (+1/-1) account_invoice_cash_discount/account_invoice_cash_discount.py (+59/-54) account_invoice_cash_discount/account_invoice_cash_discount_view.xml (+16/-0) account_invoice_cash_discount/wizard/account_pay_invoice.py (+323/-180) account_invoice_cash_discount/wizard/account_pay_invoice_view.xml (+54/-6) |
To merge this branch: | bzr merge lp:~openbig/bigconsulting/milestone1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
openbig | Pending | ||
Review via email: mp+31031@code.launchpad.net |
This proposal supersedes a proposal from 2010-07-20.
Commit message
Description of the change
Improvement in milestone1
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_invoice_cash_discount/__terp__.py' |
2 | --- account_invoice_cash_discount/__terp__.py 2010-06-30 07:25:25 +0000 |
3 | +++ account_invoice_cash_discount/__terp__.py 2010-07-27 09:18:44 +0000 |
4 | @@ -20,7 +20,7 @@ |
5 | # |
6 | ############################################################################## |
7 | { |
8 | - "name" : "Payement Term with Cash Discount", |
9 | + "name" : "Payment Term with Cash Discount", |
10 | "version" : "1.0", |
11 | "depends" : ["account",], |
12 | "author" : "Big Consulting", |
13 | |
14 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py' |
15 | --- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-07-23 11:30:07 +0000 |
16 | +++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-07-27 09:18:44 +0000 |
17 | @@ -45,8 +45,6 @@ |
18 | 'payment_id': fields.many2one('account.payment.term','Associated Payment Term'), |
19 | 'credit_account_id': fields.many2one('account.account', 'Credit Account'), |
20 | 'debit_account_id': fields.many2one('account.account', 'Debit Account'), |
21 | -# 'payment_term_ids': fields.one2many('account.payment.term.line', 'cash_account_discount_id', 'Payment Term Lines'), |
22 | -# 'day_tolerance': fields.integer('Days Tolerance', digits=(16,6),required=True), |
23 | 'sup_discount_account_id': fields.many2one('account.account', 'Supplier Discount Account',required=True), |
24 | } |
25 | account_cash_discount() |
26 | @@ -54,7 +52,6 @@ |
27 | class account_payment_term_line(osv.osv): |
28 | _inherit = "account.payment.term.line" |
29 | _columns = { |
30 | -# 'cash_account_discount_id': fields.many2one('account.cash.discount', 'Discount Lines',), |
31 | 'day_tolerance': fields.integer('Days Tolerance', digits=(16,6),required=True), |
32 | 'payment_id': fields.many2one('account.payment.term', 'Payment Term', required=False, select=True), |
33 | 'compl_cash_discount':fields.boolean('Use Complete Cash Discount'), |
34 | @@ -115,6 +112,8 @@ |
35 | res = resudial_amonut |
36 | amount = res |
37 | dis = payment_line.days |
38 | + else: |
39 | + amount = resudial_amonut |
40 | |
41 | return {'amount':amount,'tol_days':tol_days,'found':payment_line_found} |
42 | |
43 | @@ -223,6 +222,7 @@ |
44 | invoice_tax_obj = self.pool.get("account.invoice.tax") |
45 | move_line_obj = self.pool.get('account.move.line') |
46 | move_obj = self.pool.get('account.move') |
47 | + move_line_obj_memory = self.pool.get('account.move.line.memory') |
48 | |
49 | amount_discount = 0.0 |
50 | if invoice.payment_term: |
51 | @@ -298,23 +298,21 @@ |
52 | if 'tax_move_ids' in context and context['tax_move_ids']: |
53 | move_line = context['tax_move_ids'] |
54 | for move_line_id in move_line: |
55 | - move_line_data = move_line_obj.browse(cr, uid,move_line_id) |
56 | + move_line_data = move_line_obj_memory.browse(cr, uid,move_line_id) |
57 | l3 = { |
58 | 'debit': move_line_data.debit, |
59 | 'credit': move_line_data.credit, |
60 | 'account_id': move_line_data.account_id.id, |
61 | - 'partner_id': move_line_data.partner_id.id, |
62 | - 'ref':move_line_data.ref, |
63 | + 'partner_id': invoice.partner_id.id, |
64 | + 'ref':ref, |
65 | 'date': move_line_data.date, |
66 | - 'currency_id':currency_id, |
67 | - 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
68 | + 'currency_id':move_line_data.currency_id.id, |
69 | + 'amount_currency':move_line_data.amount_currency and direction * move_line_data.amount_currency or 0.0, |
70 | 'name':move_line_data.name, |
71 | 'tax_code_id':move_line_data.tax_code_id.id, |
72 | 'tax_amount':move_line_data.tax_amount, |
73 | } |
74 | lines.append((0, 0, l3)) |
75 | - move_line_obj.unlink(cr, uid,[move_line_id]) |
76 | - move_obj.unlink(cr, uid,[move_line_data.move_id.id]) |
77 | else: |
78 | if amount_discount>0.0: |
79 | for line in invoice.invoice_line: |
80 | @@ -345,44 +343,60 @@ |
81 | if 'discount_move_ids' in context and context['discount_move_ids']: |
82 | move_line = context['discount_move_ids'] |
83 | for move_line_id in move_line: |
84 | - move_line_data = move_line_obj.browse(cr, uid,move_line_id) |
85 | + move_line_data = move_line_obj_memory.browse(cr, uid, move_line_id) |
86 | l4 = { |
87 | 'debit': move_line_data.debit, |
88 | 'credit':move_line_data.credit, |
89 | 'account_id': move_line_data.account_id.id, |
90 | - 'partner_id': move_line_data.partner_id.id, |
91 | - 'ref':move_line_data.ref, |
92 | + 'partner_id': invoice.partner_id.id, |
93 | + 'ref':ref, |
94 | 'date': move_line_data.date, |
95 | - 'currency_id':currency_id, |
96 | - 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
97 | + 'currency_id':move_line_data.currency_id.id, |
98 | + 'amount_currency':move_line_data.amount_currency and direction * move_line_data.amount_currency or 0.0, |
99 | 'name':move_line_data.name, |
100 | 'tax_code_id':move_line_data.tax_code_id.id, |
101 | 'tax_amount':move_line_data.tax_amount, |
102 | } |
103 | lines.append((0, 0, l4)) |
104 | - move_line_obj.unlink(cr, uid,[move_line_id]) |
105 | - move_obj.unlink(cr, uid,[move_line_data.move_id.id]) |
106 | + |
107 | else: |
108 | if amount_discount>0: |
109 | + account_id = False |
110 | if 'account_id' in context and context['account_id']: |
111 | - account_id = context['account_id'] |
112 | - if tax_total_amount>0: |
113 | - amount_discount = (amount_discount - tax_total_amount) |
114 | - else: |
115 | - amount_discount = amount_discount |
116 | - l4 = { |
117 | - 'debit': direction * amount_discount<0 and - direction * amount_discount, |
118 | - 'credit': direction * amount_discount>0 and direction * amount_discount, |
119 | - 'account_id': account_id, |
120 | - 'partner_id': invoice.partner_id.id, |
121 | - 'ref':ref, |
122 | - 'date': date, |
123 | - 'currency_id':currency_id, |
124 | - 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
125 | - } |
126 | - l4['name'] = name |
127 | - lines.append((0, 0, l4)) |
128 | - |
129 | + account_id = context['account_id'] |
130 | +# if tax_total_amount>0: |
131 | +# amount_discount = (amount_discount - tax_total_amount) |
132 | +# else: |
133 | +# amount_discount = amount_discount |
134 | + for line in invoice.invoice_line: |
135 | + line_tax_amount = 0.0 |
136 | + tax_amount = 0.0 |
137 | + discount = 0.0 |
138 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, line.price_subtotal, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
139 | + line_tax_amount = tax['amount'] |
140 | + |
141 | + line_total = line.price_subtotal + line_tax_amount |
142 | + invoice_res_amount = invoice.amount_total |
143 | + line_ratio = line_total / invoice_res_amount |
144 | + |
145 | + discount = amount_discount * line_ratio |
146 | + |
147 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, amount_discount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
148 | + tax_amount = tax['amount'] |
149 | + |
150 | + l4 = { |
151 | + 'debit': direction * (discount - tax_amount)<0 and - direction * (discount - tax_amount), |
152 | + 'credit': direction * (discount - tax_amount)>0 and direction * (discount - tax_amount), |
153 | + 'account_id': account_id, |
154 | + 'partner_id': invoice.partner_id.id, |
155 | + 'ref':ref, |
156 | + 'date': date, |
157 | + 'currency_id':currency_id, |
158 | + 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
159 | + } |
160 | + l4['name'] = name |
161 | + lines.append((0, 0, l4)) |
162 | + |
163 | move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date} |
164 | move_id = move_obj.create(cr, uid, move, context=context) |
165 | |
166 | @@ -407,25 +421,16 @@ |
167 | |
168 | account_invoice() |
169 | |
170 | -class account_move_line(osv.osv): |
171 | - _name = 'account.move.line' |
172 | - _inherit = 'account.move.line' |
173 | - |
174 | - def _invoice(self, cr, uid, ids, name, arg, context=None): |
175 | - res = {} |
176 | - if ids: |
177 | - return super(account_move_line, self)._invoice(cr, uid, ids, name, arg, context) |
178 | - else: |
179 | - return res |
180 | - |
181 | - def _invoice_search(self, cr, uid, obj, name, args, context={}): |
182 | - return super(account_move_line, self)._invoice_search(cr, uid, obj, name, args, context=context) |
183 | - |
184 | - _columns = { |
185 | - 'invoice': fields.function(_invoice, method=True, string='Invoice', |
186 | - type='many2one', relation='account.invoice', fnct_search=_invoice_search), |
187 | - } |
188 | -account_move_line() |
189 | +class account_bank_statement_reconcile(osv.osv): |
190 | + _inherit='account.bank.statement.reconcile' |
191 | + def name_get(self, cursor, user, ids, context=None): |
192 | + res = [] |
193 | + res = super(account_bank_statement_reconcile, self).name_get(cursor, user, ids, context) |
194 | + for o in self.browse(cursor, user, ids, context=context): |
195 | + data = res[0][1] + o.name |
196 | + res.append((o.id,data)) |
197 | + return res |
198 | +account_bank_statement_reconcile() |
199 | |
200 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
201 | |
202 | |
203 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount_view.xml' |
204 | --- account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-23 12:13:39 +0000 |
205 | +++ account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-07-27 09:18:44 +0000 |
206 | @@ -72,6 +72,22 @@ |
207 | </field> |
208 | </record> |
209 | |
210 | + <record id="view_bank_statement_reconcile_tree" model="ir.ui.view"> |
211 | + <field name="name">account.bank.statement.reconcile.tree</field> |
212 | + <field name="model">account.bank.statement.reconcile</field> |
213 | + <field name="type">tree</field> |
214 | + <field name="arch" type="xml"> |
215 | + <tree string="Reconcile"> |
216 | + <field name="name" select="1"/> |
217 | + <field name="total_amount"/> |
218 | + <field name="total_currency"/> |
219 | + <field name="total_entry"/> |
220 | + <field name="total_new"/> |
221 | + <field name="total_balance"/> |
222 | + </tree> |
223 | + </field> |
224 | + </record> |
225 | + |
226 | <record id="bank_statement_reconcile_form_view2" model="ir.ui.view"> |
227 | <field name="name">account.bank.statement.reconcile.form</field> |
228 | <field name="model">account.bank.statement.reconcile</field> |
229 | |
230 | === modified file 'account_invoice_cash_discount/wizard/account_pay_invoice.py' |
231 | --- account_invoice_cash_discount/wizard/account_pay_invoice.py 2010-07-23 11:30:07 +0000 |
232 | +++ account_invoice_cash_discount/wizard/account_pay_invoice.py 2010-07-27 09:18:44 +0000 |
233 | @@ -66,8 +66,8 @@ |
234 | 'cal_method_selection': fields.selection([('method_gross_methodology','Calculate Discount with Net Gross Methodology'), |
235 | ('method_net_methodology','Calculate Discount with Net Methodology'),], |
236 | 'Method To Calculation'), |
237 | - 'discount_move_ids': fields.many2many('account.move.line', 'account_discount_move_rel', 'discount_account_id', 'discount_move_id', 'Account Discount Moves'), |
238 | - 'tax_move_ids': fields.many2many('account.move.line', 'account_tax_move_rel', 'tax_account_id', 'tax_move_id', 'Account Taxes Moves'), |
239 | + 'discount_move_ids': fields.many2many('account.move.line.memory', 'account_discount_move_rel', 'discount_account_id', 'discount_move_id', 'Account Discount Moves'), |
240 | + 'tax_move_ids': fields.many2many('account.move.line.memory', 'account_tax_move_rel', 'tax_account_id', 'tax_move_id', 'Account Taxes Moves'), |
241 | } |
242 | |
243 | def _get_period(self, cr, uid, context=None): |
244 | @@ -111,6 +111,135 @@ |
245 | account = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, account) |
246 | return account |
247 | |
248 | + def _get_discount_move(self, cr, uid, context=None): |
249 | + |
250 | + cur_obj = self.pool.get('res.currency') |
251 | + invoice_obj = self.pool.get('account.invoice') |
252 | + |
253 | + invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context) |
254 | + tax_obj = self.pool.get('account.tax') |
255 | + invoice_tax_obj = self.pool.get("account.invoice.tax") |
256 | + move_line_obj_memory = self.pool.get('account.move.line.memory') |
257 | + |
258 | + #### to get direction |
259 | + types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1} |
260 | + direction = types[invoice.type] |
261 | + date=time.strftime('%Y-%m-%d') |
262 | + |
263 | + #### to get name |
264 | + name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number |
265 | + ##### Entry in the discount account moves and entry in the tax account moves |
266 | + |
267 | + amount = 0.0 |
268 | + discount = 0.0 |
269 | + discount_line_ids = [] |
270 | + discount_account_id = False |
271 | + base_code_id = False |
272 | + |
273 | + discount = self._get_discount(cr, uid, context=context) |
274 | + discount_account_id = self._get_account(cr, uid, context=context) |
275 | + if discount>0.0: |
276 | + for line in invoice.invoice_line: |
277 | + tax_amount = 0.0 |
278 | + line_tax_amount = 0.0 |
279 | + |
280 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, line.price_subtotal, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
281 | + line_tax_amount = tax['amount'] |
282 | + |
283 | + line_total = line.price_subtotal + line_tax_amount |
284 | + invoice_res_amount = invoice.amount_total |
285 | + line_ratio = line_total / invoice_res_amount |
286 | + |
287 | + if line.invoice_line_tax_id: |
288 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, discount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
289 | + tax_amount = tax['amount'] |
290 | + tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
291 | + for tax_id in tax_invoice_id: |
292 | + tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
293 | + tax_account_id = tax_value.account_id.id |
294 | + base_code_id = tax_value.base_code_id.id |
295 | + |
296 | + if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
297 | + amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, tax_amount, context=context) |
298 | + |
299 | + discount_pay = discount * line_ratio |
300 | + if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
301 | + discount_amount = discount - tax_amount |
302 | + amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, discount_amount, context=context) |
303 | + |
304 | + l4 = { |
305 | + 'debit': direction * (discount_pay - tax_amount)<0 and - direction * (discount_pay - tax_amount), |
306 | + 'credit': direction * (discount_pay - tax_amount)>0 and direction * (discount_pay - tax_amount), |
307 | + 'account_id': discount_account_id, |
308 | + 'date': date, |
309 | + 'name':name, |
310 | + 'currency_id':invoice.currency_id.id or False, |
311 | + 'journal_id':invoice.journal_id.id, |
312 | + 'tax_code_id':base_code_id, |
313 | + 'tax_amount':tax_amount, |
314 | + 'amount_currency':amount and direction * amount or 0.0, |
315 | + 'analytic_account_id':line.account_analytic_id.id or False, |
316 | + } |
317 | + |
318 | + discount_line_id = move_line_obj_memory.create(cr, uid, l4, context=context) |
319 | + discount_line_ids.append(l4) |
320 | + return discount_line_ids |
321 | + |
322 | + def _get_taxes_move(self, cr, uid, context=None): |
323 | + cur_obj = self.pool.get('res.currency') |
324 | + invoice_obj = self.pool.get('account.invoice') |
325 | + invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context) |
326 | + tax_obj = self.pool.get('account.tax') |
327 | + invoice_tax_obj = self.pool.get("account.invoice.tax") |
328 | + move_line_obj_memory = self.pool.get('account.move.line.memory') |
329 | + |
330 | + #### to get direction |
331 | + types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1} |
332 | + direction = types[invoice.type] |
333 | + date=time.strftime('%Y-%m-%d') |
334 | + |
335 | + #### to get name |
336 | + name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number |
337 | + ##### Entry in the discount account moves and entry in the tax account moves |
338 | + amount = 0.0 |
339 | + discount = 0.0 |
340 | + line_ids = [] |
341 | + |
342 | + tax_code_id = False |
343 | + discount = self._get_discount(cr, uid, context=context) |
344 | + if discount>0.0: |
345 | + for line in invoice.invoice_line: |
346 | + tax_amount = 0.0 |
347 | + line_tax_amount = 0.0 |
348 | + if line.invoice_line_tax_id: |
349 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, discount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
350 | + tax_amount = tax['amount'] |
351 | + tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
352 | + for tax_id in tax_invoice_id: |
353 | + tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
354 | + tax_account_id = tax_value.account_id.id |
355 | + tax_code_id = tax_value.tax_code_id.id |
356 | + |
357 | + if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
358 | + amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, tax_amount, context=context) |
359 | + |
360 | + l3 = { |
361 | + 'debit': direction * tax_amount<0 and - direction * tax_amount, |
362 | + 'credit': direction * tax_amount>0 and direction * tax_amount, |
363 | + 'account_id': tax_account_id, |
364 | + 'date': date, |
365 | + 'journal_id':invoice.journal_id.id or False, |
366 | + 'name':name, |
367 | + 'currency_id':invoice.currency_id.id or False, |
368 | + 'tax_code_id':tax_value.tax_code_id.id, |
369 | + 'tax_amount':-tax_amount, |
370 | + 'amount_currency':amount and direction * amount or 0.0, |
371 | + 'analytic_account_id':line.account_analytic_id.id or False, |
372 | + } |
373 | + line_id = move_line_obj_memory.create(cr, uid, l3, context=context) |
374 | + line_ids.append(l3) |
375 | + return line_ids |
376 | + |
377 | _defaults = { |
378 | 'date': lambda *a: time.strftime('%Y-%m-%d'), |
379 | 'period_id': _get_period, |
380 | @@ -119,9 +248,11 @@ |
381 | 'account_id':_get_account, |
382 | 'cash_residual_amount': lambda *a:0.0, |
383 | 'cal_method_selection':lambda *a :'method_gross_methodology', |
384 | + 'discount_move_ids':_get_discount_move, |
385 | + 'tax_move_ids':_get_taxes_move, |
386 | } |
387 | |
388 | - def on_change_ammount(self, cr, uid, ids, amount, context=None): |
389 | + def on_change_ammount(self, cr, uid, ids, amount, cash_amount, context=None): |
390 | """ |
391 | Function return the Discount according to the Amount paid and Payment Term Cash Discount |
392 | """ |
393 | @@ -131,10 +262,8 @@ |
394 | cal_amount = obj_inv._get_amount(cr, uid, [context['id']] ,invoice.residual, invoice.payment_term.id, context=context) |
395 | |
396 | old_cal_amount = cal_amount['amount'] |
397 | - discount = obj_inv._get_payment(cr, uid, [context['id']] , old_cal_amount, invoice.payment_term.id, context=context) |
398 | old_amount = old_cal_amount |
399 | - diff_amount = round(old_amount - (amount + discount),2) |
400 | - |
401 | + diff_amount = round(old_amount - (amount + cash_amount),2) |
402 | return {'value' : {'cash_residual_amount':diff_amount}} |
403 | |
404 | def on_change_cash_discount_amount(self, cr, uid, ids, discount_amount, amount, context=None): |
405 | @@ -153,35 +282,13 @@ |
406 | return {'value' : {'cash_amount':discount_amount,'cash_residual_amount':diff_amount}} |
407 | |
408 | def _calculation(self, cr, uid, ids, context=None): |
409 | - |
410 | + cur_obj = self.pool.get('res.currency') |
411 | invoice_obj = self.pool.get('account.invoice') |
412 | data = self.read(cr, uid, ids,context=context)[0] |
413 | invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context) |
414 | tax_obj = self.pool.get('account.tax') |
415 | invoice_tax_obj = self.pool.get("account.invoice.tax") |
416 | - move_obj = self.pool.get('account.move') |
417 | - move_line_obj = self.pool.get('account.move.line') |
418 | - |
419 | - ############## Delete another lines of taxes and discount |
420 | - if data['tax_move_ids']: |
421 | - move_line = data['tax_move_ids'] |
422 | - for move_line_id in move_line: |
423 | - move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id |
424 | - move_line_obj.unlink(cr, uid,[move_line_id]) |
425 | - move_obj.unlink(cr, uid,[move_id]) |
426 | - |
427 | - if data['discount_move_ids']: |
428 | - discount_move_line = data['discount_move_ids'] |
429 | - for move_line_id in discount_move_line: |
430 | - move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id |
431 | - move_line_obj.unlink(cr, uid,[move_line_id]) |
432 | - move_obj.unlink(cr, uid,[move_id]) |
433 | - |
434 | - ######## to get ref |
435 | - if invoice.type in ('in_invoice', 'in_refund'): |
436 | - ref = invoice.reference |
437 | - else: |
438 | - ref = invoice_obj._convert_ref(cr, uid, invoice.number) |
439 | + move_line_obj_memory = self.pool.get('account.move.line.memory') |
440 | |
441 | #### to get direction |
442 | types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1} |
443 | @@ -192,84 +299,102 @@ |
444 | name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number |
445 | ##### Entry in the discount account moves and entry in the tax account moves |
446 | |
447 | - if data.get('cash_amount',0.0)>0.0: |
448 | - tax_total_amount = 0.0 |
449 | - amount = 0.0 |
450 | - discount = 0.0 |
451 | - line_ids = [] |
452 | - discount_line_ids = [] |
453 | + if data.get('cash_amount', 0.0) <= 0.0: |
454 | + return True |
455 | + |
456 | + tax_total_amount = 0.0 |
457 | + amount = 0.0 |
458 | + discount = 0.0 |
459 | + line_ids = [] |
460 | + discount_line_ids = [] |
461 | |
462 | - discount_account_id = False |
463 | - tax_code_id = False |
464 | + discount_account_id = False |
465 | + tax_code_id = False |
466 | + base_code_id = False |
467 | + |
468 | + for line in invoice.invoice_line: |
469 | + tax_amount = 0.0 |
470 | + line_tax_amount = 0.0 |
471 | |
472 | - for line in invoice.invoice_line: |
473 | - tax_amount = 0.0 |
474 | - line_tax_amount = 0.0 |
475 | - |
476 | - #####get the ratio of the line in the total invoice amount |
477 | - for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, line.price_subtotal, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
478 | - line_tax_amount = tax['amount'] |
479 | - line_total = line.price_subtotal + line_tax_amount |
480 | - invoice_res_amount = invoice.amount_total |
481 | - line_ratio = line_total / invoice_res_amount |
482 | - ########################### |
483 | - |
484 | - if line.invoice_line_tax_id: |
485 | - for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, data['cash_amount'], line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
486 | - tax_amount = tax['amount'] |
487 | - tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
488 | - for tax_id in tax_invoice_id: |
489 | - tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
490 | - tax_account_id = tax_value.account_id.id |
491 | - tax_code_id = tax_value.tax_code_id.id |
492 | - |
493 | - l3 = { |
494 | - 'debit': direction * tax_amount<0 and - direction * tax_amount, |
495 | - 'credit': direction * tax_amount>0 and direction * tax_amount, |
496 | - 'account_id': tax_account_id, |
497 | - 'partner_id': invoice.partner_id.id, |
498 | - 'ref':ref, |
499 | - 'date': date, |
500 | - 'journal_id':data.get('journal_id',False) , |
501 | - 'period_id':data.get('period_id',False), |
502 | - 'name':name, |
503 | - 'tax_code_id':tax_value.tax_code_id.id, |
504 | - 'tax_amount':-tax_amount, |
505 | - } |
506 | - line_id = move_line_obj.create(cr, uid, l3, context=context) |
507 | - line_ids.append(line_id) |
508 | - |
509 | - ### if calculation on the Net Methology then in discount field it will take product income account or product category income account |
510 | - |
511 | - if data['cal_method_selection'] == 'method_net_methodology': |
512 | + #####get the ratio of the line in the total invoice amount |
513 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, line.price_subtotal, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
514 | + line_tax_amount = tax['amount'] |
515 | + line_total = line.price_subtotal + line_tax_amount |
516 | + invoice_res_amount = invoice.amount_total |
517 | + line_ratio = line_total / invoice_res_amount |
518 | + ########################### |
519 | + if line.invoice_line_tax_id: |
520 | + for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, data['cash_amount'], line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
521 | + tax_amount = tax['amount'] |
522 | + tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])]) |
523 | + for tax_id in tax_invoice_id: |
524 | + tax_value = invoice_tax_obj.browse(cr, uid, tax_id) |
525 | + tax_account_id = tax_value.account_id.id |
526 | + tax_code_id = tax_value.tax_code_id.id |
527 | + base_code_id = tax_value.base_code_id.id |
528 | + |
529 | + if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
530 | + amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, tax_amount, context=context) |
531 | + |
532 | + l3 = { |
533 | + 'debit': direction * tax_amount<0 and - direction * tax_amount, |
534 | + 'credit': direction * tax_amount>0 and direction * tax_amount, |
535 | + 'account_id': tax_account_id, |
536 | + 'date': date, |
537 | + 'journal_id':data.get('journal_id',False) , |
538 | + 'name':name, |
539 | + 'currency_id':invoice.currency_id.id or False, |
540 | + 'tax_code_id':tax_value.tax_code_id.id, |
541 | + 'tax_amount':-tax_amount, |
542 | + 'amount_currency':amount and direction * amount or 0.0, |
543 | + 'analytic_account_id':line.account_analytic_id.id or False, |
544 | + } |
545 | + line_id = move_line_obj_memory.create(cr, uid, l3, context=context) |
546 | + line_ids.append(line_id) |
547 | + |
548 | + ### if calculation on the Net Methology then in discount field it will take product income account or product category income account |
549 | + if data['cal_method_selection'] == 'method_net_methodology': |
550 | + if invoice.type == 'in_invoice': |
551 | if line.product_id.property_account_income: |
552 | discount_account_id = line.product_id.property_account_income.id |
553 | else: |
554 | discount_account_id = line.product_id.categ_id.property_account_income_categ.id |
555 | else: |
556 | - discount_account_id = data['account_id'] |
557 | - |
558 | - discount = data['cash_amount'] * line_ratio |
559 | - l4 = { |
560 | - 'debit': direction * (discount - tax_amount)<0 and - direction * (discount - tax_amount), |
561 | - 'credit': direction * (discount - tax_amount)>0 and direction * (discount - tax_amount), |
562 | - 'account_id': discount_account_id, |
563 | - 'partner_id': invoice.partner_id.id, |
564 | - 'ref':ref, |
565 | - 'date': date, |
566 | - 'name':name, |
567 | - 'journal_id':data.get('journal_id',False), |
568 | - 'period_id':data.get('period_id',False), |
569 | - 'tax_code_id':tax_code_id, |
570 | - 'tax_amount':-tax_amount, |
571 | - } |
572 | - |
573 | - discount_line_id = move_line_obj.create(cr, uid, l4, context=context) |
574 | - discount_line_ids.append(discount_line_id) |
575 | - |
576 | - self.write(cr, uid, ids, {'tax_move_ids':[(6,0,line_ids)]}, context) |
577 | - self.write(cr, uid, ids, {'discount_move_ids':[(6,0,discount_line_ids)]}, context) |
578 | - |
579 | + if line.product_id.property_account_income: |
580 | + discount_account_id = line.product_id.property_account_expense.id |
581 | + else: |
582 | + discount_account_id = line.product_id.categ_id.property_account_expense_categ.id |
583 | + |
584 | + else: |
585 | + discount_account_id = data['account_id'] |
586 | + |
587 | + discount = data['cash_amount'] * line_ratio |
588 | + if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
589 | + discount_amount = discount - tax_amount |
590 | + amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, discount_amount, context=context) |
591 | + |
592 | + l4 = { |
593 | + 'debit': direction * (discount - tax_amount)<0 and - direction * (discount - tax_amount), |
594 | + 'credit': direction * (discount - tax_amount)>0 and direction * (discount - tax_amount), |
595 | + 'account_id': discount_account_id, |
596 | + 'date': date, |
597 | + 'name':name, |
598 | + 'currency_id':invoice.currency_id.id or False, |
599 | + 'journal_id':data.get('journal_id',False), |
600 | + 'tax_code_id':base_code_id, |
601 | + 'tax_amount':tax_amount, |
602 | + 'amount_currency':amount and direction * amount or 0.0, |
603 | + 'analytic_account_id':line.account_analytic_id.id or False, |
604 | + } |
605 | + |
606 | + discount_line_id = move_line_obj_memory.create(cr, uid, l4, context=context) |
607 | + discount_line_ids.append(discount_line_id) |
608 | + |
609 | + self.write(cr, uid, ids, |
610 | + {'tax_move_ids':[(6,0,line_ids)], |
611 | + 'discount_move_ids' : [(6, 0, discount_line_ids)], |
612 | + }, context=context) |
613 | + |
614 | return True |
615 | |
616 | def default_get(self, cr, uid, fields, context=None): |
617 | @@ -282,35 +407,79 @@ |
618 | def _message(self, cr, uid, ids, context=None): |
619 | mod_obj = self.pool.get('ir.model.data') |
620 | data = self.read(cr, uid, ids,context=context)[0] |
621 | + invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context) |
622 | + |
623 | if data.get('discount_move_ids',False): |
624 | context.update({'discount_move_ids':data['discount_move_ids']}) |
625 | - |
626 | - if data.get('id',False): |
627 | - context.update({'t_ids':ids}) |
628 | - |
629 | if data.get('tax_move_ids',False): |
630 | context.update({'tax_move_ids':data['tax_move_ids']}) |
631 | - |
632 | if data.get('amount',False): |
633 | context.update({'amount':data['amount']}) |
634 | - |
635 | if data.get('cash_amount',False): |
636 | context.update({'cash_amount':data['cash_amount']}) |
637 | - |
638 | + |
639 | + total_data_amount = 0.00 |
640 | + total_invoice_amount = 0.00 |
641 | + total_data_amount = data['amount'] + data['cash_amount'] |
642 | + total_invoice_amount = invoice.residual |
643 | + |
644 | + |
645 | model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_message')], context=context) |
646 | resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] |
647 | - |
648 | - return { |
649 | - 'name': _('Message'), |
650 | - 'context': context, |
651 | - 'view_type': 'form', |
652 | - 'view_mode': 'form', |
653 | - 'res_model': 'account.message', |
654 | - 'views': [(resource_id,'form')], |
655 | - 'type': 'ir.actions.act_window', |
656 | - 'target': 'new', |
657 | - } |
658 | - |
659 | + if self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id,(total_invoice_amount - total_data_amount)): |
660 | + self.pool.get('account.invoice.pay').pay_and_reconcile(cr, uid, ids, context=context) |
661 | + return {} |
662 | + else: |
663 | + return { |
664 | + 'name': _('Message'), |
665 | + 'context': context, |
666 | + 'view_type': 'form', |
667 | + 'view_mode': 'form', |
668 | + 'res_model': 'account.message', |
669 | + 'views': [(resource_id,'form')], |
670 | + 'type': 'ir.actions.act_window', |
671 | + 'target': 'new', |
672 | + } |
673 | + |
674 | + |
675 | + def _message_partial(self, cr, uid, ids, context=None): |
676 | + mod_obj = self.pool.get('ir.model.data') |
677 | + data = self.read(cr, uid, ids,context=context)[0] |
678 | + invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context) |
679 | + |
680 | + total_data_amount = 0.0 |
681 | + total_invoice_amount = 0.0 |
682 | + |
683 | + if data.get('discount_move_ids',False): |
684 | + context.update({'discount_move_ids':data['discount_move_ids']}) |
685 | + if data.get('tax_move_ids',False): |
686 | + context.update({'tax_move_ids':data['tax_move_ids']}) |
687 | + |
688 | + if data.get('amount',False): |
689 | + context.update({'amount':data['amount']}) |
690 | + if data.get('cash_amount',False): |
691 | + context.update({'cash_amount':data['cash_amount']}) |
692 | + |
693 | + total_data_amount = data['amount'] + data['cash_amount'] |
694 | + total_invoice_amount = invoice.residual |
695 | + |
696 | + if self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id,(total_invoice_amount - total_data_amount)): |
697 | + model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_partial_message')], context=context) |
698 | + resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] |
699 | + return { |
700 | + 'name': _('Message'), |
701 | + 'context': context, |
702 | + 'view_type': 'form', |
703 | + 'view_mode': 'form', |
704 | + 'res_model': 'account.partial.message', |
705 | + 'views': [(resource_id,'form')], |
706 | + 'type': 'ir.actions.act_window', |
707 | + 'target': 'new', |
708 | + } |
709 | + else: |
710 | + self.pool.get('account.invoice.pay').pay_and_reconcile(cr, uid, ids, context=context) |
711 | + return {} |
712 | + |
713 | def wo_check(self, cr, uid, ids, context=None): |
714 | cur_obj = self.pool.get('res.currency') |
715 | mod_obj = self.pool.get('ir.model.data') |
716 | @@ -347,32 +516,10 @@ |
717 | debit+=payment.debit |
718 | credit+=payment.credit |
719 | amount_paid+=abs(debit-credit) |
720 | - |
721 | - # Test if there is a difference according to currency rouding setting |
722 | -# amount = obj_inv._get_amount(cr, uid, [context['id']] ,invoice.residual, invoice.payment_term.id, context=context) |
723 | -# |
724 | -# found_h = amount['found'] |
725 | -# |
726 | -# if found_h: |
727 | - |
728 | - ####### Here when we do make full payment then to get the previous Discount and Tax Move added in context |
729 | - if context.get('discount_move_ids',False): |
730 | - context.update({'discount_move_ids':context['discount_move_ids']}) |
731 | - if context.get('tax_move_ids',False): |
732 | - context.update({'tax_move_ids':context['tax_move_ids']}) |
733 | - if context.get('amount',False): |
734 | - context.update({'amount':context['amount']}) |
735 | - if context.get('cash_amount',False): |
736 | - context.update({'cash_amount':context['cash_amount']}) |
737 | - if context.get('t_ids',False): |
738 | - ids = context['t_ids'] |
739 | -# return self.pay_and_reconcile(cr, uid, ids, context=context) |
740 | -# else: |
741 | - |
742 | - if self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id, |
743 | - (amount_paid - inv_amount_company_currency)) or data['cash_residual_amount'] == 0.0: |
744 | + |
745 | + if data['cash_residual_amount'] == 0.0 or self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id, |
746 | + (amount_paid - inv_amount_company_currency)): |
747 | return self.pay_and_reconcile(cr, uid, ids, context=context) |
748 | - |
749 | else: |
750 | model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_invoice_pay_writeoff')], context=context) |
751 | resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] |
752 | @@ -401,7 +548,7 @@ |
753 | writeoff_account_id = context['write_off']['writeoff_acc_id'] |
754 | writeoff_journal_id = context['write_off']['writeoff_journal_id'] |
755 | comment = context['write_off']['comment'] |
756 | - |
757 | + |
758 | if context.get('amount',False): |
759 | amount = context['amount'] + context.get('cash_amount',0.0) |
760 | else: |
761 | @@ -421,6 +568,7 @@ |
762 | else: |
763 | context.update({'amount_currency':data['amount'] + data['cash_amount'],'currency_id':currency_id}) |
764 | |
765 | + |
766 | if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
767 | ctx = {'date':data['date']} |
768 | amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, amount, context=ctx) |
769 | @@ -442,21 +590,11 @@ |
770 | context.update({'tax_move_ids':context['tax_move_ids']}) |
771 | else: |
772 | context.update({'tax_move_ids':data['tax_move_ids']}) |
773 | - |
774 | + |
775 | if context.get('cash_amount',False): |
776 | - cash_amount = context['cash_amount'] |
777 | context.update({'cash_amount':context['cash_amount']}) |
778 | else: |
779 | - cash_amount = data['cash_amount'] |
780 | context.update({'cash_amount':data['cash_amount']}) |
781 | - |
782 | - if journal.currency and invoice.company_id.currency_id.id<>journal.currency.id: |
783 | - cash_amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, cash_amount, context=ctx) |
784 | - context.update({'cash_amount':cash_amount}) |
785 | - |
786 | - if invoice.company_id.currency_id.id<>invoice.currency_id.id: |
787 | - cash_amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, cash_amount, context=ctx) |
788 | - context.update({'cash_amount':cash_amount}) |
789 | |
790 | acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id |
791 | if not acc_id: |
792 | @@ -468,7 +606,6 @@ |
793 | return {} |
794 | |
795 | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False): |
796 | - |
797 | res = super(account_invoice_pay,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar) |
798 | fields=res.get('fields',{}) |
799 | word = "Supplier Cash Discount Account" |
800 | @@ -481,29 +618,26 @@ |
801 | res['fields'][f]['string'] = res['fields'][f]['string'].replace('Customers Cash Discount Account',word) |
802 | return res |
803 | |
804 | - def _cancel_line(self, cr, uid, ids, context=None): |
805 | - move_obj = self.pool.get('account.move') |
806 | - move_line_obj = self.pool.get('account.move.line') |
807 | - data = self.read(cr, uid, ids,context=context)[0] |
808 | - |
809 | - if data['tax_move_ids']: |
810 | - move_line = data['tax_move_ids'] |
811 | - for move_line_id in move_line: |
812 | - move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id |
813 | - move_line_obj.unlink(cr, uid,[move_line_id]) |
814 | - move_obj.unlink(cr, uid,[move_id]) |
815 | - |
816 | - if data['discount_move_ids']: |
817 | - discount_move_line = data['discount_move_ids'] |
818 | - for move_line_id in discount_move_line: |
819 | - move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id |
820 | - move_line_obj.unlink(cr, uid,[move_line_id]) |
821 | - move_obj.unlink(cr, uid,[move_id]) |
822 | - |
823 | - return {} |
824 | - |
825 | account_invoice_pay() |
826 | |
827 | +class account_move_line_memory(osv.osv_memory): |
828 | + _name= "account.move.line.memory" |
829 | + _description = "Account move line memory " |
830 | + _columns = { |
831 | + 'date': fields.date('Effective Date', required=True), |
832 | + 'name': fields.char('Name', size=64, required=True), |
833 | + 'account_id': fields.many2one('account.account', 'Account',), |
834 | + 'journal_id': fields.many2one('account.journal', 'Journal', required=True, select=1), |
835 | + 'debit': fields.float('Debit', digits=(16,2)), |
836 | + 'credit': fields.float('Credit', digits=(16,2)), |
837 | + 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or tax code account."), |
838 | + 'tax_amount': fields.float('Tax/Base Amount', digits=(16,2), select=True), |
839 | + 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."), |
840 | + 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry."), |
841 | + 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account'), |
842 | + } |
843 | +account_move_line_memory() |
844 | + |
845 | class account_message(osv.osv_memory): |
846 | _name = "account.message" |
847 | def _check(self, cr, uid, ids, context=None): |
848 | @@ -511,6 +645,15 @@ |
849 | result = self.pool.get('account.invoice.pay').wo_check(cr, uid, ids, context=context) |
850 | return result |
851 | |
852 | -account_message() |
853 | +account_message() |
854 | + |
855 | +class account_partial_message(osv.osv_memory): |
856 | + _name = "account.partial.message" |
857 | + def _check_partial(self, cr, uid, ids, context=None): |
858 | + data = self.read(cr, uid, ids,context=context)[0] |
859 | + result = self.pool.get('account.invoice.pay').pay_and_reconcile(cr, uid, ids, context=context) |
860 | + return result |
861 | + |
862 | +account_partial_message() |
863 | |
864 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
865 | \ No newline at end of file |
866 | |
867 | === modified file 'account_invoice_cash_discount/wizard/account_pay_invoice_view.xml' |
868 | --- account_invoice_cash_discount/wizard/account_pay_invoice_view.xml 2010-07-28 12:20:14 +0000 |
869 | +++ account_invoice_cash_discount/wizard/account_pay_invoice_view.xml 2010-07-27 09:18:44 +0000 |
870 | @@ -8,7 +8,7 @@ |
871 | <field name="arch" type="xml"> |
872 | <form string="Pay invoice"> |
873 | <group colspan="4" > |
874 | - <field name="amount" on_change="on_change_ammount(amount,context)"/> |
875 | + <field name="amount" on_change="on_change_ammount(amount,cash_amount,context)"/> |
876 | <field name="cash_residual_amount"/> |
877 | <field name="name"/> |
878 | <field name="date"/> |
879 | @@ -32,8 +32,8 @@ |
880 | </group> |
881 | <group colspan="4" col="6"> |
882 | <label string ="" colspan="2"/> |
883 | - <button icon="gtk-cancel" string="Cancel" name="_cancel_line" type="object"/> |
884 | - <button icon="gtk-execute" string="Partial Payment" name="pay_and_reconcile" type="object"/> |
885 | + <button icon="gtk-cancel" special="cancel" string="Cancel"/> |
886 | + <button icon="gtk-execute" string="Partial Payment" name="_message_partial" type="object"/> |
887 | <button icon="gtk-execute" string="Full-Payment" name="_message" type="object"/> |
888 | </group> |
889 | </form> |
890 | @@ -71,14 +71,62 @@ |
891 | </field> |
892 | </record> |
893 | |
894 | + <record id="view_account_move_line_memory" model="ir.ui.view"> |
895 | + <field name="name">account.move.line.memory.form</field> |
896 | + <field name="model">account.move.line.memory</field> |
897 | + <field name="type">tree</field> |
898 | + <field name="arch" type="xml"> |
899 | + <tree string="Account Move Line"> |
900 | + <field name="date"/> |
901 | + <field name="name"/> |
902 | + <field name="account_id"/> |
903 | + <field name="journal_id"/> |
904 | + <field name="debit"/> |
905 | + <field name="credit"/> |
906 | + <field name="tax_code_id"/> |
907 | + <field name="tax_amount"/> |
908 | + <field name="currency_id"/> |
909 | + <field name="amount_currency"/> |
910 | + <field name="analytic_account_id"/> |
911 | + </tree> |
912 | + </field> |
913 | + </record> |
914 | + |
915 | <record id="view_account_message" model="ir.ui.view"> |
916 | <field name="name">account.message.form</field> |
917 | <field name="model">account.message</field> |
918 | <field name="type">form</field> |
919 | <field name="arch" type="xml"> |
920 | - <form string="Your Messages"> |
921 | - <label colspan="8" string="Are you really want to reconcile this invoice" /> |
922 | - <button icon="gtk-execute" string="OK" name="_check" type="object"/> |
923 | + <form string="Messages"> |
924 | + <group> |
925 | + <separator string="Full Payment" colspan="4"/> |
926 | + <label string ="Are you really want to reconcile this invoice. |
927 | + The proposed payment does not cover 100 percent of the invoice. |
928 | + Please check payment term lines. Normally a user would click |
929 | + on Partial Payment to avoid ready / paid state for this invoice." colspan="2"/> |
930 | + <newline/> |
931 | + <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/> |
932 | + <button icon="gtk-execute" string="OK" name="_check" type="object" colspan="1"/> |
933 | + </group> |
934 | + </form> |
935 | + </field> |
936 | + </record> |
937 | + |
938 | + <record id="view_account_partial_message" model="ir.ui.view"> |
939 | + <field name="name">account.partial.message.form</field> |
940 | + <field name="model">account.partial.message</field> |
941 | + <field name="type">form</field> |
942 | + <field name="arch" type="xml"> |
943 | + <form string="Messages"> |
944 | + <group> |
945 | + <separator string="Partial Payment" colspan="4"/> |
946 | + <label string ="Don't you really want to reconcile this invoice. |
947 | + The proposed payment balances this invoice. Please check payment term lines. |
948 | + Normally a user would click on Full Payment to receive ready / paid state for this invoice." colspan="2"/> |
949 | + <newline/> |
950 | + <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/> |
951 | + <button icon="gtk-execute" string="OK" name="_check_partial" type="object" colspan="1"/> |
952 | + </group> |
953 | </form> |
954 | </field> |
955 | </record> |