Compare commits
4 Commits
odoo-custo
...
84d79b38dd
| Author | SHA1 | Date | |
|---|---|---|---|
| 84d79b38dd | |||
| 2ebbbdf941 | |||
| 569b66a623 | |||
| bdaa5394b2 |
@@ -83,7 +83,7 @@ OC_DOCKER_IMAGE=opencloudeu/opencloud-rolling
|
||||
OC_DOCKER_TAG=
|
||||
# Domain of openCloud, where you can find the frontend.
|
||||
# Defaults to "cloud.opencloud.test"
|
||||
OC_DOMAIN=
|
||||
OC_DOMAIN=cloud.opencloud.test
|
||||
# Demo users should not be created on a production instance,
|
||||
# because their passwords are public. Defaults to "false".
|
||||
# If demo users is set to "true", the following user accounts are created automatically:
|
||||
@@ -310,3 +310,7 @@ KC_DB_PASSWORD=
|
||||
# This matches the default user inside the container and avoids permission issues when accessing files.
|
||||
# Leaving it default stores data in docker internal volumes.
|
||||
#RADICALE_DATA_DIR=/your/local/radicale/data
|
||||
|
||||
### borgbackup Settings ###
|
||||
BORG_PASSPHRASE=vivid-garnet-lantern-oxide-sparrow-47-reef
|
||||
PGHOST=postgres
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -17,15 +17,6 @@
|
||||
/config/traefik/dynamic/*
|
||||
!/config/traefik/dynamic/.gitkeep
|
||||
.DS_Store
|
||||
secrets/caddy_email
|
||||
secrets/opencloud_jwt_secret
|
||||
secrets/opencloud_transfer_secret
|
||||
secrets/openproject_secret_key_base
|
||||
secrets/traefik
|
||||
Persistent Backup/2025-11-24_18-10/gitea_data_2025-11-24_18-10.tar.gz
|
||||
Persistent Backup/2025-11-24_18-10/giteadb_2025-11-24_18-10.sql.gz
|
||||
Persistent Backup/2025-11-24_18-10/odoo_2025-11-24_18-10.sql.gz
|
||||
Persistent Backup/2025-11-24_18-10/odoo_config_2025-11-24_18-10.tar.gz
|
||||
Persistent Backup/2025-11-24_18-10/odoo_db_data_2025-11-24_18-10.tar.gz
|
||||
Persistent Backup/2025-11-24_18-10/opencloud_config_2025-11-24_18-10.tar.gz
|
||||
Persistent Backup/2025-11-24_18-10/opencloud_data_2025-11-24_18-10.tar.gz
|
||||
secrets
|
||||
Persistent Backup
|
||||
backups/*
|
||||
|
||||
@@ -26,6 +26,7 @@ services:
|
||||
BACKUP_RETENTION_COUNT: ${BKP_RETENTION_COUNT}
|
||||
BACKUP_RETENTION_DAYS: ${BKP_RETENTION_DAYS}
|
||||
TIMEZONE: ${TIMEZONE}
|
||||
APK_MIRROR: ${APK_MIRROR}
|
||||
volumes:
|
||||
- ./backups:/backups
|
||||
- type: volume
|
||||
@@ -50,4 +51,4 @@ services:
|
||||
read_only: true
|
||||
- ./scripts/backup/manage-backups.sh:/manage-backups.sh
|
||||
- ./scripts/backup/backup-manager.cron:/etc/crontabs/root
|
||||
entrypoint: ["/bin/sh", "-c", "# install bsdtar for xattr-aware archives\napk add --no-cache libarchive-tools attr >/dev/null \n# map host /backups ownership to container backup user\nHOST_UID=$$(stat -c '%u' /backups 2>/dev/null || echo 1000) && HOST_GID=$$(stat -c '%g' /backups 2>/dev/null || echo 1000) && addgroup -g \"$$HOST_GID\" backup 2>/dev/null || true && adduser -D -u \"$$HOST_UID\" -G backup backup 2>/dev/null || true && mkdir -p /var/log /backups && chown -R \"$$HOST_UID\":\"$$HOST_GID\" /var/log /backups 2>/dev/null || true && chmod +x /manage-backups.sh && chown root:root /etc/crontabs/root 2>/dev/null || true && crond -f"]
|
||||
entrypoint: ["/bin/sh", "-c", "# install bsdtar for xattr-aware archives\nif [ -n \"$$APK_MIRROR\" ]; then sed -i \"s|https://dl-cdn.alpinelinux.org|$$APK_MIRROR|g\" /etc/apk/repositories; fi && apk add --no-cache libarchive-tools attr >/dev/null \n# map host /backups ownership to container backup user\nHOST_UID=$$(stat -c '%u' /backups 2>/dev/null || echo 1000) && HOST_GID=$$(stat -c '%g' /backups 2>/dev/null || echo 1000) && addgroup -g \"$$HOST_GID\" backup 2>/dev/null || true && adduser -D -u \"$$HOST_UID\" -G backup backup 2>/dev/null || true && mkdir -p /var/log /backups && chown -R \"$$HOST_UID\":\"$$HOST_GID\" /var/log /backups 2>/dev/null || true && chmod +x /manage-backups.sh && chown root:root /etc/crontabs/root 2>/dev/null || true && crond -f"]
|
||||
|
||||
@@ -34,8 +34,10 @@ BORG_PASSPHRASE=your-strong-passphrase
|
||||
2. Initialize the repository (first time only):
|
||||
|
||||
```bash
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
borgmatic init --encryption repokey-blake2
|
||||
docker compose build borgmatic
|
||||
|
||||
docker compose run --rm borgmatic \
|
||||
init --encryption repokey-blake2
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -43,36 +45,40 @@ docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
### Run Manual Backup
|
||||
|
||||
```bash
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
borgmatic --stats -v 1
|
||||
docker compose build borgmatic
|
||||
|
||||
docker compose run --rm borgmatic \
|
||||
--stats -v 1
|
||||
```
|
||||
|
||||
### Start Scheduled Backups
|
||||
|
||||
```bash
|
||||
docker compose -f backup/borgmatic.yml up -d
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### List Archives
|
||||
|
||||
```bash
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
borgmatic list
|
||||
docker compose build borgmatic
|
||||
|
||||
docker compose run --rm borgmatic \
|
||||
list
|
||||
```
|
||||
|
||||
### Restore
|
||||
|
||||
```bash
|
||||
# List files in an archive
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
docker compose run --rm borgmatic \
|
||||
borg list ::archive-name
|
||||
|
||||
# Extract entire archive
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
docker compose run --rm borgmatic \
|
||||
borg extract ::archive-name
|
||||
|
||||
# Extract specific path
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
docker compose run --rm borgmatic \
|
||||
borg extract ::archive-name source/gitea_data
|
||||
```
|
||||
|
||||
@@ -80,7 +86,7 @@ docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
|
||||
```bash
|
||||
# Extract dump from backup
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
docker compose run --rm borgmatic \
|
||||
borg extract ::archive-name source/pgdumps/giteadb.dump
|
||||
|
||||
# Restore to database
|
||||
@@ -90,8 +96,10 @@ docker exec -i postgres pg_restore -U admin -d giteadb -c /path/to/giteadb.dump
|
||||
### Check Repository
|
||||
|
||||
```bash
|
||||
docker compose -f backup/borgmatic.yml run --rm borgmatic \
|
||||
borgmatic check
|
||||
docker compose build borgmatic
|
||||
|
||||
docker compose run --rm borgmatic \
|
||||
check
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -34,15 +34,10 @@ services:
|
||||
|
||||
volumes:
|
||||
opencloud-config:
|
||||
external: true
|
||||
opencloud-data:
|
||||
external: true
|
||||
gitea_data:
|
||||
external: true
|
||||
odoo-db-data:
|
||||
external: true
|
||||
odoo-config:
|
||||
external: true
|
||||
borg-repo:
|
||||
borgmatic-pgdumps:
|
||||
borgmatic-cache:
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
@@ -1,20 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': 'Custom Delivery Slip',
|
||||
'version': '19.0.1.0.1',
|
||||
'category': 'Inventory',
|
||||
'summary': 'Add production and expiration dates to delivery order labels',
|
||||
'description': """
|
||||
Adds production and expiration date labels to delivery orders.
|
||||
- Production date (today's date)
|
||||
- Expiration date (6 months from production)
|
||||
""",
|
||||
'depends': ['stock'],
|
||||
'data': [
|
||||
'views/stock_picking_form.xml',
|
||||
'views/delivery_slip_report.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
production_date = fields.Date(
|
||||
string='Production Date',
|
||||
compute='_compute_production_date',
|
||||
store=False,
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
expiration_date = fields.Date(
|
||||
string='Expiration Date',
|
||||
compute='_compute_expiration_date',
|
||||
store=False,
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
lot_number = fields.Char(
|
||||
string='Lot Number',
|
||||
related='lot_id.name',
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
product_ref = fields.Char(
|
||||
string='Product Reference',
|
||||
related='product_id.default_code',
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
@api.depends('move_id.create_date')
|
||||
def _compute_production_date(self):
|
||||
"""Set production date to today or the move's creation date"""
|
||||
for line in self:
|
||||
line.production_date = fields.Date.today()
|
||||
|
||||
@api.depends('move_id.create_date')
|
||||
def _compute_expiration_date(self):
|
||||
"""Set expiration date to 6 months (180 days) from today"""
|
||||
for line in self:
|
||||
line.expiration_date = fields.Date.today() + timedelta(days=180)
|
||||
@@ -1,98 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- New report action for 5 kg slips -->
|
||||
<record id="action_report_5kg_slip" model="ir.actions.report">
|
||||
<field name="name">5 kg Slips</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">delivery_slip_custom.report_5kg_slip_document</field>
|
||||
<field name="report_file">delivery_slip_custom.report_5kg_slip_document</field>
|
||||
<field name="print_report_name">'5kg Slip - %s' % (object.name)</field>
|
||||
<field name="binding_model_id" ref="stock.model_stock_picking"/>
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
|
||||
<!-- Main template for 5 kg slips report -->
|
||||
<template id="report_5kg_slip_document">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<!-- Create a separate label for each move_line (actual product line) -->
|
||||
<t t-foreach="o.move_line_ids" t-as="line">
|
||||
<div class="page" style="page-break-after: always; page-break-inside: avoid;">
|
||||
<!-- Header -->
|
||||
<div class="text-center mb-4">
|
||||
<h3>5 kg Product Label</h3>
|
||||
</div>
|
||||
|
||||
<!-- Delivery Info -->
|
||||
<table class="table table-sm table-borderless mb-3">
|
||||
<tr>
|
||||
<td style="width: 40%;"><strong>Delivery Order:</strong></td>
|
||||
<td><span t-esc="o.name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Customer:</strong></td>
|
||||
<td><span t-esc="o.partner_id.name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Date:</strong></td>
|
||||
<td><span t-esc="o.scheduled_date.strftime('%Y-%m-%d') if o.scheduled_date else ''"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr class="my-4"/>
|
||||
|
||||
<!-- Product Information -->
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<td style="width: 35%; background-color: #f8f9fa;"><strong>Product Ref:</strong></td>
|
||||
<td><span t-esc="line.product_id.default_code or '-'"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background-color: #f8f9fa;"><strong>Product:</strong></td>
|
||||
<td><strong><span t-esc="line.product_id.name"/></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background-color: #f8f9fa;"><strong>Quantity:</strong></td>
|
||||
<td>
|
||||
<strong>
|
||||
<span t-esc="line.quantity"/>
|
||||
<span t-esc="line.product_uom_id.name"/>
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background-color: #f8f9fa;"><strong>Lot Number:</strong></td>
|
||||
<td>
|
||||
<span t-esc="line.lot_id.name if line.lot_id else '-'"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Date Information - Highlighted -->
|
||||
<table class="table table-bordered mt-4">
|
||||
<tr style="background-color: #d4edda;">
|
||||
<td style="width: 35%;"><strong>Production Date:</strong></td>
|
||||
<td>
|
||||
<strong style="font-size: 1.1em;"><span t-esc="line.production_date or '-'"/></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="background-color: #f8d7da;">
|
||||
<td><strong>Expiration Date:</strong></td>
|
||||
<td>
|
||||
<strong style="font-size: 1.1em; color: #721c24;"><span t-esc="line.expiration_date or '-'"/></strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Location -->
|
||||
<div class="mt-3">
|
||||
<strong>Source Location:</strong>
|
||||
<span t-esc="o.location_id.complete_name or o.location_id.name"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Add production and expiration date fields to stock move lines -->
|
||||
<record id="view_stock_move_line_tree" model="ir.ui.view">
|
||||
<field name="name">stock.move.line.tree.custom</field>
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_move_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="production_date" optional="show"/>
|
||||
<field name="expiration_date" optional="show"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user