mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-18 04:12:06 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
50
odoo-bringout-oca-ocb-pos_sale_margin/README.md
Normal file
50
odoo-bringout-oca-ocb-pos_sale_margin/README.md
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# pos_sale_margin
|
||||
|
||||
|
||||
|
||||
This module adds enable you to view the margin of your Point of Sale orders in the Sales Margin report.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-pos_sale_margin
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- pos_sale
|
||||
- sale_margin
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: pos_sale_margin
|
||||
- **Version**: 1.1
|
||||
- **Category**: Hidden
|
||||
- **License**: LGPL-3
|
||||
- **Installable**: True
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `pos_sale_margin`.
|
||||
|
||||
## 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
|
||||
32
odoo-bringout-oca-ocb-pos_sale_margin/doc/ARCHITECTURE.md
Normal file
32
odoo-bringout-oca-ocb-pos_sale_margin/doc/ARCHITECTURE.md
Normal file
|
|
@ -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_sale_margin Module - pos_sale_margin
|
||||
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_sale_margin. Configure related models, access rights, and options as needed.
|
||||
3
odoo-bringout-oca-ocb-pos_sale_margin/doc/CONTROLLERS.md
Normal file
3
odoo-bringout-oca-ocb-pos_sale_margin/doc/CONTROLLERS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Controllers
|
||||
|
||||
This module does not define custom HTTP controllers.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# Dependencies
|
||||
|
||||
This addon depends on:
|
||||
|
||||
- [pos_sale](../../odoo-bringout-oca-ocb-pos_sale)
|
||||
- [sale_margin](../../odoo-bringout-oca-ocb-sale_margin)
|
||||
4
odoo-bringout-oca-ocb-pos_sale_margin/doc/FAQ.md
Normal file
4
odoo-bringout-oca-ocb-pos_sale_margin/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_sale_margin or install in UI.
|
||||
7
odoo-bringout-oca-ocb-pos_sale_margin/doc/INSTALL.md
Normal file
7
odoo-bringout-oca-ocb-pos_sale_margin/doc/INSTALL.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Install
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-pos_sale_margin"
|
||||
# or
|
||||
uv pip install odoo-bringout-oca-ocb-pos_sale_margin"
|
||||
```
|
||||
11
odoo-bringout-oca-ocb-pos_sale_margin/doc/MODELS.md
Normal file
11
odoo-bringout-oca-ocb-pos_sale_margin/doc/MODELS.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Models
|
||||
|
||||
Detected core models and extensions in pos_sale_margin.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
```
|
||||
|
||||
Notes
|
||||
- Classes show model technical names; fields omitted for brevity.
|
||||
- Items listed under _inherit are extensions of existing models.
|
||||
6
odoo-bringout-oca-ocb-pos_sale_margin/doc/OVERVIEW.md
Normal file
6
odoo-bringout-oca-ocb-pos_sale_margin/doc/OVERVIEW.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
Packaged Odoo addon: pos_sale_margin. Provides features documented in upstream Odoo 16 under this addon.
|
||||
|
||||
- Source: OCA/OCB 16.0, addon pos_sale_margin
|
||||
- License: LGPL-3
|
||||
25
odoo-bringout-oca-ocb-pos_sale_margin/doc/REPORTS.md
Normal file
25
odoo-bringout-oca-ocb-pos_sale_margin/doc/REPORTS.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Reports
|
||||
|
||||
Report definitions and templates in pos_sale_margin.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class SaleReport
|
||||
Model <|-- SaleReport
|
||||
```
|
||||
|
||||
## Available Reports
|
||||
|
||||
No named reports found in XML files.
|
||||
|
||||
|
||||
## Report Files
|
||||
|
||||
- **__init__.py** (Python logic)
|
||||
- **sale_report.py** (Python logic)
|
||||
|
||||
## Notes
|
||||
- Named reports above are accessible through Odoo's reporting menu
|
||||
- Python files define report logic and data processing
|
||||
- XML files contain report templates, definitions, and formatting
|
||||
- Reports are integrated with Odoo's printing and email systems
|
||||
8
odoo-bringout-oca-ocb-pos_sale_margin/doc/SECURITY.md
Normal file
8
odoo-bringout-oca-ocb-pos_sale_margin/doc/SECURITY.md
Normal file
|
|
@ -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_sale_margin/doc/USAGE.md
Normal file
7
odoo-bringout-oca-ocb-pos_sale_margin/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_sale_margin
|
||||
```
|
||||
3
odoo-bringout-oca-ocb-pos_sale_margin/doc/WIZARDS.md
Normal file
3
odoo-bringout-oca-ocb-pos_sale_margin/doc/WIZARDS.md
Normal file
|
|
@ -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 report
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
{
|
||||
'name': 'pos_sale_margin',
|
||||
'version': '1.1',
|
||||
'category': 'Hidden',
|
||||
'summary': 'Link module between Point of Sale and Sales Margin',
|
||||
'description': """
|
||||
|
||||
This module adds enable you to view the margin of your Point of Sale orders in the Sales Margin report.
|
||||
""",
|
||||
'depends': ['pos_sale', 'sale_margin'],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pos_sale_margin
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-02-06 13:32+0000\n"
|
||||
"PO-Revision-Date: 2024-02-06 13:32+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_sale_margin
|
||||
#: model:ir.model,name:pos_sale_margin.model_sale_report
|
||||
msgid "Sales Analysis Report"
|
||||
msgstr "Izvještaj analize prodaje"
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pos_sale_margin
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-02-06 13:32+0000\n"
|
||||
"PO-Revision-Date: 2024-02-06 13:32+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_sale_margin
|
||||
#: model:ir.model,name:pos_sale_margin.model_sale_report
|
||||
msgid "Sales Analysis Report"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import sale_report
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class SaleReport(models.Model):
|
||||
_inherit = "sale.report"
|
||||
|
||||
def _fill_pos_fields(self, additional_fields):
|
||||
values = super()._fill_pos_fields(additional_fields)
|
||||
values['margin'] = 'SUM(l.price_subtotal - COALESCE(l.total_cost,0) / CASE COALESCE(pos.currency_rate, 0) WHEN 0 THEN 1.0 ELSE pos.currency_rate END)'
|
||||
return values
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_pos_sale_margin_report
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
import odoo
|
||||
|
||||
from odoo.addons.point_of_sale.tests.common import TestPoSCommon
|
||||
|
||||
|
||||
@odoo.tests.tagged('post_install', '-at_install')
|
||||
class TestPoSSaleMarginReport(TestPoSCommon):
|
||||
|
||||
def setUp(self):
|
||||
super(TestPoSSaleMarginReport, self).setUp()
|
||||
self.config = self.basic_config
|
||||
|
||||
def test_pos_sale_margin_report(self):
|
||||
|
||||
product1 = self.create_product('Product 1', self.categ_basic, 150, standard_price=50)
|
||||
|
||||
self.open_new_session()
|
||||
session = self.pos_session
|
||||
|
||||
self.env['pos.order'].create({
|
||||
'session_id': session.id,
|
||||
'lines': [(0, 0, {
|
||||
'name': "OL/0001",
|
||||
'product_id': product1.id,
|
||||
'price_unit': 450,
|
||||
'discount': 5.0,
|
||||
'qty': 1.0,
|
||||
'price_subtotal': 150,
|
||||
'price_subtotal_incl': 150,
|
||||
'total_cost': 50,
|
||||
}),],
|
||||
'amount_total': 150.0,
|
||||
'amount_tax': 0.0,
|
||||
'amount_paid': 0.0,
|
||||
'amount_return': 0.0,
|
||||
})
|
||||
|
||||
# PoS Orders have negative IDs to avoid conflict, so reports[0] will correspond to the newest order
|
||||
reports = self.env['sale.report'].sudo().search([('product_id', '=', product1.id)], order='id')
|
||||
|
||||
self.assertEqual(reports[0].margin, 100)
|
||||
43
odoo-bringout-oca-ocb-pos_sale_margin/pyproject.toml
Normal file
43
odoo-bringout-oca-ocb-pos_sale_margin/pyproject.toml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-ocb-pos_sale_margin"
|
||||
version = "16.0.0"
|
||||
description = "pos_sale_margin - Link module between Point of Sale and Sales Margin"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-ocb-pos_sale>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-sale_margin>=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_sale_margin"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
dev-dependencies = [
|
||||
"pytest>=8.4.1",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue