wxapp_payment.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- coding: utf-8 -*-
  2. from odoo import models, fields, api
  3. from .. import defs
  4. class Payment(models.Model):
  5. _name = 'wxapp.payment'
  6. _description = u'支付记录'
  7. wechat_user_id = fields.Many2one('wxapp.user', string='微信用户')
  8. order_id = fields.Many2one('sale.order', string='订单')
  9. payment_number = fields.Char('支付单号', index=True)
  10. price = fields.Float('支付金额(元)')
  11. status = fields.Selection(defs.PaymentStatus.attrs.items(), string='状态', default=defs.PaymentStatus.unpaid)
  12. # notify返回参数
  13. openid = fields.Char('openid')
  14. result_code = fields.Char('业务结果')
  15. err_code = fields.Char('错误代码')
  16. err_code_des = fields.Char('错误代码描述')
  17. transaction_id = fields.Char('微信订单号')
  18. bank_type = fields.Char('付款银行')
  19. fee_type = fields.Char('货币种类')
  20. total_fee = fields.Integer('订单金额(分)')
  21. settlement_total_fee = fields.Integer('应结订单金额(分)')
  22. cash_fee = fields.Integer('现金支付金额')
  23. cash_fee_type = fields.Char('货币类型')
  24. coupon_fee = fields.Integer('代金券金额(分)')
  25. coupon_count = fields.Integer('代金券使用数量')
  26. _sql_constraints = [(
  27. 'wxapp_payment_payment_number_unique',
  28. 'UNIQUE (payment_number)',
  29. 'wechat payment payment_number is existed!'
  30. )]