Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0b939ccd7 | ||
|
|
0fc8fac5aa | ||
|
|
220c15b3fa | ||
|
|
a514c97409 | ||
|
|
77e2411a88 | ||
|
|
5565e923ab |
@@ -1 +1 @@
|
|||||||
__version__ = "11.1.5"
|
__version__ = "11.1.7"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import uuid
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from sqlalchemy.orm import Mapped, relationship
|
from sqlalchemy.orm import Mapped, relationship
|
||||||
@@ -18,6 +20,30 @@ class Account(AccountBase):
|
|||||||
"Product", primaryjoin="Account.id==Product.account_id", back_populates="account"
|
"Product", primaryjoin="Account.id==Product.account_id", back_populates="account"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
name: str,
|
||||||
|
type_id: int,
|
||||||
|
is_starred: bool,
|
||||||
|
is_active: bool,
|
||||||
|
is_reconcilable: bool,
|
||||||
|
cost_centre_id: uuid.UUID,
|
||||||
|
code: int | None = None,
|
||||||
|
id_: uuid.UUID | None = None,
|
||||||
|
is_fixture: bool = False,
|
||||||
|
) -> None:
|
||||||
|
if code is not None:
|
||||||
|
self.code = code
|
||||||
|
self.name = name
|
||||||
|
self.type_id = type_id
|
||||||
|
self.is_starred = is_starred
|
||||||
|
self.is_active = is_active
|
||||||
|
self.is_reconcilable = is_reconcilable
|
||||||
|
self.cost_centre_id = cost_centre_id
|
||||||
|
if id_ is not None:
|
||||||
|
self.id = id_
|
||||||
|
self.is_fixture = is_fixture
|
||||||
|
|
||||||
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
||||||
if len(self.products) > 0:
|
if len(self.products) > 0:
|
||||||
return False, "Account has products"
|
return False, "Account has products"
|
||||||
|
|||||||
@@ -70,13 +70,6 @@ class AccountBase:
|
|||||||
self.id = id_
|
self.id = id_
|
||||||
self.is_fixture = is_fixture
|
self.is_fixture = is_fixture
|
||||||
|
|
||||||
def create(self, db: Session) -> "AccountBase":
|
|
||||||
self.code = db.execute(
|
|
||||||
select(func.coalesce(func.max(AccountBase.code), 0) + 1).where(AccountBase.type_id == self.type_id)
|
|
||||||
).scalar_one()
|
|
||||||
db.add(self)
|
|
||||||
return self
|
|
||||||
|
|
||||||
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
def can_delete(self, advanced_delete: bool) -> tuple[bool, str]:
|
||||||
if self.is_fixture:
|
if self.is_fixture:
|
||||||
return False, f"{self.name} is a fixture and cannot be edited or deleted."
|
return False, f"{self.name} is a fixture and cannot be edited or deleted."
|
||||||
|
|||||||
@@ -35,15 +35,14 @@ def save(
|
|||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
item = Account(
|
item = Account(
|
||||||
name=data.name,
|
name=data.name,
|
||||||
|
code=Account.get_code(data.type_, db),
|
||||||
type_id=data.type_,
|
type_id=data.type_,
|
||||||
is_starred=data.is_starred,
|
is_starred=data.is_starred,
|
||||||
is_active=data.is_active,
|
is_active=data.is_active,
|
||||||
is_reconcilable=data.is_reconcilable,
|
is_reconcilable=data.is_reconcilable,
|
||||||
cost_centre_id=data.cost_centre.id_,
|
cost_centre_id=data.cost_centre.id_,
|
||||||
)
|
)
|
||||||
item.code = db.execute(
|
|
||||||
select(func.coalesce(func.max(Account.code), 0) + 1).where(Account.type_id == item.type_id)
|
|
||||||
).scalar_one()
|
|
||||||
db.add(item)
|
db.add(item)
|
||||||
db.commit()
|
db.commit()
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "brewman"
|
name = "brewman"
|
||||||
version = "11.1.5"
|
version = "11.1.7"
|
||||||
description = "Accounting plus inventory management for a restaurant."
|
description = "Accounting plus inventory management for a restaurant."
|
||||||
authors = ["tanshu <git@tanshu.com>"]
|
authors = ["tanshu <git@tanshu.com>"]
|
||||||
|
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ else
|
|||||||
echo "No version bump"
|
echo "No version bump"
|
||||||
fi
|
fi
|
||||||
cd "$parent_path/docker" || exit
|
cd "$parent_path/docker" || exit
|
||||||
docker save brewman:latest | bzip2 | pv | ssh beacon 'bunzip2 | sudo docker load'
|
docker save brewman:latest | bzip2 | pv | ssh gondor 'bunzip2 | sudo docker load'
|
||||||
ansible-playbook --inventory hosts playbook.yml
|
ansible-playbook --inventory hosts playbook.yml
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ HOST=0.0.0.0
|
|||||||
PORT=80
|
PORT=80
|
||||||
LOG_LEVEL=WARN
|
LOG_LEVEL=WARN
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_hinchco
|
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/brewman_{{ name }}
|
||||||
MODULE_NAME=brewman.main
|
MODULE_NAME=brewman.main
|
||||||
PROJECT_NAME=brewman
|
PROJECT_NAME=brewman
|
||||||
POSTGRES_SERVER=db
|
SECRET_KEY={{ secret_key }}
|
||||||
POSTGRES_USER=postgres
|
MIDDLEWARE_SECRET_KEY={{ middleware_key }}
|
||||||
POSTGRES_PASSWORD=123456
|
|
||||||
POSTGRES_DB=brewman_hinchco
|
|
||||||
SECRET_KEY=7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
|
|
||||||
MIDDLEWARE_SECRET_KEY=1e36e7f678
|
|
||||||
ALGORITHM=HS256
|
ALGORITHM=HS256
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
ALEMBIC_LOG_LEVEL=INFO
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/acc
|
|
||||||
MODULE_NAME=brewman.main
|
|
||||||
PROJECT_NAME=brewman
|
|
||||||
POSTGRES_SERVER=db
|
|
||||||
POSTGRES_USER=postgres
|
|
||||||
POSTGRES_PASSWORD=123456
|
|
||||||
POSTGRES_DB=exp
|
|
||||||
SECRET_KEY=c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
|
|
||||||
MIDDLEWARE_SECRET_KEY=cb71666b9c
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/exp
|
|
||||||
MODULE_NAME=brewman.main
|
|
||||||
PROJECT_NAME=brewman
|
|
||||||
POSTGRES_SERVER=db
|
|
||||||
POSTGRES_USER=postgres
|
|
||||||
POSTGRES_PASSWORD=123456
|
|
||||||
POSTGRES_DB=exp
|
|
||||||
SECRET_KEY=8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
|
|
||||||
MIDDLEWARE_SECRET_KEY=da6fcd999b
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/hops
|
|
||||||
MODULE_NAME=brewman.main
|
|
||||||
PROJECT_NAME=brewman
|
|
||||||
POSTGRES_SERVER=db
|
|
||||||
POSTGRES_USER=postgres
|
|
||||||
POSTGRES_PASSWORD=123456
|
|
||||||
POSTGRES_DB=exp
|
|
||||||
SECRET_KEY=cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
|
|
||||||
MIDDLEWARE_SECRET_KEY=9c2bdd24be
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/mhl
|
|
||||||
MODULE_NAME=brewman.main
|
|
||||||
PROJECT_NAME=brewman
|
|
||||||
POSTGRES_SERVER=db
|
|
||||||
POSTGRES_USER=postgres
|
|
||||||
POSTGRES_PASSWORD=123456
|
|
||||||
POSTGRES_DB=exp
|
|
||||||
SECRET_KEY=c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
|
|
||||||
MIDDLEWARE_SECRET_KEY=9183bdcfb0
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
||||||
+5
-5
@@ -5,11 +5,11 @@
|
|||||||
# - A hostname/ip can be a member of multiple groups
|
# - A hostname/ip can be a member of multiple groups
|
||||||
|
|
||||||
[brewman]
|
[brewman]
|
||||||
acc ansible_host=beacon var_file=vars/acc.yml
|
acc ansible_host=gondor var_file=vars/acc.yml
|
||||||
exp ansible_host=beacon var_file=vars/exp.yml
|
exp ansible_host=gondor var_file=vars/exp.yml
|
||||||
hops ansible_host=beacon var_file=vars/hops.yml
|
hops ansible_host=gondor var_file=vars/hops.yml
|
||||||
mhl ansible_host=beacon var_file=vars/mhl.yml
|
mhl ansible_host=gondor var_file=vars/mhl.yml
|
||||||
hinchco ansible_host=beacon var_file=vars/hinchco.yml
|
hinchco ansible_host=gondor var_file=vars/hinchco.yml
|
||||||
|
|
||||||
[all:vars]
|
[all:vars]
|
||||||
ansible_python_interpreter=/usr/bin/python3
|
ansible_python_interpreter=/usr/bin/python3
|
||||||
|
|||||||
+6
-3
@@ -6,6 +6,7 @@
|
|||||||
become: true
|
become: true
|
||||||
vars_files:
|
vars_files:
|
||||||
- "{{ var_file }}"
|
- "{{ var_file }}"
|
||||||
|
- vars/default.yml
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Copy dockerfile
|
- name: Copy dockerfile
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
|
|
||||||
- name: Upload the .env file
|
- name: Upload the .env file
|
||||||
template:
|
template:
|
||||||
src: "{{ env_file }}"
|
src: "files/.env"
|
||||||
dest: "/var/lib/{{ host_directory }}/.env"
|
dest: "/var/lib/{{ host_directory }}/.env"
|
||||||
|
|
||||||
- name: Create brewman container
|
- name: Create brewman container
|
||||||
@@ -40,8 +41,10 @@
|
|||||||
state: started
|
state: started
|
||||||
restart_policy: "unless-stopped"
|
restart_policy: "unless-stopped"
|
||||||
env_file: "/var/lib/{{ host_directory }}/.env"
|
env_file: "/var/lib/{{ host_directory }}/.env"
|
||||||
links:
|
etc_hosts:
|
||||||
- "postgres:db"
|
db : "{{ db_host }}"
|
||||||
|
# links:
|
||||||
|
# - "postgres:db"
|
||||||
published_ports:
|
published_ports:
|
||||||
- "127.0.0.1:{{ host_port }}:80"
|
- "127.0.0.1:{{ host_port }}:80"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: acc
|
||||||
|
|
||||||
http_host: "acc.hopsngrains.com"
|
http_host: "acc.hopsngrains.com"
|
||||||
http_conf: "acc.hopsngrains.com.conf"
|
http_conf: "acc.hopsngrains.com.conf"
|
||||||
host_port: "8659"
|
host_port: "8659"
|
||||||
host_directory: "brewman-acc"
|
|
||||||
env_file: "files/.env-acc"
|
secret_key: c9bee2d38676447c2f7a9ea715446e2fd09f16fbaa5b3f6a6f207ec18993987f
|
||||||
|
middleware_key: cb71666b9c
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
db_host: 172.26.12.67
|
||||||
|
host_directory: "brewman-{{ name }}"
|
||||||
|
db_name: "brewman_{{ name }}"
|
||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: exp
|
||||||
|
|
||||||
http_host: "exp.tanshu.com"
|
http_host: "exp.tanshu.com"
|
||||||
http_conf: "exp.tanshu.com.conf"
|
http_conf: "exp.tanshu.com.conf"
|
||||||
host_port: "8656"
|
host_port: "8656"
|
||||||
host_directory: "brewman-exp"
|
|
||||||
env_file: "files/.env-exp"
|
secret_key: 8546a61262dab7c05ccf2e26abe30bc10966904df6dfd29259ea85dd0844a8e7
|
||||||
|
middleware_key: da6fcd999b
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: hinchco
|
||||||
|
|
||||||
http_host: "acc.hinchco.in"
|
http_host: "acc.hinchco.in"
|
||||||
http_conf: "acc.hinchco.in.conf"
|
http_conf: "acc.hinchco.in.conf"
|
||||||
host_port: "8655"
|
host_port: "8655"
|
||||||
host_directory: "brewman-hinchco"
|
|
||||||
env_file: "files/.env-hinchco"
|
secret_key: 7b889cff76532fde8483304cf415243f70df200518ba9aee4d26c0709ad6fbd1
|
||||||
|
middleware_key: 1e36e7f678
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: hops
|
||||||
|
|
||||||
http_host: "hops.hopsngrains.com"
|
http_host: "hops.hopsngrains.com"
|
||||||
http_conf: "hops.hopsngrains.com.conf"
|
http_conf: "hops.hopsngrains.com.conf"
|
||||||
host_port: "8658"
|
host_port: "8658"
|
||||||
host_directory: "brewman-hops"
|
|
||||||
env_file: "files/.env-hops"
|
secret_key: cfb3be420c4e2b0ed423b2e4e238713d0461e2ba56198138ad6c4d82aef6295c
|
||||||
|
middleware_key: 9c2bdd24be
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: mhl
|
||||||
|
|
||||||
http_host: "mhl.hopsngrains.com"
|
http_host: "mhl.hopsngrains.com"
|
||||||
http_conf: "mhl.hopsngrains.com.conf"
|
http_conf: "mhl.hopsngrains.com.conf"
|
||||||
host_port: "8657"
|
host_port: "8657"
|
||||||
host_directory: "brewman-mhl"
|
|
||||||
env_file: "files/.env-mhl"
|
secret_key: c9fd1b99931feb083f67470170650420b99eb35368d3de186427166c28d32c8b
|
||||||
|
middleware_key: 9183bdcfb0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "overlord",
|
"name": "overlord",
|
||||||
"version": "11.1.5",
|
"version": "11.1.7",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
|
|||||||
@@ -193,10 +193,10 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.voucher.inventories.push(
|
this.voucher.inventories.push(
|
||||||
new Inventory({
|
new Inventory({
|
||||||
quantity,
|
quantity,
|
||||||
rate: this.batch.rate,
|
rate: +this.batch.rate,
|
||||||
tax: this.batch.tax,
|
tax: +this.batch.tax,
|
||||||
discount: this.batch.discount,
|
discount: +this.batch.discount,
|
||||||
amount: quantity * this.batch.rate * (1 + this.batch.tax) * (1 - this.batch.discount),
|
amount: quantity * +this.batch.rate * (1 + +this.batch.tax) * (1 - +this.batch.discount),
|
||||||
batch: this.batch,
|
batch: this.batch,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ export const environment = {
|
|||||||
production: true,
|
production: true,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||||
version: '11.1.5',
|
version: '11.1.7',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const environment = {
|
|||||||
production: false,
|
production: false,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
|
||||||
version: '11.1.5',
|
version: '11.1.7',
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user