[IMP] Account payment: Change the behavior on bank statemt => import payment lines now it will search only paymentlines where bank statemenline id = false on same payment line (note: added new field on bank statement line field on payment line to synchronize)
bzr revid: mra@mra-laptop-20100901103847-2fqmda2lcfluaksh
This commit is contained in:
parent
de012dd986
commit
fded19fd84
|
@ -325,7 +325,8 @@ class payment_line(osv.osv):
|
|||
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'),
|
||||
'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"),
|
||||
'create_date': fields.datetime('Created' , readonly=True),
|
||||
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True)
|
||||
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True),
|
||||
'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line')
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda obj, cursor, user, context: obj.pool.get('ir.sequence'
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from osv import osv, fields
|
||||
|
@ -38,7 +39,8 @@ class account_payment_populate_statement(osv.osv_memory):
|
|||
statement = statement_obj.browse(cr, uid, context['active_id'], context=context)
|
||||
line_ids = line_obj.search(cr, uid, [
|
||||
('move_line_id.reconcile_id', '=', False),
|
||||
('order_id.mode.journal.id', '=', statement.journal_id.id)])
|
||||
('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)]))
|
||||
|
@ -93,7 +95,7 @@ class account_payment_populate_statement(osv.osv_memory):
|
|||
reconcile_id = statement_reconcile_obj.create(cr, uid, {
|
||||
'line_ids': [(6, 0, [line.move_line_id.id])]
|
||||
}, context=context)
|
||||
statement_line_obj.create(cr, uid, {
|
||||
st_line_id = statement_line_obj.create(cr, uid, {
|
||||
'name': line.order_id.reference or '?',
|
||||
'amount': - amount,
|
||||
'type': 'supplier',
|
||||
|
@ -103,6 +105,7 @@ class account_payment_populate_statement(osv.osv_memory):
|
|||
'ref': line.communication,
|
||||
'reconcile_id': reconcile_id,
|
||||
}, context=context)
|
||||
line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id})
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
account_payment_populate_statement()
|
||||
|
|
Loading…
Reference in New Issue