mirror of
https://github.com/bringout/oca-ocb-pos.git
synced 2026-04-25 15:21:59 +02:00
Initial commit: Pos packages
This commit is contained in:
commit
95dfb9edb0
1301 changed files with 264148 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'POS Restaurant Stripe',
|
||||
'version': '1.0',
|
||||
'category': 'Point of Sale',
|
||||
'sequence': 6,
|
||||
'summary': 'Adds American style tipping to Stripe',
|
||||
'depends': ['pos_stripe', 'pos_restaurant', 'payment_stripe'],
|
||||
'auto_install': True,
|
||||
'assets': {
|
||||
'point_of_sale.assets': [
|
||||
'pos_restaurant_stripe/static/**/*',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pos_restaurant_stripe
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-02-06 13:31+0000\n"
|
||||
"PO-Revision-Date: 2024-02-06 13:31+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: pos_restaurant_stripe
|
||||
#: model:ir.model,name:pos_restaurant_stripe.model_pos_order
|
||||
msgid "Point of Sale Orders"
|
||||
msgstr "Narudžbe POS-a"
|
||||
|
||||
#. module: pos_restaurant_stripe
|
||||
#: model:ir.model,name:pos_restaurant_stripe.model_pos_payment
|
||||
msgid "Point of Sale Payments"
|
||||
msgstr "Plaćanja na prodajnom mjestu"
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pos_restaurant_stripe
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-02-06 13:31+0000\n"
|
||||
"PO-Revision-Date: 2024-02-06 13:31+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: pos_restaurant_stripe
|
||||
#: model:ir.model,name:pos_restaurant_stripe.model_pos_order
|
||||
msgid "Point of Sale Orders"
|
||||
msgstr ""
|
||||
|
||||
#. module: pos_restaurant_stripe
|
||||
#: model:ir.model,name:pos_restaurant_stripe.model_pos_payment
|
||||
msgid "Point of Sale Payments"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# coding: utf-8
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import pos_payment
|
||||
from . import pos_order
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# coding: utf-8
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models
|
||||
|
||||
|
||||
class PosOrder(models.Model):
|
||||
_inherit = 'pos.order'
|
||||
|
||||
def set_no_tip(self):
|
||||
"""Capture the payment when no tip is set."""
|
||||
res = super(PosOrder, self).set_no_tip()
|
||||
|
||||
for payment in self.payment_ids:
|
||||
if payment.payment_method_id.use_payment_terminal == 'stripe':
|
||||
payment.payment_method_id.stripe_capture_payment(payment.transaction_id)
|
||||
|
||||
return res
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# coding: utf-8
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models
|
||||
|
||||
|
||||
class PosPayment(models.Model):
|
||||
_inherit = 'pos.payment'
|
||||
|
||||
def _update_payment_line_for_tip(self, tip_amount):
|
||||
"""Capture the payment when a tip is set."""
|
||||
res = super(PosPayment, self)._update_payment_line_for_tip(tip_amount)
|
||||
|
||||
if self.payment_method_id.use_payment_terminal == 'stripe':
|
||||
self.payment_method_id.stripe_capture_payment(self.transaction_id, amount=self.amount)
|
||||
|
||||
return res
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
odoo.define('pos_restaurant_stripe.payment', function (require) {
|
||||
"use strict";
|
||||
|
||||
var PaymentStripe = require('pos_stripe.payment');
|
||||
|
||||
PaymentStripe.include({
|
||||
captureAfterPayment: async function (processPayment, line) {
|
||||
// Don't capture if the customer can tip, in that case we
|
||||
// will capture later.
|
||||
if (! this.canBeAdjusted(line.cid)) {
|
||||
return this._super(...arguments);
|
||||
}
|
||||
},
|
||||
|
||||
canBeAdjusted: function (cid) {
|
||||
var order = this.pos.get_order();
|
||||
var line = order.get_paymentline(cid);
|
||||
return this.pos.config.set_tip_after_payment &&
|
||||
line.payment_method.use_payment_terminal === "stripe" &&
|
||||
line.card_type !== 'interac' &&
|
||||
! line.card_type.includes('eftpos');
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue