~therp-nl/banking-addons/ba61-lp1098699-fix_clieop_rounding_issue

« back to all changes in this revision

Viewing changes to account_payment_shortcut/payment_order.py

  • Committer: OpenERP instance user
  • Date: 2011-12-09 13:07:52 UTC
  • Revision ID: oersmldev6@midgard.therp.nl-20111209130752-gugqzj3xue3b8d30
[ADD] select all candidate invoices by default in the payment order

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
from osv import osv, fields
 
3
 
 
4
class payment_order_create(osv.osv_memory):
 
5
 
 
6
    _inherit = 'payment.order.create'
 
7
 
 
8
    def default_get(self, cr, uid, fields_list, context=None):
 
9
        """ 
 
10
        Automatically add the candidate move lines to
 
11
        the payment order, instead of only applying them
 
12
        to the domain.
 
13
 
 
14
        We make use of the fact that the search_entries
 
15
        method passes an action without a res_id so that a
 
16
        new instance is created. Inject the line_ids, which have
 
17
        been placed in the context at object
 
18
        creation time.
 
19
        """
 
20
        res = super(payment_order_create, self).default_get(
 
21
            cr, uid, fields_list, context=context)
 
22
 
 
23
        if (fields_list and 'entries' in fields_list
 
24
            and 'entries' not in res
 
25
            and context and context.get('line_ids', False)
 
26
            ):
 
27
            res['entries'] = context['line_ids']
 
28
 
 
29
        return res
 
30
 
 
31
payment_order_create()