diff --git a/addons/account_payment/account_payment_view.xml b/addons/account_payment/account_payment_view.xml
index eb24ce6d303..e6d6e832ae2 100644
--- a/addons/account_payment/account_payment_view.xml
+++ b/addons/account_payment/account_payment_view.xml
@@ -315,7 +315,7 @@
-
+
diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py
index 06fd2074b08..38d742119ad 100644
--- a/addons/account_payment/wizard/account_payment_populate_statement.py
+++ b/addons/account_payment/wizard/account_payment_populate_statement.py
@@ -30,44 +30,22 @@ class account_payment_populate_statement(osv.osv_memory):
'lines': fields.many2many('payment.line', 'payment_line_rel_', 'payment_id', 'line_id', 'Payment Lines')
}
- def search_entries(self, cr, uid, ids, context=None):
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
line_obj = self.pool.get('payment.line')
- statement_obj = self.pool.get('account.bank.statement')
- mod_obj = self.pool.get('ir.model.data')
- data = self.read(cr, uid, ids, [], context=context)[0]
- statement = statement_obj.browse(cr, uid, context['active_id'], context=context)
+ res = super(account_payment_populate_statement, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
line_ids = line_obj.search(cr, uid, [
('move_line_id.reconcile_id', '=', False),
('bank_statement_line_id', '=', False),])
-# ('order_id.mode.journal.id', '=', statement.journal_id.id)])
line_ids.extend(line_obj.search(cr, uid, [
('move_line_id.reconcile_id', '=', False),
('order_id.mode', '=', False)]))
-
- context.update({'line_ids': line_ids})
- model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','account_payment_populate_statement_view')], context=context)
- resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- return {
- 'name': ('Entrie Lines'),
- 'context': context,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'account.payment.populate.statement',
- 'views': [(resource_id,'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
-
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- res = super(account_payment_populate_statement, 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':'lines', 'colspan':'4', 'height':'300', 'width':'800', 'nolabel':"1"})
- child.addprevious(field)
- res['arch'] = etree.tostring(view_obj)
+ domain = '[("id", "in", '+ str(line_ids)+')]'
+ doc = etree.XML(res['arch'])
+ nodes = doc.xpath("//field[@name='lines']")
+ for node in nodes:
+ node.set('domain', domain)
+ res['arch'] = etree.tostring(doc)
return res
def populate_statement(self, cr, uid, ids, context=None):
diff --git a/addons/account_payment/wizard/account_payment_populate_statement_view.xml b/addons/account_payment/wizard/account_payment_populate_statement_view.xml
index 34cf906bec3..a7dde70bb32 100644
--- a/addons/account_payment/wizard/account_payment_populate_statement_view.xml
+++ b/addons/account_payment/wizard/account_payment_populate_statement_view.xml
@@ -2,29 +2,13 @@
-
- Payment Populate statement
- account.payment.populate.statement
- form
-
-
-
-
-
Payment Populate statement
account.payment.populate.statement
ir.actions.act_window
form
tree,form
-
+
{'record_id':active_id}
new
@@ -36,6 +20,7 @@