mirror of
https://github.com/bringout/oca-ocb-pos.git
synced 2026-04-24 02:42:02 +02:00
Initial commit: Pos packages
This commit is contained in:
commit
95dfb9edb0
1301 changed files with 264148 additions and 0 deletions
48
odoo-bringout-oca-ocb-pos_restaurant_stripe/README.md
Normal file
48
odoo-bringout-oca-ocb-pos_restaurant_stripe/README.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# POS Restaurant Stripe
|
||||
|
||||
Odoo addon: pos_restaurant_stripe
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-pos_restaurant_stripe
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- pos_stripe
|
||||
- pos_restaurant
|
||||
- payment_stripe
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: POS Restaurant Stripe
|
||||
- **Version**: 1.0
|
||||
- **Category**: Point of Sale
|
||||
- **License**: LGPL-3
|
||||
- **Installable**: False
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `pos_restaurant_stripe`.
|
||||
|
||||
## License
|
||||
|
||||
This package maintains the original LGPL-3 license from the upstream Odoo project.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Overview: doc/OVERVIEW.md
|
||||
- Architecture: doc/ARCHITECTURE.md
|
||||
- Models: doc/MODELS.md
|
||||
- Controllers: doc/CONTROLLERS.md
|
||||
- Wizards: doc/WIZARDS.md
|
||||
- Reports: doc/REPORTS.md
|
||||
- Security: doc/SECURITY.md
|
||||
- Install: doc/INSTALL.md
|
||||
- Usage: doc/USAGE.md
|
||||
- Configuration: doc/CONFIGURATION.md
|
||||
- Dependencies: doc/DEPENDENCIES.md
|
||||
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||
- FAQ: doc/FAQ.md
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Architecture
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||
V --> C[Controllers]
|
||||
V --> W[Wizards – Transient Models]
|
||||
C --> M[Models and ORM]
|
||||
W --> M
|
||||
M --> R[Reports]
|
||||
DX[Data XML] --> M
|
||||
S[Security – ACLs and Groups] -. enforces .-> M
|
||||
|
||||
subgraph Pos_restaurant_stripe Module - pos_restaurant_stripe
|
||||
direction LR
|
||||
M:::layer
|
||||
W:::layer
|
||||
C:::layer
|
||||
V:::layer
|
||||
R:::layer
|
||||
S:::layer
|
||||
DX:::layer
|
||||
end
|
||||
|
||||
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||
```
|
||||
|
||||
Notes
|
||||
- Views include tree/form/kanban templates and report templates.
|
||||
- Controllers provide website/portal routes when present.
|
||||
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||
- Data XML loads data/demo records; Security defines groups and access.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Configuration
|
||||
|
||||
Refer to Odoo settings for pos_restaurant_stripe. Configure related models, access rights, and options as needed.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Controllers
|
||||
|
||||
This module does not define custom HTTP controllers.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Dependencies
|
||||
|
||||
This addon depends on:
|
||||
|
||||
- [pos_stripe](../../odoo-bringout-oca-ocb-pos_stripe)
|
||||
- [pos_restaurant](../../odoo-bringout-oca-ocb-pos_restaurant)
|
||||
- [payment_stripe](../../odoo-bringout-oca-ocb-payment_stripe)
|
||||
4
odoo-bringout-oca-ocb-pos_restaurant_stripe/doc/FAQ.md
Normal file
4
odoo-bringout-oca-ocb-pos_restaurant_stripe/doc/FAQ.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# FAQ
|
||||
|
||||
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||
- Q: How to enable? A: Start server with --addon pos_restaurant_stripe or install in UI.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Install
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-pos_restaurant_stripe"
|
||||
# or
|
||||
uv pip install odoo-bringout-oca-ocb-pos_restaurant_stripe"
|
||||
```
|
||||
13
odoo-bringout-oca-ocb-pos_restaurant_stripe/doc/MODELS.md
Normal file
13
odoo-bringout-oca-ocb-pos_restaurant_stripe/doc/MODELS.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Models
|
||||
|
||||
Detected core models and extensions in pos_restaurant_stripe.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class pos_order
|
||||
class pos_payment
|
||||
```
|
||||
|
||||
Notes
|
||||
- Classes show model technical names; fields omitted for brevity.
|
||||
- Items listed under _inherit are extensions of existing models.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
Packaged Odoo addon: pos_restaurant_stripe. Provides features documented in upstream Odoo 16 under this addon.
|
||||
|
||||
- Source: OCA/OCB 16.0, addon pos_restaurant_stripe
|
||||
- License: LGPL-3
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Reports
|
||||
|
||||
This module does not define custom reports.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Security
|
||||
|
||||
This module does not define custom security rules or access controls beyond Odoo defaults.
|
||||
|
||||
Default Odoo security applies:
|
||||
- Base user access through standard groups
|
||||
- Model access inherited from dependencies
|
||||
- No custom row-level security rules
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Troubleshooting
|
||||
|
||||
- Ensure Python and Odoo environment matches repo guidance.
|
||||
- Check database connectivity and logs if startup fails.
|
||||
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||
7
odoo-bringout-oca-ocb-pos_restaurant_stripe/doc/USAGE.md
Normal file
7
odoo-bringout-oca-ocb-pos_restaurant_stripe/doc/USAGE.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Usage
|
||||
|
||||
Start Odoo including this addon (from repo root):
|
||||
|
||||
```bash
|
||||
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon pos_restaurant_stripe
|
||||
```
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Wizards
|
||||
|
||||
This module does not include UI wizards.
|
||||
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
});
|
||||
44
odoo-bringout-oca-ocb-pos_restaurant_stripe/pyproject.toml
Normal file
44
odoo-bringout-oca-ocb-pos_restaurant_stripe/pyproject.toml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-ocb-pos_restaurant_stripe"
|
||||
version = "16.0.0"
|
||||
description = "POS Restaurant Stripe - Adds American style tipping to Stripe"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-ocb-pos_stripe>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-pos_restaurant>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-payment_stripe>=16.0.0",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">= 3.11"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/bringout/0"
|
||||
repository = "https://github.com/bringout/0"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.metadata]
|
||||
allow-direct-references = true
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["pos_restaurant_stripe"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
dev-dependencies = [
|
||||
"pytest>=8.4.1",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue