res_bank_payment.py 1.0 KB

12345678910111213141516171819202122232425262728
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request
  3. from res_bank_payment_type import get_bank_payment_types
  4. from server_datetime import get_date
  5. _MODEL = 'res.bank.payments'
  6. '''
  7. '''
  8. def create_bank_payment_statement(data, currency_id, date, journal_id=None, partner_id=None, supplier_id=None):
  9. bank_payments_type_id = request.env['res.bank.payments.type'].get_bank_payments_type_id(journal_id)
  10. values = {
  11. 'bank_payments_type_id': bank_payments_type_id,
  12. 'bank_id': data.get('bank_id', None),
  13. 'currency_id': currency_id,
  14. 'date': date,
  15. 'customer_id': partner_id,
  16. 'number_cta': data.get('number_cta', None),
  17. 'number_cta_origin': data.get('number_cta_origin', None),
  18. 'name_holder': data.get('name_holder', None),
  19. 'number': data.get('number'),
  20. 'date_maturity': data.get('date_maturity', '') or get_date(),
  21. 'supplier_id': supplier_id,
  22. 'amount_total': data.get('amount', None)
  23. }
  24. request.env['res.bank.payments'].create(values)