Compare commits
6 Commits
b194ffb67b
...
odoo18
| Author | SHA1 | Date | |
|---|---|---|---|
| 29a92d58c9 | |||
| 4456e5b043 | |||
| 85c0a9bb63 | |||
| 3fa2c3553f | |||
| abc17af06b | |||
| 309fa0ad0d |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,7 @@
|
|||||||
.env
|
.env
|
||||||
config/odoo.conf
|
config/odoo.conf
|
||||||
|
config/odoo18.conf
|
||||||
|
odoo18/
|
||||||
|
enterprise/
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
FROM odoo:18
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Install extra system packages if needed
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
python3-pip \
|
||||||
|
python3-dev \
|
||||||
|
build-essential \
|
||||||
|
libldap2-dev \
|
||||||
|
libsasl2-dev \
|
||||||
|
libssl-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy Odoo source requirements
|
||||||
|
#COPY ./odoo18/requirements.txt /tmp/requirements.txt
|
||||||
|
|
||||||
|
# Install Python dependencies
|
||||||
|
#RUN pip3 install --break-system-packages -r /tmp/requirements.txt
|
||||||
|
|
||||||
|
# Create working directory
|
||||||
|
WORKDIR /opt/odoo
|
||||||
|
|
||||||
|
USER odoo
|
||||||
|
|
||||||
|
CMD ["python3", "/opt/odoo/odoo-bin", "-c", "/etc/odoo/odoo.conf"]
|
||||||
15
README.md
15
README.md
@@ -114,7 +114,20 @@ Tabel inti Odoo 19 yang digunakan dalam alur di atas:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 6. Perintah Manajemen Docker
|
## 6. Master Data Import
|
||||||
|
|
||||||
|
Kami menyediakan file template Excel untuk mempercepat input data:
|
||||||
|
* **Lokasi Template:** `/templates/`
|
||||||
|
* **File tersedia:**
|
||||||
|
* `import-products.xlsx`: Template produk.
|
||||||
|
* `import-product-categories.xlsx`: Template kategori.
|
||||||
|
* `README-IMPORT.md`: Panduan lengkap import master data.
|
||||||
|
|
||||||
|
* **Catatan:** Jangan isi kolom `Item Code` saat import — sistem akan meng-generate-nya otomatis (format: `parent+child+id+name_slug`, koma → titik).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Perintah Manajemen Docker
|
||||||
|
|
||||||
* **Menjalankan stack:**
|
* **Menjalankan stack:**
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
1468
README_odoo18.md
Normal file
1468
README_odoo18.md
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -20,10 +20,13 @@ class SaleOrder(models.Model):
|
|||||||
order.name = seq.with_date(order.date_order or fields.Date.context_today(self)).next_by_code()
|
order.name = seq.with_date(order.date_order or fields.Date.context_today(self)).next_by_code()
|
||||||
return super().action_confirm()
|
return super().action_confirm()
|
||||||
|
|
||||||
@api.model
|
@api.model_create_multi
|
||||||
def create(self, vals):
|
def create(self, vals_list):
|
||||||
"""When creating a quotation (draft), use SQ sequence."""
|
"""When creating quotations (draft), use the SQ sequence."""
|
||||||
if vals.get('state') == 'draft' and not vals.get('name'):
|
for vals in vals_list:
|
||||||
seq = self._get_quotation_sequence_id()
|
if vals.get('state') == 'draft' and not vals.get('name'):
|
||||||
vals['name'] = seq.with_date(vals.get('date_order') or fields.Date.context_today(self)).next_by_code()
|
seq = self._get_quotation_sequence_id()
|
||||||
return super().create(vals)
|
vals['name'] = seq.with_date(
|
||||||
|
vals.get('date_order') or fields.Date.context_today(self)
|
||||||
|
).next_by_code()
|
||||||
|
return super().create(vals_list)
|
||||||
1
custom_addons/kosbar_purchase_finance/__init__.py
Normal file
1
custom_addons/kosbar_purchase_finance/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
18
custom_addons/kosbar_purchase_finance/__manifest__.py
Normal file
18
custom_addons/kosbar_purchase_finance/__manifest__.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
'name': 'Kos Barokah Purchase Finance',
|
||||||
|
'version': '1.0',
|
||||||
|
'category': 'Purchases',
|
||||||
|
'summary': 'Permintaan barang gudang + approval PO oleh Finance',
|
||||||
|
'author': 'Kos Barokah',
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'depends': ['purchase', 'stock', 'product', 'kosbar_erp_ext'],
|
||||||
|
'data': [
|
||||||
|
'security/res_groups.xml',
|
||||||
|
'security/ir.model.access.csv',
|
||||||
|
'data/ir_sequence.xml',
|
||||||
|
'views/purchase_request_views.xml',
|
||||||
|
'views/purchase_order_views.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
'application': False,
|
||||||
|
}
|
||||||
11
custom_addons/kosbar_purchase_finance/data/ir_sequence.xml
Normal file
11
custom_addons/kosbar_purchase_finance/data/ir_sequence.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="seq_purchase_request" model="ir.sequence">
|
||||||
|
<field name="name">Purchase Request Kos Barokah</field>
|
||||||
|
<field name="code">kosbar.purchase.request</field>
|
||||||
|
<field name="padding">5</field>
|
||||||
|
<field name="prefix">PR/%(year)s/</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
2
custom_addons/kosbar_purchase_finance/models/__init__.py
Normal file
2
custom_addons/kosbar_purchase_finance/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from . import purchase_request
|
||||||
|
from . import purchase_order
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseOrder(models.Model):
|
||||||
|
_inherit = 'purchase.order'
|
||||||
|
|
||||||
|
finance_state = fields.Selection([
|
||||||
|
('pending', 'Pending Approval'),
|
||||||
|
('approved', 'Finance Approved'),
|
||||||
|
('rejected', 'Rejected'),
|
||||||
|
], string='Status Finance', default='pending', tracking=True)
|
||||||
|
|
||||||
|
def action_finance_approve(self):
|
||||||
|
"""Finance mengklik ini setelah review PO."""
|
||||||
|
return self.write({'finance_state': 'approved'})
|
||||||
|
|
||||||
|
def action_finance_reject(self):
|
||||||
|
"""Finance menolak PO — ada catatan di notes."""
|
||||||
|
return self.write({'finance_state': 'rejected'})
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _get_state_color(self):
|
||||||
|
# optional: styling di kanban view
|
||||||
|
return {'pending': 'warning', 'approved': 'success', 'rejected': 'danger'}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseRequest(models.Model):
|
||||||
|
_name = 'kosbar.purchase.request'
|
||||||
|
_description = 'Purchase Request dari Gudang'
|
||||||
|
_order = 'id desc'
|
||||||
|
|
||||||
|
name = fields.Char(
|
||||||
|
string='Nomor Request',
|
||||||
|
required=True,
|
||||||
|
copy=False,
|
||||||
|
readonly=True,
|
||||||
|
default='New',
|
||||||
|
)
|
||||||
|
user_id = fields.Many2one(
|
||||||
|
'res.users',
|
||||||
|
string='Diminta Oleh',
|
||||||
|
default=lambda self: self.env.user,
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
date_required = fields.Date(string='Tanggal Dibutuhkan', default=fields.Date.today())
|
||||||
|
state = fields.Selection([
|
||||||
|
('draft', 'Draft'),
|
||||||
|
('submitted', 'Submitted'),
|
||||||
|
('approved', 'Approved / In Progress'),
|
||||||
|
('done', 'Done'),
|
||||||
|
('rejected', 'Rejected'),
|
||||||
|
], string='Status', default='draft', tracking=True)
|
||||||
|
|
||||||
|
line_ids = fields.One2many(
|
||||||
|
'kosbar.purchase.request.line',
|
||||||
|
'request_id',
|
||||||
|
string='Daftar Barang',
|
||||||
|
)
|
||||||
|
notes = fields.Text(string='Catatan / Keperluan')
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals_list):
|
||||||
|
for vals in vals_list:
|
||||||
|
if vals.get('name', 'New') == 'New':
|
||||||
|
seq = self.env['ir.sequence'].next_by_code('kosbar.purchase.request')
|
||||||
|
vals['name'] = seq if seq else 'PR/2026/00001'
|
||||||
|
return super().create(vals_list)
|
||||||
|
|
||||||
|
def action_submit(self):
|
||||||
|
self.write({'state': 'submitted'})
|
||||||
|
|
||||||
|
def action_approve(self):
|
||||||
|
self.write({'state': 'approved'})
|
||||||
|
|
||||||
|
def action_done(self):
|
||||||
|
self.write({'state': 'done'})
|
||||||
|
|
||||||
|
def action_reject(self):
|
||||||
|
self.write({'state': 'rejected'})
|
||||||
|
|
||||||
|
def action_draft(self):
|
||||||
|
self.write({'state': 'draft'})
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseRequestLine(models.Model):
|
||||||
|
_name = 'kosbar.purchase.request.line'
|
||||||
|
_description = 'Detail Item Purchase Request'
|
||||||
|
|
||||||
|
request_id = fields.Many2one('kosbar.purchase.request', string='Request Reference', ondelete='cascade')
|
||||||
|
|
||||||
|
# Bisa pilih barang existing ATAU buat barang baru langsung
|
||||||
|
is_new_product = fields.Boolean(string='Barang Baru?', default=False)
|
||||||
|
product_id = fields.Many2one('product.product', string='Produk (Existing)')
|
||||||
|
|
||||||
|
# Jika barang baru
|
||||||
|
new_product_name = fields.Char(string='Nama Barang Baru')
|
||||||
|
categ_id = fields.Many2one('product.category', string='Kategori Barang')
|
||||||
|
|
||||||
|
product_qty = fields.Float(string='Jumlah', default=1.0, required=True)
|
||||||
|
product_uom = fields.Many2one('uom.uom', string='Satuan', default=lambda self: self.env.ref('uom.product_uom_unit', raise_if_not_found=False))
|
||||||
|
price_unit = fields.Float(string='Estimasi Harga Satuan')
|
||||||
|
notes = fields.Char(string='Keterangan')
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_purchase_request,access_purchase_request,model_kosbar_purchase_request,base.group_user,1,1,1,0
|
||||||
|
access_purchase_request_line,access_purchase_request_line,model_kosbar_purchase_request_line,base.group_user,1,1,1,0
|
||||||
|
access_purchase_order_finance,access_purchase_order_finance,model_purchase_order,kosbar_purchase_finance.group_finance,1,1,0,0
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<!-- Group Finance khusus -->
|
||||||
|
<record id="group_finance" model="res.groups">
|
||||||
|
<field name="name">Finance / Accounting Approval</field>
|
||||||
|
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<!-- Purchase Order : inherit form utk approval finance -->
|
||||||
|
<record id="view_purchase_order_finance" model="ir.ui.view">
|
||||||
|
<field name="name">purchase.order.form.finance</field>
|
||||||
|
<field name="model">purchase.order</field>
|
||||||
|
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
|
<!-- Tombol approve/reject di header PO -->
|
||||||
|
<xpath expr="//header" position="inside">
|
||||||
|
<button name="action_finance_approve" string="Finance Approve"
|
||||||
|
type="object" class="btn-success"
|
||||||
|
groups="kosbar_purchase_finance.group_finance"
|
||||||
|
invisible="finance_state in ['approved','rejected']"/>
|
||||||
|
<button name="action_finance_reject" string="Finance Reject"
|
||||||
|
type="object" class="btn-danger"
|
||||||
|
groups="kosbar_purchase_finance.group_finance"
|
||||||
|
invisible="finance_state == 'rejected'"/>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
|
<!-- Field status finance di sheet -->
|
||||||
|
<xpath expr="//sheet/div[hasclass('oe_button_box')]" position="inside">
|
||||||
|
<field name="finance_state" readonly="1"
|
||||||
|
class="oe_stat_button" icon="fa-money"/>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Status finance di list view PO -->
|
||||||
|
<record id="view_purchase_order_finance_tree" model="ir.ui.view">
|
||||||
|
<field name="name">purchase.order.tree.finance</field>
|
||||||
|
<field name="model">purchase.order</field>
|
||||||
|
<field name="inherit_id" ref="purchase.purchase_order_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="state" position="after">
|
||||||
|
<field name="finance_state" readonly="1"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<!-- Purchase Request : List view -->
|
||||||
|
<record id="view_purchase_request_tree" model="ir.ui.view">
|
||||||
|
<field name="name">kosbar.purchase.request.tree</field>
|
||||||
|
<field name="model">kosbar.purchase.request</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<list string="Permintaan Barang" editable="bottom">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="user_id"/>
|
||||||
|
<field name="date_required"/>
|
||||||
|
<field name="state"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Purchase Request : Form view -->
|
||||||
|
<record id="view_purchase_request_form" model="ir.ui.view">
|
||||||
|
<field name="name">kosbar.purchase.request.form</field>
|
||||||
|
<field name="model">kosbar.purchase.request</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Permintaan Barang">
|
||||||
|
<header>
|
||||||
|
<button name="action_submit" string="Submit" type="object"
|
||||||
|
class="btn-primary" invisible="state != 'draft'"/>
|
||||||
|
<button name="action_approve" string="Approved" type="object"
|
||||||
|
class="btn-success" invisible="state != 'submitted'"/>
|
||||||
|
<button name="action_done" string="Mark Done" type="object"
|
||||||
|
class="btn-secondary" invisible="state != 'approved'"/>
|
||||||
|
<button name="action_reject" string="Reject" type="object"
|
||||||
|
class="btn-danger" invisible="state != 'submitted'"/>
|
||||||
|
<button name="action_draft" string="Reset to Draft" type="object"
|
||||||
|
invisible="state != 'rejected'"/>
|
||||||
|
<field name="state" widget="statusbar" statusbar_visible="draft,submitted,approved,done"/>
|
||||||
|
</header>
|
||||||
|
<sheet>
|
||||||
|
<div class="oe_title">
|
||||||
|
<h1><field name="name" readonly="1"/></h1>
|
||||||
|
</div>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="user_id"/>
|
||||||
|
<field name="date_required"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="state" readonly="1"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<notebook>
|
||||||
|
<page string="Barang">
|
||||||
|
<field name="line_ids">
|
||||||
|
<list editable="bottom">
|
||||||
|
<field name="is_new_product"/>
|
||||||
|
<field name="product_id" invisible="is_new_product"/>
|
||||||
|
<field name="new_product_name" invisible="not is_new_product"/>
|
||||||
|
<field name="categ_id" invisible="not is_new_product"/>
|
||||||
|
<field name="product_qty"/>
|
||||||
|
<field name="product_uom"/>
|
||||||
|
<field name="price_unit"/>
|
||||||
|
<field name="notes" optional="show"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
<page string="Keterangan">
|
||||||
|
<field name="notes" placeholder="Keperluan / alasan pembelian"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Action & Menu -->
|
||||||
|
<record id="action_purchase_request" model="ir.actions.act_window">
|
||||||
|
<field name="name">Permintaan Barang</field>
|
||||||
|
<field name="res_model">kosbar.purchase.request</field>
|
||||||
|
<field name="view_mode">list,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem id="menu_purchase_request"
|
||||||
|
name="Permintaan Barang"
|
||||||
|
parent="purchase.menu_purchase_root"
|
||||||
|
action="action_purchase_request"
|
||||||
|
sequence="70"/>
|
||||||
|
</odoo>
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: postgres:16
|
image: postgres:16
|
||||||
@@ -12,6 +10,8 @@ services:
|
|||||||
- POSTGRES_DB=${POSTGRES_DB:-postgres}
|
- POSTGRES_DB=${POSTGRES_DB:-postgres}
|
||||||
volumes:
|
volumes:
|
||||||
- erp_pgdata:/var/lib/postgresql/data
|
- erp_pgdata:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-odoo} -d ${POSTGRES_DB:-postgres}"]
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-odoo} -d ${POSTGRES_DB:-postgres}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -19,7 +19,7 @@ services:
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
odoo:
|
odoo:
|
||||||
image: odoo:19.0
|
build: .
|
||||||
container_name: odoo-erp
|
container_name: odoo-erp
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
@@ -35,8 +35,10 @@ services:
|
|||||||
- "18070:8069"
|
- "18070:8069"
|
||||||
volumes:
|
volumes:
|
||||||
- erp_webdata:/var/lib/odoo
|
- erp_webdata:/var/lib/odoo
|
||||||
- ./config:/etc/odoo
|
- ./config/odoo18.conf:/etc/odoo/odoo.conf
|
||||||
- ./addons:/mnt/extra-addons
|
- ./odoo18:/opt/odoo
|
||||||
|
- ./custom_addons:/mnt/extra-addons
|
||||||
|
- ./enterprise:/mnt/enterprise
|
||||||
command: ["odoo", "-c", "/etc/odoo/odoo.conf"]
|
command: ["odoo", "-c", "/etc/odoo/odoo.conf"]
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -22,3 +22,7 @@ Folder ini berisi contoh file template untuk import master data ke Odoo ERP.
|
|||||||
## Contoh hasil otomatis
|
## Contoh hasil otomatis
|
||||||
- Kategori `Elektronik` (code `01`), kategori `Laptop` (code `04`, parent `Elektronik`), produk `MacBook Air M2` (id `0001`):
|
- Kategori `Elektronik` (code `01`), kategori `Laptop` (code `04`, parent `Elektronik`), produk `MacBook Air M2` (id `0001`):
|
||||||
- `item_code = 01040001macbookairm2`
|
- `item_code = 01040001macbookairm2`
|
||||||
|
## Opsi cli
|
||||||
|
```bash
|
||||||
|
python3 -m venv /tmp/xlsxenv && /tmp/...
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user