*added automatic fill in of the payment date when importing payment line from invoices

*added help tooltip
*improved and bugfixed

bzr revid: qdp@tinyerp.com-20080902065247-wss1tenz1n4fy698
This commit is contained in:
qdp 2008-09-02 08:52:47 +02:00
parent 0881a44dff
commit dccd7b932f
2 changed files with 12 additions and 4 deletions

View File

@ -418,7 +418,7 @@ class payment_line(osv.osv):
# 'partner_payable': fields.function(partner_payable, string="Partner payable", method=True, type='float'),
# 'value_date': fields.function(_value_date, string='Value Date',
# method=True, type='date'),
'date': fields.date('Payment Date'),
'date': fields.date('Payment Date',help="If no payment date is specified, the bank will treat this payment line direclty"),
'create_date': fields.datetime('Created' ,readonly=True),
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True)
}
@ -457,8 +457,7 @@ class payment_line(osv.osv):
elif date_prefered == 'due':
data['date'] = line.date_maturity
elif date_prefered == 'fixed':
if date_planned:
data['date'] = date_planned
data['date'] = date_planned
return {'value': data}

View File

@ -87,11 +87,19 @@ def create_payment(self, cr, uid, data, context):
payment = order_obj.browse(cr, uid, data['id'],
context=context)
t = payment.mode and payment.mode.type.code or 'manual'
t = payment.mode and payment.mode.type.code or None
line2bank= pool.get('account.move.line').line2bank(cr, uid,
line_ids, t, context)
## Finally populate the current payment with new lines:
for line in line_obj.browse(cr, uid, line_ids, context=context):
if payment.date_prefered == "now":
#no payment date => immediate payment
date_to_pay = False
elif payment.date_prefered == 'due':
date_to_pay = line.date_maturity
elif payment.date_prefered == 'fixed':
date_to_pay = payment.date_planned
pool.get('payment.line').create(cr,uid,{
'move_line_id': line.id,
'amount_currency': line.amount_to_pay,
@ -99,6 +107,7 @@ def create_payment(self, cr, uid, data, context):
'order_id': payment.id,
'partner_id': line.partner_id and line.partner_id.id or False,
'communication': line.ref or '/',
'date': date_to_pay,
}, context=context)
return {}