[FIX] account_payment: account_payment not allowing selection of invoices for payment
lp bug: https://launchpad.net/bugs/834091 fixed bzr revid: psi@tinyerp.com-20110908104921-70a4v56zxfyeh5al
This commit is contained in:
parent
5b223f5961
commit
72b6ac7daf
|
@ -26,7 +26,8 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Search Payment lines">
|
||||
<group col="4" colspan="6">
|
||||
<group col="4" colspan="6">
|
||||
<field name="entries"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
|
|
|
@ -29,7 +29,7 @@ class payment_order_create(osv.osv_memory):
|
|||
Create a payment object with lines corresponding to the account move line
|
||||
to pay according to the date and the mode provided by the user.
|
||||
Hypothesis:
|
||||
- Small number of non-reconcilied move line, payment mode and bank account type,
|
||||
- Small number of non-reconciled move line, payment mode and bank account type,
|
||||
- Big number of partner and bank account.
|
||||
|
||||
If a type is given, unsuitable account Entry lines are ignored.
|
||||
|
@ -48,12 +48,11 @@ class payment_order_create(osv.osv_memory):
|
|||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(payment_order_create, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
if context and 'line_ids' in context:
|
||||
view_obj = etree.XML(res['arch'])
|
||||
child = view_obj.getchildren()[0]
|
||||
domain = '[("id", "in", '+ str(context['line_ids'])+')]'
|
||||
field = etree.Element('field', attrib={'domain': domain, 'name':'entries', 'colspan':'4', 'height':'300', 'width':'800', 'nolabel':"1"})
|
||||
child.addprevious(field)
|
||||
res['arch'] = etree.tostring(view_obj)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='entries']")
|
||||
for node in nodes:
|
||||
node.set('domain', '[("id", "in", '+ str(context['line_ids'])+')]')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def create_payment(self, cr, uid, ids, context=None):
|
||||
|
@ -81,14 +80,14 @@ class payment_order_create(osv.osv_memory):
|
|||
elif payment.date_prefered == 'fixed':
|
||||
date_to_pay = payment.date_scheduled
|
||||
payment_obj.create(cr, uid,{
|
||||
'move_line_id': line.id,
|
||||
'amount_currency': line.amount_to_pay,
|
||||
'bank_id': line2bank.get(line.id),
|
||||
'order_id': payment.id,
|
||||
'partner_id': line.partner_id and line.partner_id.id or False,
|
||||
'communication': line.ref or '/',
|
||||
'date': date_to_pay,
|
||||
'currency': line.invoice and line.invoice.currency_id.id or False,
|
||||
'move_line_id': line.id,
|
||||
'amount_currency': line.amount_to_pay,
|
||||
'bank_id': line2bank.get(line.id),
|
||||
'order_id': payment.id,
|
||||
'partner_id': line.partner_id and line.partner_id.id or False,
|
||||
'communication': line.ref or '/',
|
||||
'date': date_to_pay,
|
||||
'currency': line.invoice and line.invoice.currency_id.id or False,
|
||||
}, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
|
Loading…
Reference in New Issue