[MIG] pos_pax: Rewrite for Odoo 14.0 + Owl

This commit is contained in:
Jared Kipe
2020-11-15 15:07:02 -08:00
parent ad2f9393ab
commit afbdd85c70
18 changed files with 1179 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from . import pos_pax
from . import update

38
pos_pax/models/pos_pax.py Normal file
View File

@@ -0,0 +1,38 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from odoo import models, fields, api, _
class PoSPayment(models.Model):
_inherit = 'pos.payment'
pax_card_number = fields.Char(string='Card Number', help='Masked credit card.')
pax_txn_id = fields.Char(string='PAX Transaction ID')
class PoSPaymentMethod(models.Model):
_inherit = 'pos.payment.method'
def _get_payment_terminal_selection(self):
return super(PoSPaymentMethod, self)._get_payment_terminal_selection() + [('pax', 'PAX')]
class PosConfig(models.Model):
_inherit = 'pos.config'
pax_endpoint = fields.Char(string='PAX Endpoint',
help='Endpoint for PAX device (include protocol (http or https) and port). '
'e.g. http://192.168.1.101:10009')
class PosOrder(models.Model):
_inherit = "pos.order"
@api.model
def _payment_fields(self, order, ui_paymentline):
fields = super(PosOrder, self)._payment_fields(order, ui_paymentline)
fields.update({
'pax_card_number': ui_paymentline.get('pax_card_number'),
'pax_txn_id': ui_paymentline.get('pax_txn_id'),
})
return fields

20
pos_pax/models/update.py Normal file
View File

@@ -0,0 +1,20 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from odoo import models
class PublisherWarrantyContract(models.AbstractModel):
_inherit = 'publisher_warranty.contract'
def _get_hibou_modules(self):
modules = super(PublisherWarrantyContract, self)._get_hibou_modules()
try:
self.env.cr.execute(
'SELECT COUNT(*) FROM pos_config WHERE pax_endpoint != \'\' AND pax_endpoint IS NOT NULL')
pax_count = self.env.cr.fetchone()[0] or 0
modules.update({
'pos_pax': pax_count,
})
except:
pass
return modules