Merge lp:~openbig/bigconsulting/milestone1 into lp:bigconsulting

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
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.

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
=== modified file 'account_invoice_cash_discount/__terp__.py'
--- account_invoice_cash_discount/__terp__.py 2010-06-30 07:25:25 +0000
+++ account_invoice_cash_discount/__terp__.py 2010-07-27 09:18:44 +0000
@@ -20,7 +20,7 @@
20#20#
21##############################################################################21##############################################################################
22{22{
23 "name" : "Payement Term with Cash Discount",23 "name" : "Payment Term with Cash Discount",
24 "version" : "1.0",24 "version" : "1.0",
25 "depends" : ["account",],25 "depends" : ["account",],
26 "author" : "Big Consulting",26 "author" : "Big Consulting",
2727
=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py'
--- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-07-23 11:30:07 +0000
+++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-07-27 09:18:44 +0000
@@ -45,8 +45,6 @@
45 'payment_id': fields.many2one('account.payment.term','Associated Payment Term'),45 'payment_id': fields.many2one('account.payment.term','Associated Payment Term'),
46 'credit_account_id': fields.many2one('account.account', 'Credit Account'),46 'credit_account_id': fields.many2one('account.account', 'Credit Account'),
47 'debit_account_id': fields.many2one('account.account', 'Debit Account'),47 'debit_account_id': fields.many2one('account.account', 'Debit Account'),
48# 'payment_term_ids': fields.one2many('account.payment.term.line', 'cash_account_discount_id', 'Payment Term Lines'),
49# 'day_tolerance': fields.integer('Days Tolerance', digits=(16,6),required=True),
50 'sup_discount_account_id': fields.many2one('account.account', 'Supplier Discount Account',required=True),48 'sup_discount_account_id': fields.many2one('account.account', 'Supplier Discount Account',required=True),
51 }49 }
52account_cash_discount()50account_cash_discount()
@@ -54,7 +52,6 @@
54class account_payment_term_line(osv.osv):52class account_payment_term_line(osv.osv):
55 _inherit = "account.payment.term.line"53 _inherit = "account.payment.term.line"
56 _columns = {54 _columns = {
57# 'cash_account_discount_id': fields.many2one('account.cash.discount', 'Discount Lines',),
58 'day_tolerance': fields.integer('Days Tolerance', digits=(16,6),required=True),55 'day_tolerance': fields.integer('Days Tolerance', digits=(16,6),required=True),
59 'payment_id': fields.many2one('account.payment.term', 'Payment Term', required=False, select=True),56 'payment_id': fields.many2one('account.payment.term', 'Payment Term', required=False, select=True),
60 'compl_cash_discount':fields.boolean('Use Complete Cash Discount'),57 'compl_cash_discount':fields.boolean('Use Complete Cash Discount'),
@@ -115,6 +112,8 @@
115 res = resudial_amonut112 res = resudial_amonut
116 amount = res113 amount = res
117 dis = payment_line.days114 dis = payment_line.days
115 else:
116 amount = resudial_amonut
118 117
119 return {'amount':amount,'tol_days':tol_days,'found':payment_line_found}118 return {'amount':amount,'tol_days':tol_days,'found':payment_line_found}
120 119
@@ -223,6 +222,7 @@
223 invoice_tax_obj = self.pool.get("account.invoice.tax")222 invoice_tax_obj = self.pool.get("account.invoice.tax")
224 move_line_obj = self.pool.get('account.move.line')223 move_line_obj = self.pool.get('account.move.line')
225 move_obj = self.pool.get('account.move')224 move_obj = self.pool.get('account.move')
225 move_line_obj_memory = self.pool.get('account.move.line.memory')
226 226
227 amount_discount = 0.0 227 amount_discount = 0.0
228 if invoice.payment_term:228 if invoice.payment_term:
@@ -298,23 +298,21 @@
298 if 'tax_move_ids' in context and context['tax_move_ids']:298 if 'tax_move_ids' in context and context['tax_move_ids']:
299 move_line = context['tax_move_ids']299 move_line = context['tax_move_ids']
300 for move_line_id in move_line:300 for move_line_id in move_line:
301 move_line_data = move_line_obj.browse(cr, uid,move_line_id)301 move_line_data = move_line_obj_memory.browse(cr, uid,move_line_id)
302 l3 = {302 l3 = {
303 'debit': move_line_data.debit,303 'debit': move_line_data.debit,
304 'credit': move_line_data.credit,304 'credit': move_line_data.credit,
305 'account_id': move_line_data.account_id.id,305 'account_id': move_line_data.account_id.id,
306 'partner_id': move_line_data.partner_id.id,306 'partner_id': invoice.partner_id.id,
307 'ref':move_line_data.ref,307 'ref':ref,
308 'date': move_line_data.date,308 'date': move_line_data.date,
309 'currency_id':currency_id,309 'currency_id':move_line_data.currency_id.id,
310 'amount_currency':amount_currency and direction * amount_currency or 0.0,310 'amount_currency':move_line_data.amount_currency and direction * move_line_data.amount_currency or 0.0,
311 'name':move_line_data.name,311 'name':move_line_data.name,
312 'tax_code_id':move_line_data.tax_code_id.id,312 'tax_code_id':move_line_data.tax_code_id.id,
313 'tax_amount':move_line_data.tax_amount,313 'tax_amount':move_line_data.tax_amount,
314 }314 }
315 lines.append((0, 0, l3))315 lines.append((0, 0, l3))
316 move_line_obj.unlink(cr, uid,[move_line_id])
317 move_obj.unlink(cr, uid,[move_line_data.move_id.id])
318 else:316 else:
319 if amount_discount>0.0: 317 if amount_discount>0.0:
320 for line in invoice.invoice_line:318 for line in invoice.invoice_line:
@@ -345,44 +343,60 @@
345 if 'discount_move_ids' in context and context['discount_move_ids']: 343 if 'discount_move_ids' in context and context['discount_move_ids']:
346 move_line = context['discount_move_ids']344 move_line = context['discount_move_ids']
347 for move_line_id in move_line:345 for move_line_id in move_line:
348 move_line_data = move_line_obj.browse(cr, uid,move_line_id)346 move_line_data = move_line_obj_memory.browse(cr, uid, move_line_id)
349 l4 = {347 l4 = {
350 'debit': move_line_data.debit,348 'debit': move_line_data.debit,
351 'credit':move_line_data.credit,349 'credit':move_line_data.credit,
352 'account_id': move_line_data.account_id.id,350 'account_id': move_line_data.account_id.id,
353 'partner_id': move_line_data.partner_id.id,351 'partner_id': invoice.partner_id.id,
354 'ref':move_line_data.ref,352 'ref':ref,
355 'date': move_line_data.date,353 'date': move_line_data.date,
356 'currency_id':currency_id,354 'currency_id':move_line_data.currency_id.id,
357 'amount_currency':amount_currency and direction * amount_currency or 0.0,355 'amount_currency':move_line_data.amount_currency and direction * move_line_data.amount_currency or 0.0,
358 'name':move_line_data.name,356 'name':move_line_data.name,
359 'tax_code_id':move_line_data.tax_code_id.id,357 'tax_code_id':move_line_data.tax_code_id.id,
360 'tax_amount':move_line_data.tax_amount,358 'tax_amount':move_line_data.tax_amount,
361 }359 }
362 lines.append((0, 0, l4))360 lines.append((0, 0, l4))
363 move_line_obj.unlink(cr, uid,[move_line_id])361
364 move_obj.unlink(cr, uid,[move_line_data.move_id.id])
365 else:362 else:
366 if amount_discount>0:363 if amount_discount>0:
364 account_id = False
367 if 'account_id' in context and context['account_id']:365 if 'account_id' in context and context['account_id']:
368 account_id = context['account_id'] 366 account_id = context['account_id']
369 if tax_total_amount>0:367# if tax_total_amount>0:
370 amount_discount = (amount_discount - tax_total_amount)368# amount_discount = (amount_discount - tax_total_amount)
371 else:369# else:
372 amount_discount = amount_discount370# amount_discount = amount_discount
373 l4 = {371 for line in invoice.invoice_line:
374 'debit': direction * amount_discount<0 and - direction * amount_discount,372 line_tax_amount = 0.0
375 'credit': direction * amount_discount>0 and direction * amount_discount,373 tax_amount = 0.0
376 'account_id': account_id,374 discount = 0.0
377 'partner_id': invoice.partner_id.id,375 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):
378 'ref':ref,376 line_tax_amount = tax['amount']
379 'date': date,377
380 'currency_id':currency_id,378 line_total = line.price_subtotal + line_tax_amount
381 'amount_currency':amount_currency and direction * amount_currency or 0.0,379 invoice_res_amount = invoice.amount_total
382 }380 line_ratio = line_total / invoice_res_amount
383 l4['name'] = name381
384 lines.append((0, 0, l4))382 discount = amount_discount * line_ratio
385 383
384 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):
385 tax_amount = tax['amount']
386
387 l4 = {
388 'debit': direction * (discount - tax_amount)<0 and - direction * (discount - tax_amount),
389 'credit': direction * (discount - tax_amount)>0 and direction * (discount - tax_amount),
390 'account_id': account_id,
391 'partner_id': invoice.partner_id.id,
392 'ref':ref,
393 'date': date,
394 'currency_id':currency_id,
395 'amount_currency':amount_currency and direction * amount_currency or 0.0,
396 }
397 l4['name'] = name
398 lines.append((0, 0, l4))
399
386 move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date}400 move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date}
387 move_id = move_obj.create(cr, uid, move, context=context)401 move_id = move_obj.create(cr, uid, move, context=context)
388 402
@@ -407,25 +421,16 @@
407 421
408account_invoice()422account_invoice()
409423
410class account_move_line(osv.osv):424class account_bank_statement_reconcile(osv.osv):
411 _name = 'account.move.line'425 _inherit='account.bank.statement.reconcile'
412 _inherit = 'account.move.line'426 def name_get(self, cursor, user, ids, context=None):
413 427 res = []
414 def _invoice(self, cr, uid, ids, name, arg, context=None):428 res = super(account_bank_statement_reconcile, self).name_get(cursor, user, ids, context)
415 res = {}429 for o in self.browse(cursor, user, ids, context=context):
416 if ids:430 data = res[0][1] + o.name
417 return super(account_move_line, self)._invoice(cr, uid, ids, name, arg, context)431 res.append((o.id,data))
418 else:432 return res
419 return res433account_bank_statement_reconcile()
420
421 def _invoice_search(self, cr, uid, obj, name, args, context={}):
422 return super(account_move_line, self)._invoice_search(cr, uid, obj, name, args, context=context)
423
424 _columns = {
425 'invoice': fields.function(_invoice, method=True, string='Invoice',
426 type='many2one', relation='account.invoice', fnct_search=_invoice_search),
427 }
428account_move_line()
429434
430# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:435# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
431436
432437
=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount_view.xml'
--- account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-23 12:13:39 +0000
+++ account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-07-27 09:18:44 +0000
@@ -72,6 +72,22 @@
72 </field>72 </field>
73 </record>73 </record>
74 74
75 <record id="view_bank_statement_reconcile_tree" model="ir.ui.view">
76 <field name="name">account.bank.statement.reconcile.tree</field>
77 <field name="model">account.bank.statement.reconcile</field>
78 <field name="type">tree</field>
79 <field name="arch" type="xml">
80 <tree string="Reconcile">
81 <field name="name" select="1"/>
82 <field name="total_amount"/>
83 <field name="total_currency"/>
84 <field name="total_entry"/>
85 <field name="total_new"/>
86 <field name="total_balance"/>
87 </tree>
88 </field>
89 </record>
90
75 <record id="bank_statement_reconcile_form_view2" model="ir.ui.view">91 <record id="bank_statement_reconcile_form_view2" model="ir.ui.view">
76 <field name="name">account.bank.statement.reconcile.form</field>92 <field name="name">account.bank.statement.reconcile.form</field>
77 <field name="model">account.bank.statement.reconcile</field>93 <field name="model">account.bank.statement.reconcile</field>
7894
=== modified file 'account_invoice_cash_discount/wizard/account_pay_invoice.py'
--- account_invoice_cash_discount/wizard/account_pay_invoice.py 2010-07-23 11:30:07 +0000
+++ account_invoice_cash_discount/wizard/account_pay_invoice.py 2010-07-27 09:18:44 +0000
@@ -66,8 +66,8 @@
66 'cal_method_selection': fields.selection([('method_gross_methodology','Calculate Discount with Net Gross Methodology'),66 'cal_method_selection': fields.selection([('method_gross_methodology','Calculate Discount with Net Gross Methodology'),
67 ('method_net_methodology','Calculate Discount with Net Methodology'),],67 ('method_net_methodology','Calculate Discount with Net Methodology'),],
68 'Method To Calculation'),68 'Method To Calculation'),
69 'discount_move_ids': fields.many2many('account.move.line', 'account_discount_move_rel', 'discount_account_id', 'discount_move_id', 'Account Discount Moves'),69 'discount_move_ids': fields.many2many('account.move.line.memory', 'account_discount_move_rel', 'discount_account_id', 'discount_move_id', 'Account Discount Moves'),
70 'tax_move_ids': fields.many2many('account.move.line', 'account_tax_move_rel', 'tax_account_id', 'tax_move_id', 'Account Taxes Moves'),70 'tax_move_ids': fields.many2many('account.move.line.memory', 'account_tax_move_rel', 'tax_account_id', 'tax_move_id', 'Account Taxes Moves'),
71 }71 }
72 72
73 def _get_period(self, cr, uid, context=None):73 def _get_period(self, cr, uid, context=None):
@@ -111,6 +111,135 @@
111 account = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, account)111 account = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, account)
112 return account112 return account
113 113
114 def _get_discount_move(self, cr, uid, context=None):
115
116 cur_obj = self.pool.get('res.currency')
117 invoice_obj = self.pool.get('account.invoice')
118
119 invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context)
120 tax_obj = self.pool.get('account.tax')
121 invoice_tax_obj = self.pool.get("account.invoice.tax")
122 move_line_obj_memory = self.pool.get('account.move.line.memory')
123
124 #### to get direction
125 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
126 direction = types[invoice.type]
127 date=time.strftime('%Y-%m-%d')
128
129 #### to get name
130 name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number
131 ##### Entry in the discount account moves and entry in the tax account moves
132
133 amount = 0.0
134 discount = 0.0
135 discount_line_ids = []
136 discount_account_id = False
137 base_code_id = False
138
139 discount = self._get_discount(cr, uid, context=context)
140 discount_account_id = self._get_account(cr, uid, context=context)
141 if discount>0.0:
142 for line in invoice.invoice_line:
143 tax_amount = 0.0
144 line_tax_amount = 0.0
145
146 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):
147 line_tax_amount = tax['amount']
148
149 line_total = line.price_subtotal + line_tax_amount
150 invoice_res_amount = invoice.amount_total
151 line_ratio = line_total / invoice_res_amount
152
153 if line.invoice_line_tax_id:
154 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):
155 tax_amount = tax['amount']
156 tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])])
157 for tax_id in tax_invoice_id:
158 tax_value = invoice_tax_obj.browse(cr, uid, tax_id)
159 tax_account_id = tax_value.account_id.id
160 base_code_id = tax_value.base_code_id.id
161
162 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
163 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, tax_amount, context=context)
164
165 discount_pay = discount * line_ratio
166 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
167 discount_amount = discount - tax_amount
168 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, discount_amount, context=context)
169
170 l4 = {
171 'debit': direction * (discount_pay - tax_amount)<0 and - direction * (discount_pay - tax_amount),
172 'credit': direction * (discount_pay - tax_amount)>0 and direction * (discount_pay - tax_amount),
173 'account_id': discount_account_id,
174 'date': date,
175 'name':name,
176 'currency_id':invoice.currency_id.id or False,
177 'journal_id':invoice.journal_id.id,
178 'tax_code_id':base_code_id,
179 'tax_amount':tax_amount,
180 'amount_currency':amount and direction * amount or 0.0,
181 'analytic_account_id':line.account_analytic_id.id or False,
182 }
183
184 discount_line_id = move_line_obj_memory.create(cr, uid, l4, context=context)
185 discount_line_ids.append(l4)
186 return discount_line_ids
187
188 def _get_taxes_move(self, cr, uid, context=None):
189 cur_obj = self.pool.get('res.currency')
190 invoice_obj = self.pool.get('account.invoice')
191 invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context)
192 tax_obj = self.pool.get('account.tax')
193 invoice_tax_obj = self.pool.get("account.invoice.tax")
194 move_line_obj_memory = self.pool.get('account.move.line.memory')
195
196 #### to get direction
197 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
198 direction = types[invoice.type]
199 date=time.strftime('%Y-%m-%d')
200
201 #### to get name
202 name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number
203 ##### Entry in the discount account moves and entry in the tax account moves
204 amount = 0.0
205 discount = 0.0
206 line_ids = []
207
208 tax_code_id = False
209 discount = self._get_discount(cr, uid, context=context)
210 if discount>0.0:
211 for line in invoice.invoice_line:
212 tax_amount = 0.0
213 line_tax_amount = 0.0
214 if line.invoice_line_tax_id:
215 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):
216 tax_amount = tax['amount']
217 tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])])
218 for tax_id in tax_invoice_id:
219 tax_value = invoice_tax_obj.browse(cr, uid, tax_id)
220 tax_account_id = tax_value.account_id.id
221 tax_code_id = tax_value.tax_code_id.id
222
223 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
224 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, tax_amount, context=context)
225
226 l3 = {
227 'debit': direction * tax_amount<0 and - direction * tax_amount,
228 'credit': direction * tax_amount>0 and direction * tax_amount,
229 'account_id': tax_account_id,
230 'date': date,
231 'journal_id':invoice.journal_id.id or False,
232 'name':name,
233 'currency_id':invoice.currency_id.id or False,
234 'tax_code_id':tax_value.tax_code_id.id,
235 'tax_amount':-tax_amount,
236 'amount_currency':amount and direction * amount or 0.0,
237 'analytic_account_id':line.account_analytic_id.id or False,
238 }
239 line_id = move_line_obj_memory.create(cr, uid, l3, context=context)
240 line_ids.append(l3)
241 return line_ids
242
114 _defaults = {243 _defaults = {
115 'date': lambda *a: time.strftime('%Y-%m-%d'),244 'date': lambda *a: time.strftime('%Y-%m-%d'),
116 'period_id': _get_period,245 'period_id': _get_period,
@@ -119,9 +248,11 @@
119 'account_id':_get_account,248 'account_id':_get_account,
120 'cash_residual_amount': lambda *a:0.0,249 'cash_residual_amount': lambda *a:0.0,
121 'cal_method_selection':lambda *a :'method_gross_methodology',250 'cal_method_selection':lambda *a :'method_gross_methodology',
251 'discount_move_ids':_get_discount_move,
252 'tax_move_ids':_get_taxes_move,
122 }253 }
123 254
124 def on_change_ammount(self, cr, uid, ids, amount, context=None):255 def on_change_ammount(self, cr, uid, ids, amount, cash_amount, context=None):
125 """256 """
126 Function return the Discount according to the Amount paid and Payment Term Cash Discount257 Function return the Discount according to the Amount paid and Payment Term Cash Discount
127 """258 """
@@ -131,10 +262,8 @@
131 cal_amount = obj_inv._get_amount(cr, uid, [context['id']] ,invoice.residual, invoice.payment_term.id, context=context)262 cal_amount = obj_inv._get_amount(cr, uid, [context['id']] ,invoice.residual, invoice.payment_term.id, context=context)
132 263
133 old_cal_amount = cal_amount['amount']264 old_cal_amount = cal_amount['amount']
134 discount = obj_inv._get_payment(cr, uid, [context['id']] , old_cal_amount, invoice.payment_term.id, context=context)
135 old_amount = old_cal_amount 265 old_amount = old_cal_amount
136 diff_amount = round(old_amount - (amount + discount),2)266 diff_amount = round(old_amount - (amount + cash_amount),2)
137
138 return {'value' : {'cash_residual_amount':diff_amount}}267 return {'value' : {'cash_residual_amount':diff_amount}}
139 268
140 def on_change_cash_discount_amount(self, cr, uid, ids, discount_amount, amount, context=None):269 def on_change_cash_discount_amount(self, cr, uid, ids, discount_amount, amount, context=None):
@@ -153,35 +282,13 @@
153 return {'value' : {'cash_amount':discount_amount,'cash_residual_amount':diff_amount}}282 return {'value' : {'cash_amount':discount_amount,'cash_residual_amount':diff_amount}}
154 283
155 def _calculation(self, cr, uid, ids, context=None):284 def _calculation(self, cr, uid, ids, context=None):
156285 cur_obj = self.pool.get('res.currency')
157 invoice_obj = self.pool.get('account.invoice')286 invoice_obj = self.pool.get('account.invoice')
158 data = self.read(cr, uid, ids,context=context)[0]287 data = self.read(cr, uid, ids,context=context)[0]
159 invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context)288 invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context=context)
160 tax_obj = self.pool.get('account.tax')289 tax_obj = self.pool.get('account.tax')
161 invoice_tax_obj = self.pool.get("account.invoice.tax")290 invoice_tax_obj = self.pool.get("account.invoice.tax")
162 move_obj = self.pool.get('account.move')291 move_line_obj_memory = self.pool.get('account.move.line.memory')
163 move_line_obj = self.pool.get('account.move.line')
164
165 ############## Delete another lines of taxes and discount
166 if data['tax_move_ids']:
167 move_line = data['tax_move_ids']
168 for move_line_id in move_line:
169 move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id
170 move_line_obj.unlink(cr, uid,[move_line_id])
171 move_obj.unlink(cr, uid,[move_id])
172
173 if data['discount_move_ids']:
174 discount_move_line = data['discount_move_ids']
175 for move_line_id in discount_move_line:
176 move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id
177 move_line_obj.unlink(cr, uid,[move_line_id])
178 move_obj.unlink(cr, uid,[move_id])
179
180 ######## to get ref
181 if invoice.type in ('in_invoice', 'in_refund'):
182 ref = invoice.reference
183 else:
184 ref = invoice_obj._convert_ref(cr, uid, invoice.number)
185 292
186 #### to get direction293 #### to get direction
187 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}294 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
@@ -192,84 +299,102 @@
192 name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number299 name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number
193 ##### Entry in the discount account moves and entry in the tax account moves300 ##### Entry in the discount account moves and entry in the tax account moves
194301
195 if data.get('cash_amount',0.0)>0.0:302 if data.get('cash_amount', 0.0) <= 0.0:
196 tax_total_amount = 0.0303 return True
197 amount = 0.0304
198 discount = 0.0305 tax_total_amount = 0.0
199 line_ids = []306 amount = 0.0
200 discount_line_ids = []307 discount = 0.0
308 line_ids = []
309 discount_line_ids = []
201310
202 discount_account_id = False311 discount_account_id = False
203 tax_code_id = False312 tax_code_id = False
313 base_code_id = False
314
315 for line in invoice.invoice_line:
316 tax_amount = 0.0
317 line_tax_amount = 0.0
204 318
205 for line in invoice.invoice_line:319 #####get the ratio of the line in the total invoice amount
206 tax_amount = 0.0320 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):
207 line_tax_amount = 0.0321 line_tax_amount = tax['amount']
208 322 line_total = line.price_subtotal + line_tax_amount
209 #####get the ratio of the line in the total invoice amount 323 invoice_res_amount = invoice.amount_total
210 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): 324 line_ratio = line_total / invoice_res_amount
211 line_tax_amount = tax['amount']325 ###########################
212 line_total = line.price_subtotal + line_tax_amount326 if line.invoice_line_tax_id:
213 invoice_res_amount = invoice.amount_total327 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):
214 line_ratio = line_total / invoice_res_amount328 tax_amount = tax['amount']
215 ###########################329 tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])])
216 330 for tax_id in tax_invoice_id:
217 if line.invoice_line_tax_id:331 tax_value = invoice_tax_obj.browse(cr, uid, tax_id)
218 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):332 tax_account_id = tax_value.account_id.id
219 tax_amount = tax['amount']333 tax_code_id = tax_value.tax_code_id.id
220 tax_invoice_id = invoice_tax_obj.search(cr,uid,[('invoice_id','=',invoice.id),('name','=',tax['name'])])334 base_code_id = tax_value.base_code_id.id
221 for tax_id in tax_invoice_id:335
222 tax_value = invoice_tax_obj.browse(cr, uid, tax_id)336 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
223 tax_account_id = tax_value.account_id.id337 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, tax_amount, context=context)
224 tax_code_id = tax_value.tax_code_id.id338
225 339 l3 = {
226 l3 = {340 'debit': direction * tax_amount<0 and - direction * tax_amount,
227 'debit': direction * tax_amount<0 and - direction * tax_amount,341 'credit': direction * tax_amount>0 and direction * tax_amount,
228 'credit': direction * tax_amount>0 and direction * tax_amount,342 'account_id': tax_account_id,
229 'account_id': tax_account_id,343 'date': date,
230 'partner_id': invoice.partner_id.id,344 'journal_id':data.get('journal_id',False) ,
231 'ref':ref,345 'name':name,
232 'date': date,346 'currency_id':invoice.currency_id.id or False,
233 'journal_id':data.get('journal_id',False) ,347 'tax_code_id':tax_value.tax_code_id.id,
234 'period_id':data.get('period_id',False),348 'tax_amount':-tax_amount,
235 'name':name,349 'amount_currency':amount and direction * amount or 0.0,
236 'tax_code_id':tax_value.tax_code_id.id,350 'analytic_account_id':line.account_analytic_id.id or False,
237 'tax_amount':-tax_amount,351 }
238 }352 line_id = move_line_obj_memory.create(cr, uid, l3, context=context)
239 line_id = move_line_obj.create(cr, uid, l3, context=context)353 line_ids.append(line_id)
240 line_ids.append(line_id)354
241 355 ### if calculation on the Net Methology then in discount field it will take product income account or product category income account
242 ### if calculation on the Net Methology then in discount field it will take product income account or product category income account 356 if data['cal_method_selection'] == 'method_net_methodology':
243 357 if invoice.type == 'in_invoice':
244 if data['cal_method_selection'] == 'method_net_methodology':
245 if line.product_id.property_account_income:358 if line.product_id.property_account_income:
246 discount_account_id = line.product_id.property_account_income.id359 discount_account_id = line.product_id.property_account_income.id
247 else:360 else:
248 discount_account_id = line.product_id.categ_id.property_account_income_categ.id361 discount_account_id = line.product_id.categ_id.property_account_income_categ.id
249 else:362 else:
250 discount_account_id = data['account_id']363 if line.product_id.property_account_income:
251 364 discount_account_id = line.product_id.property_account_expense.id
252 discount = data['cash_amount'] * line_ratio365 else:
253 l4 = {366 discount_account_id = line.product_id.categ_id.property_account_expense_categ.id
254 'debit': direction * (discount - tax_amount)<0 and - direction * (discount - tax_amount),367
255 'credit': direction * (discount - tax_amount)>0 and direction * (discount - tax_amount),368 else:
256 'account_id': discount_account_id,369 discount_account_id = data['account_id']
257 'partner_id': invoice.partner_id.id,370
258 'ref':ref,371 discount = data['cash_amount'] * line_ratio
259 'date': date,372 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
260 'name':name,373 discount_amount = discount - tax_amount
261 'journal_id':data.get('journal_id',False),374 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, discount_amount, context=context)
262 'period_id':data.get('period_id',False),375
263 'tax_code_id':tax_code_id,376 l4 = {
264 'tax_amount':-tax_amount,377 'debit': direction * (discount - tax_amount)<0 and - direction * (discount - tax_amount),
265 }378 'credit': direction * (discount - tax_amount)>0 and direction * (discount - tax_amount),
266 379 'account_id': discount_account_id,
267 discount_line_id = move_line_obj.create(cr, uid, l4, context=context)380 'date': date,
268 discount_line_ids.append(discount_line_id)381 'name':name,
269 382 'currency_id':invoice.currency_id.id or False,
270 self.write(cr, uid, ids, {'tax_move_ids':[(6,0,line_ids)]}, context)383 'journal_id':data.get('journal_id',False),
271 self.write(cr, uid, ids, {'discount_move_ids':[(6,0,discount_line_ids)]}, context)384 'tax_code_id':base_code_id,
272 385 'tax_amount':tax_amount,
386 'amount_currency':amount and direction * amount or 0.0,
387 'analytic_account_id':line.account_analytic_id.id or False,
388 }
389
390 discount_line_id = move_line_obj_memory.create(cr, uid, l4, context=context)
391 discount_line_ids.append(discount_line_id)
392
393 self.write(cr, uid, ids,
394 {'tax_move_ids':[(6,0,line_ids)],
395 'discount_move_ids' : [(6, 0, discount_line_ids)],
396 }, context=context)
397
273 return True398 return True
274 399
275 def default_get(self, cr, uid, fields, context=None):400 def default_get(self, cr, uid, fields, context=None):
@@ -282,35 +407,79 @@
282 def _message(self, cr, uid, ids, context=None):407 def _message(self, cr, uid, ids, context=None):
283 mod_obj = self.pool.get('ir.model.data')408 mod_obj = self.pool.get('ir.model.data')
284 data = self.read(cr, uid, ids,context=context)[0]409 data = self.read(cr, uid, ids,context=context)[0]
410 invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context)
411
285 if data.get('discount_move_ids',False):412 if data.get('discount_move_ids',False):
286 context.update({'discount_move_ids':data['discount_move_ids']})413 context.update({'discount_move_ids':data['discount_move_ids']})
287
288 if data.get('id',False):
289 context.update({'t_ids':ids})
290
291 if data.get('tax_move_ids',False):414 if data.get('tax_move_ids',False):
292 context.update({'tax_move_ids':data['tax_move_ids']})415 context.update({'tax_move_ids':data['tax_move_ids']})
293
294 if data.get('amount',False):416 if data.get('amount',False):
295 context.update({'amount':data['amount']})417 context.update({'amount':data['amount']})
296
297 if data.get('cash_amount',False):418 if data.get('cash_amount',False):
298 context.update({'cash_amount':data['cash_amount']})419 context.update({'cash_amount':data['cash_amount']})
299 420
421 total_data_amount = 0.00
422 total_invoice_amount = 0.00
423 total_data_amount = data['amount'] + data['cash_amount']
424 total_invoice_amount = invoice.residual
425
426
300 model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_message')], context=context)427 model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_message')], context=context)
301 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']428 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
302 429 if self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id,(total_invoice_amount - total_data_amount)):
303 return {430 self.pool.get('account.invoice.pay').pay_and_reconcile(cr, uid, ids, context=context)
304 'name': _('Message'),431 return {}
305 'context': context,432 else:
306 'view_type': 'form',433 return {
307 'view_mode': 'form',434 'name': _('Message'),
308 'res_model': 'account.message',435 'context': context,
309 'views': [(resource_id,'form')],436 'view_type': 'form',
310 'type': 'ir.actions.act_window',437 'view_mode': 'form',
311 'target': 'new',438 'res_model': 'account.message',
312 } 439 'views': [(resource_id,'form')],
313 440 'type': 'ir.actions.act_window',
441 'target': 'new',
442 }
443
444
445 def _message_partial(self, cr, uid, ids, context=None):
446 mod_obj = self.pool.get('ir.model.data')
447 data = self.read(cr, uid, ids,context=context)[0]
448 invoice = self.pool.get('account.invoice').browse(cr, uid, context['id'], context)
449
450 total_data_amount = 0.0
451 total_invoice_amount = 0.0
452
453 if data.get('discount_move_ids',False):
454 context.update({'discount_move_ids':data['discount_move_ids']})
455 if data.get('tax_move_ids',False):
456 context.update({'tax_move_ids':data['tax_move_ids']})
457
458 if data.get('amount',False):
459 context.update({'amount':data['amount']})
460 if data.get('cash_amount',False):
461 context.update({'cash_amount':data['cash_amount']})
462
463 total_data_amount = data['amount'] + data['cash_amount']
464 total_invoice_amount = invoice.residual
465
466 if self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id,(total_invoice_amount - total_data_amount)):
467 model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_partial_message')], context=context)
468 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
469 return {
470 'name': _('Message'),
471 'context': context,
472 'view_type': 'form',
473 'view_mode': 'form',
474 'res_model': 'account.partial.message',
475 'views': [(resource_id,'form')],
476 'type': 'ir.actions.act_window',
477 'target': 'new',
478 }
479 else:
480 self.pool.get('account.invoice.pay').pay_and_reconcile(cr, uid, ids, context=context)
481 return {}
482
314 def wo_check(self, cr, uid, ids, context=None):483 def wo_check(self, cr, uid, ids, context=None):
315 cur_obj = self.pool.get('res.currency')484 cur_obj = self.pool.get('res.currency')
316 mod_obj = self.pool.get('ir.model.data')485 mod_obj = self.pool.get('ir.model.data')
@@ -347,32 +516,10 @@
347 debit+=payment.debit516 debit+=payment.debit
348 credit+=payment.credit517 credit+=payment.credit
349 amount_paid+=abs(debit-credit)518 amount_paid+=abs(debit-credit)
350519
351 # Test if there is a difference according to currency rouding setting520 if data['cash_residual_amount'] == 0.0 or self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id,
352# amount = obj_inv._get_amount(cr, uid, [context['id']] ,invoice.residual, invoice.payment_term.id, context=context)521 (amount_paid - inv_amount_company_currency)):
353#
354# found_h = amount['found']
355#
356# if found_h:
357
358 ####### Here when we do make full payment then to get the previous Discount and Tax Move added in context
359 if context.get('discount_move_ids',False):
360 context.update({'discount_move_ids':context['discount_move_ids']})
361 if context.get('tax_move_ids',False):
362 context.update({'tax_move_ids':context['tax_move_ids']})
363 if context.get('amount',False):
364 context.update({'amount':context['amount']})
365 if context.get('cash_amount',False):
366 context.update({'cash_amount':context['cash_amount']})
367 if context.get('t_ids',False):
368 ids = context['t_ids']
369# return self.pay_and_reconcile(cr, uid, ids, context=context)
370# else:
371
372 if self.pool.get('res.currency').is_zero(cr, uid, invoice.company_id.currency_id,
373 (amount_paid - inv_amount_company_currency)) or data['cash_residual_amount'] == 0.0:
374 return self.pay_and_reconcile(cr, uid, ids, context=context)522 return self.pay_and_reconcile(cr, uid, ids, context=context)
375
376 else:523 else:
377 model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_invoice_pay_writeoff')], context=context)524 model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_invoice_pay_writeoff')], context=context)
378 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']525 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
@@ -401,7 +548,7 @@
401 writeoff_account_id = context['write_off']['writeoff_acc_id']548 writeoff_account_id = context['write_off']['writeoff_acc_id']
402 writeoff_journal_id = context['write_off']['writeoff_journal_id']549 writeoff_journal_id = context['write_off']['writeoff_journal_id']
403 comment = context['write_off']['comment']550 comment = context['write_off']['comment']
404 551
405 if context.get('amount',False):552 if context.get('amount',False):
406 amount = context['amount'] + context.get('cash_amount',0.0)553 amount = context['amount'] + context.get('cash_amount',0.0)
407 else:554 else:
@@ -421,6 +568,7 @@
421 else: 568 else:
422 context.update({'amount_currency':data['amount'] + data['cash_amount'],'currency_id':currency_id})569 context.update({'amount_currency':data['amount'] + data['cash_amount'],'currency_id':currency_id})
423570
571
424 if invoice.company_id.currency_id.id<>invoice.currency_id.id:572 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
425 ctx = {'date':data['date']}573 ctx = {'date':data['date']}
426 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, amount, context=ctx)574 amount = cur_obj.compute(cr, uid, invoice.currency_id.id, invoice.company_id.currency_id.id, amount, context=ctx)
@@ -442,21 +590,11 @@
442 context.update({'tax_move_ids':context['tax_move_ids']})590 context.update({'tax_move_ids':context['tax_move_ids']})
443 else:591 else:
444 context.update({'tax_move_ids':data['tax_move_ids']})592 context.update({'tax_move_ids':data['tax_move_ids']})
445 593
446 if context.get('cash_amount',False):594 if context.get('cash_amount',False):
447 cash_amount = context['cash_amount']
448 context.update({'cash_amount':context['cash_amount']}) 595 context.update({'cash_amount':context['cash_amount']})
449 else:596 else:
450 cash_amount = data['cash_amount']
451 context.update({'cash_amount':data['cash_amount']})597 context.update({'cash_amount':data['cash_amount']})
452
453 if journal.currency and invoice.company_id.currency_id.id<>journal.currency.id:
454 cash_amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, cash_amount, context=ctx)
455 context.update({'cash_amount':cash_amount})
456
457 if invoice.company_id.currency_id.id<>invoice.currency_id.id:
458 cash_amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, cash_amount, context=ctx)
459 context.update({'cash_amount':cash_amount})
460 598
461 acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id599 acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id
462 if not acc_id:600 if not acc_id:
@@ -468,7 +606,6 @@
468 return {}606 return {}
469 607
470 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):608 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
471
472 res = super(account_invoice_pay,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)609 res = super(account_invoice_pay,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
473 fields=res.get('fields',{})610 fields=res.get('fields',{})
474 word = "Supplier Cash Discount Account"611 word = "Supplier Cash Discount Account"
@@ -481,29 +618,26 @@
481 res['fields'][f]['string'] = res['fields'][f]['string'].replace('Customers Cash Discount Account',word)618 res['fields'][f]['string'] = res['fields'][f]['string'].replace('Customers Cash Discount Account',word)
482 return res619 return res
483 620
484 def _cancel_line(self, cr, uid, ids, context=None):
485 move_obj = self.pool.get('account.move')
486 move_line_obj = self.pool.get('account.move.line')
487 data = self.read(cr, uid, ids,context=context)[0]
488
489 if data['tax_move_ids']:
490 move_line = data['tax_move_ids']
491 for move_line_id in move_line:
492 move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id
493 move_line_obj.unlink(cr, uid,[move_line_id])
494 move_obj.unlink(cr, uid,[move_id])
495
496 if data['discount_move_ids']:
497 discount_move_line = data['discount_move_ids']
498 for move_line_id in discount_move_line:
499 move_id = move_line_obj.browse(cr, uid,move_line_id).move_id.id
500 move_line_obj.unlink(cr, uid,[move_line_id])
501 move_obj.unlink(cr, uid,[move_id])
502
503 return {}
504
505account_invoice_pay()621account_invoice_pay()
506622
623class account_move_line_memory(osv.osv_memory):
624 _name= "account.move.line.memory"
625 _description = "Account move line memory "
626 _columns = {
627 'date': fields.date('Effective Date', required=True),
628 'name': fields.char('Name', size=64, required=True),
629 'account_id': fields.many2one('account.account', 'Account',),
630 'journal_id': fields.many2one('account.journal', 'Journal', required=True, select=1),
631 'debit': fields.float('Debit', digits=(16,2)),
632 'credit': fields.float('Credit', digits=(16,2)),
633 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or tax code account."),
634 'tax_amount': fields.float('Tax/Base Amount', digits=(16,2), select=True),
635 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."),
636 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry."),
637 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account'),
638 }
639account_move_line_memory()
640
507class account_message(osv.osv_memory):641class account_message(osv.osv_memory):
508 _name = "account.message"642 _name = "account.message"
509 def _check(self, cr, uid, ids, context=None):643 def _check(self, cr, uid, ids, context=None):
@@ -511,6 +645,15 @@
511 result = self.pool.get('account.invoice.pay').wo_check(cr, uid, ids, context=context)645 result = self.pool.get('account.invoice.pay').wo_check(cr, uid, ids, context=context)
512 return result646 return result
513647
514account_message() 648account_message()
649
650class account_partial_message(osv.osv_memory):
651 _name = "account.partial.message"
652 def _check_partial(self, cr, uid, ids, context=None):
653 data = self.read(cr, uid, ids,context=context)[0]
654 result = self.pool.get('account.invoice.pay').pay_and_reconcile(cr, uid, ids, context=context)
655 return result
656
657account_partial_message()
515658
516# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:659# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
517\ No newline at end of file660\ No newline at end of file
518661
=== modified file 'account_invoice_cash_discount/wizard/account_pay_invoice_view.xml'
--- account_invoice_cash_discount/wizard/account_pay_invoice_view.xml 2010-07-28 12:20:14 +0000
+++ account_invoice_cash_discount/wizard/account_pay_invoice_view.xml 2010-07-27 09:18:44 +0000
@@ -8,7 +8,7 @@
8 <field name="arch" type="xml">8 <field name="arch" type="xml">
9 <form string="Pay invoice">9 <form string="Pay invoice">
10 <group colspan="4" >10 <group colspan="4" >
11 <field name="amount" on_change="on_change_ammount(amount,context)"/>11 <field name="amount" on_change="on_change_ammount(amount,cash_amount,context)"/>
12 <field name="cash_residual_amount"/>12 <field name="cash_residual_amount"/>
13 <field name="name"/>13 <field name="name"/>
14 <field name="date"/>14 <field name="date"/>
@@ -32,8 +32,8 @@
32 </group>32 </group>
33 <group colspan="4" col="6">33 <group colspan="4" col="6">
34 <label string ="" colspan="2"/>34 <label string ="" colspan="2"/>
35 <button icon="gtk-cancel" string="Cancel" name="_cancel_line" type="object"/>35 <button icon="gtk-cancel" special="cancel" string="Cancel"/>
36 <button icon="gtk-execute" string="Partial Payment" name="pay_and_reconcile" type="object"/>36 <button icon="gtk-execute" string="Partial Payment" name="_message_partial" type="object"/>
37 <button icon="gtk-execute" string="Full-Payment" name="_message" type="object"/>37 <button icon="gtk-execute" string="Full-Payment" name="_message" type="object"/>
38 </group>38 </group>
39 </form>39 </form>
@@ -71,14 +71,62 @@
71 </field>71 </field>
72 </record>72 </record>
73 73
74 <record id="view_account_move_line_memory" model="ir.ui.view">
75 <field name="name">account.move.line.memory.form</field>
76 <field name="model">account.move.line.memory</field>
77 <field name="type">tree</field>
78 <field name="arch" type="xml">
79 <tree string="Account Move Line">
80 <field name="date"/>
81 <field name="name"/>
82 <field name="account_id"/>
83 <field name="journal_id"/>
84 <field name="debit"/>
85 <field name="credit"/>
86 <field name="tax_code_id"/>
87 <field name="tax_amount"/>
88 <field name="currency_id"/>
89 <field name="amount_currency"/>
90 <field name="analytic_account_id"/>
91 </tree>
92 </field>
93 </record>
94
74 <record id="view_account_message" model="ir.ui.view">95 <record id="view_account_message" model="ir.ui.view">
75 <field name="name">account.message.form</field>96 <field name="name">account.message.form</field>
76 <field name="model">account.message</field>97 <field name="model">account.message</field>
77 <field name="type">form</field>98 <field name="type">form</field>
78 <field name="arch" type="xml">99 <field name="arch" type="xml">
79 <form string="Your Messages">100 <form string="Messages">
80 <label colspan="8" string="Are you really want to reconcile this invoice" />101 <group>
81 <button icon="gtk-execute" string="OK" name="_check" type="object"/> 102 <separator string="Full Payment" colspan="4"/>
103 <label string ="Are you really want to reconcile this invoice.
104 The proposed payment does not cover 100 percent of the invoice.
105 Please check payment term lines. Normally a user would click
106 on Partial Payment to avoid ready / paid state for this invoice." colspan="2"/>
107 <newline/>
108 <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/>
109 <button icon="gtk-execute" string="OK" name="_check" type="object" colspan="1"/>
110 </group>
111 </form>
112 </field>
113 </record>
114
115 <record id="view_account_partial_message" model="ir.ui.view">
116 <field name="name">account.partial.message.form</field>
117 <field name="model">account.partial.message</field>
118 <field name="type">form</field>
119 <field name="arch" type="xml">
120 <form string="Messages">
121 <group>
122 <separator string="Partial Payment" colspan="4"/>
123 <label string ="Don't you really want to reconcile this invoice.
124 The proposed payment balances this invoice. Please check payment term lines.
125 Normally a user would click on Full Payment to receive ready / paid state for this invoice." colspan="2"/>
126 <newline/>
127 <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/>
128 <button icon="gtk-execute" string="OK" name="_check_partial" type="object" colspan="1"/>
129 </group>
82 </form>130 </form>
83 </field>131 </field>
84 </record>132 </record>

Subscribers

People subscribed via source and target branches