# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-
from osv import fields
from osv import osv
import time
('now', 'Directly'),
('due', 'Due date'),
('fixed', 'Fixed date')
- ], "Prefered date", change_default=True, required=True,help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
+ ], "Preferred date", change_default=True, required=True,help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
'date_created': fields.date('Creation date', readonly=True),
'date_done': fields.date('Execution date', readonly=True),
}
# 'reference': fields.function(select_by_name, string="Ref", method=True,
# type='char'),
'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='date', string='Maturity Date'),
- 'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='many2one', relation='account.invoice', string='Invoice Ref'),
+ 'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='many2one', relation='account.invoice', string='Invoice Ref.'),
'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text",help='Address of the Main Partner'),
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text",help='Address of the Ordering Customer.'),
# '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',help="If no payment date is specified, the bank will treat this payment line direclty"),
+ '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)
}
if move_line_id:
line = self.pool.get('account.move.line').browse(cr,uid,move_line_id)
data['amount_currency']=line.amount_to_pay
+
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
company_currency, context)
if res:
return {'value': data}
- def onchange_amount(self,cr,uid,ids,amount,currency,cmpny_currency,context=None):
- if not amount:
- return {}
+ def onchange_amount(self, cr, uid, ids, amount, currency, cmpny_currency, context=None):
+ if (not amount) or (not cmpny_currency):
+ return {'value': {'amount':False}}
res = {}
currency_obj = self.pool.get('res.currency')
- company_amount = currency_obj.compute(cr, uid, currency, cmpny_currency,amount)
+ company_amount = currency_obj.compute(cr, uid, currency, cmpny_currency, amount)
res['amount'] = company_amount
return {'value': res}
<notebook>
<page string="Payment">
<field name="order_id" select="1"/>
- <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode, currency, company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
+ <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
<field name="amount_currency" select="2" on_change="onchange_amount(amount_currency,currency,comapny_currency)"/>
<field name="currency" nolabel="1"/>
</group>
- <field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
+ <field name="partner_id" on_change="onchange_partner(partner_id, False)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
<separator colspan="2" string="Owner Account"/>
<separator colspan="2" string="Desitination Account"/>
for line in line_obj.browse(cursor, user, line_ids, context=context):
ctx = context.copy()
- ctx['date'] = line.value_date
+ ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now
amount = currency_obj.compute(cursor, user, line.currency.id,
statement.currency.id, line.amount_currency, context=ctx)
- reconcile_id = statement_reconcile_obj.create(cursor, user, {
- 'line_ids': [(6, 0, [line.move_line_id.id])]
- }, context=context)
- statement_line_obj.create(cursor, user, {
- 'name': line.order_id.reference or '?',
- 'amount': - amount,
- 'type': 'supplier',
- 'partner_id': line.partner_id.id,
- 'account_id': line.move_line_id.account_id.id,
- 'statement_id': statement.id,
- 'ref': line.reference,
- 'reconcile_id': reconcile_id,
- }, context=context)
+
+ if line.move_line_id:
+ reconcile_id = statement_reconcile_obj.create(cursor, user, {
+ 'line_ids': [(6, 0, [line.move_line_id.id])]
+ }, context=context)
+ statement_line_obj.create(cursor, user, {
+ 'name': line.order_id.reference or '?',
+ 'amount': - amount,
+ 'type': 'supplier',
+ 'partner_id': line.partner_id.id,
+ 'account_id': line.move_line_id.account_id.id,
+ 'statement_id': statement.id,
+ 'ref': line.communication,
+ 'reconcile_id': reconcile_id,
+ }, context=context)
return {}