snippets and patches

This commit is contained in:
janikvonrotz committed 2022-05-02 16:42:32 +02:00
1 parent 0b4dc7d9ed
commit 7c7a37231d
2 files changed
+48

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# Get script name
SCRIPT=$(basename "$0")
# First param is docker container
CONTAINER=$1
# Default configuration
PACKAGE_PATH="/mnt/addons/"
# Custom configuration
FILE_PATH="${PACKAGE_PATH}gio_payroll_custom/models/hr_employee.py"
FIND="from odoo import api, fields, models, _"
IFS='' read -r -d '' APPEND << EOM
class EmployeePublic(models.Model):
_inherit = 'hr.employee.public'
gio_children_training = fields.Integer(string="Anzahl Kinder im Studium")
EOM
# Get filename
FILE=`basename "$FILE_PATH"`
# Copy from docker
docker cp "$CONTAINER":"$FILE_PATH" .
LINE=$(grep -n "$FIND" $FILE | cut -f1 -d:)
# Find and append
awk -v n="$LINE" -v s="$APPEND" 'NR-1 == n {print s} {print}' $FILE > $FILE.tmp && mv $FILE.tmp $FILE
# Copy back to docker
docker cp $FILE "$CONTAINER":"$FILE_PATH"
# Register patch installation
echo "Patch $SCRIPT applied."
touch "/etc/odoo/${SCRIPT}_${CONTAINER}_installed"
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<data inherit_id="hr_attendance.view_attendance_tree" priority="50">
<tree position="attributes">
<attribute name="edit">1</attribute>
</tree>
</data>