Commit f79e0fe3 by aagusti

penambahan field nip dan npwp di partner

1 parent e52e887f
"""Add nip to partner
Revision ID: f95c10a7ae98
Revises: 56a7d9c8b0c6
Create Date: 2022-08-22 18:17:00.798094
"""
# revision identifiers, used by Alembic.
revision = 'f95c10a7ae98'
down_revision = '56a7d9c8b0c6'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
context = op.get_context()
helpers = context.opts['helpers']
if not helpers.table_has_column('partner', 'nip'):
op.add_column('partner', sa.Column('nip', sa.String(32)))
if not helpers.table_has_column('partner', 'npwp'):
op.add_column('partner', sa.Column('npwp', sa.String(32)))
def downgrade():
pass
...@@ -23,6 +23,17 @@ class NamaSchema(colander.Schema): ...@@ -23,6 +23,17 @@ class NamaSchema(colander.Schema):
class PartnerSchema(NamaSchema): class PartnerSchema(NamaSchema):
nip = colander.SchemaNode(
colander.String(),
missing=colander.drop,
validator=colander.Length(max=32),
oid="nip")
npwp = colander.SchemaNode(
colander.String(),
missing=colander.drop,
validator=colander.Length(max=32),
oid="npwp")
idcard = colander.SchemaNode( idcard = colander.SchemaNode(
FileData(), FileData(),
widget=widget.FileUploadWidget(mem_tmp_store), widget=widget.FileUploadWidget(mem_tmp_store),
......
...@@ -66,6 +66,7 @@ class Partner(Base, PartnerModel): ...@@ -66,6 +66,7 @@ class Partner(Base, PartnerModel):
kecamatan_id = Column(Integer, ForeignKey(ResKecamatan.id)) kecamatan_id = Column(Integer, ForeignKey(ResKecamatan.id))
desa_id = Column(Integer, ForeignKey(ResDesa.id)) desa_id = Column(Integer, ForeignKey(ResDesa.id))
company_id = Column(Integer) company_id = Column(Integer)
nip = Column(String(32))
# npwp = Column(String(16)) # npwp = Column(String(16))
# npwpd = Column(String(16)) # npwpd = Column(String(16))
......
...@@ -203,8 +203,10 @@ class Group(GroupMixin, Base, DefaultModel): ...@@ -203,8 +203,10 @@ class Group(GroupMixin, Base, DefaultModel):
# It is used when there is a web request. # It is used when there is a web request.
class RootFactory: class RootFactory:
def __init__(self, request): def __init__(self, request):
gr = DBSession.query(Group).filter_by(group_name="Superuser").first()
gr_id = gr and gr.id or 1
self.__acl__ = [ self.__acl__ = [
(Allow, 'group:1', ALL_PERMISSIONS), (Allow, f'group:{gr_id}', ALL_PERMISSIONS),
(Allow, Authenticated, 'view')] (Allow, Authenticated, 'view')]
for gp in DBSession.query(GroupPermission): for gp in DBSession.query(GroupPermission):
acl_name = 'group:{}'.format(gp.group_id) acl_name = 'group:{}'.format(gp.group_id)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!