first commit

This commit is contained in:
Suherdy Yacob 2026-05-11 09:12:01 +07:00
commit c1ae85c99b
29 changed files with 215 additions and 0 deletions

4
__init__.py Executable file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import controllers
from . import models

34
__manifest__.py Executable file
View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
{
'name': "cst_extend_journal_code",
'summary': "Extend Journal Code to 15 Character",
'description': """
Long description of module's purpose
""",
'author': "Aziz",
'website': "https://www.yourcompany.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Accounting',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['account'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
controllers/__init__.py Executable file
View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

22
controllers/controllers.py Executable file
View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# from odoo import http
# class CstExtendJournalCode(http.Controller):
# @http.route('/cst_extend_journal_code/cst_extend_journal_code', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/cst_extend_journal_code/cst_extend_journal_code/objects', auth='public')
# def list(self, **kw):
# return http.request.render('cst_extend_journal_code.listing', {
# 'root': '/cst_extend_journal_code/cst_extend_journal_code',
# 'objects': http.request.env['cst_extend_journal_code.cst_extend_journal_code'].search([]),
# })
# @http.route('/cst_extend_journal_code/cst_extend_journal_code/objects/<model("cst_extend_journal_code.cst_extend_journal_code"):obj>', auth='public')
# def object(self, obj, **kw):
# return http.request.render('cst_extend_journal_code.object', {
# 'object': obj
# })

30
demo/demo.xml Executable file
View File

@ -0,0 +1,30 @@
<odoo>
<data>
<!--
<record id="object0" model="cst_extend_journal_code.cst_extend_journal_code">
<field name="name">Object 0</field>
<field name="value">0</field>
</record>
<record id="object1" model="cst_extend_journal_code.cst_extend_journal_code">
<field name="name">Object 1</field>
<field name="value">10</field>
</record>
<record id="object2" model="cst_extend_journal_code.cst_extend_journal_code">
<field name="name">Object 2</field>
<field name="value">20</field>
</record>
<record id="object3" model="cst_extend_journal_code.cst_extend_journal_code">
<field name="name">Object 3</field>
<field name="value">30</field>
</record>
<record id="object4" model="cst_extend_journal_code.cst_extend_journal_code">
<field name="name">Object 4</field>
<field name="value">40</field>
</record>
-->
</data>
</odoo>

4
models/__init__.py Executable file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import models
from . import account_journal

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

13
models/account_journal.py Executable file
View File

@ -0,0 +1,13 @@
from odoo import fields, models
class AccountJournal(models.Model):
_inherit = "account.journal"
code = fields.Char(
string="Short Code",
size=15, # ubah dari 5 → 15
compute="_compute_code", readonly=False, store=True,
required=True, precompute=True,
help="Shorter name used for display. "
"The journal entries of this journal will also be named using this prefix by default."
)

19
models/models.py Executable file
View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# from odoo import models, fields, api
# class cst_extend_journal_code(models.Model):
# _name = 'cst_extend_journal_code.cst_extend_journal_code'
# _description = 'cst_extend_journal_code.cst_extend_journal_code'
# name = fields.Char()
# value = fields.Integer()
# value2 = fields.Float(compute="_value_pc", store=True)
# description = fields.Text()
#
# @api.depends('value')
# def _value_pc(self):
# for record in self:
# record.value2 = float(record.value) / 100

2
security/ir.model.access.csv Executable file
View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_cst_extend_journal_code_cst_extend_journal_code,cst_extend_journal_code.cst_extend_journal_code,model_cst_extend_journal_code_cst_extend_journal_code,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_cst_extend_journal_code_cst_extend_journal_code cst_extend_journal_code.cst_extend_journal_code model_cst_extend_journal_code_cst_extend_journal_code base.group_user 1 1 1 1

24
views/templates.xml Executable file
View File

@ -0,0 +1,24 @@
<odoo>
<data>
<!--
<template id="listing">
<ul>
<li t-foreach="objects" t-as="object">
<a t-attf-href="#{ root }/objects/#{ object.id }">
<t t-esc="object.display_name"/>
</a>
</li>
</ul>
</template>
<template id="object">
<h1><t t-esc="object.display_name"/></h1>
<dl>
<t t-foreach="object._fields" t-as="field">
<dt><t t-esc="field"/></dt>
<dd><t t-esc="object[field]"/></dd>
</t>
</dl>
</template>
-->
</data>
</odoo>

60
views/views.xml Executable file
View File

@ -0,0 +1,60 @@
<odoo>
<data>
<!-- explicit list view definition -->
<!--
<record model="ir.ui.view" id="cst_extend_journal_code.list">
<field name="name">cst_extend_journal_code list</field>
<field name="model">cst_extend_journal_code.cst_extend_journal_code</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
<field name="value"/>
<field name="value2"/>
</list>
</field>
</record>
-->
<!-- actions opening views on models -->
<!--
<record model="ir.actions.act_window" id="cst_extend_journal_code.action_window">
<field name="name">cst_extend_journal_code window</field>
<field name="res_model">cst_extend_journal_code.cst_extend_journal_code</field>
<field name="view_mode">list,form</field>
</record>
-->
<!-- server action to the one above -->
<!--
<record model="ir.actions.server" id="cst_extend_journal_code.action_server">
<field name="name">cst_extend_journal_code server</field>
<field name="model_id" ref="model_cst_extend_journal_code_cst_extend_journal_code"/>
<field name="state">code</field>
<field name="code">
action = {
"type": "ir.actions.act_window",
"view_mode": "list,form",
"res_model": model._name,
}
</field>
</record>
-->
<!-- Top menu item -->
<!--
<menuitem name="cst_extend_journal_code" id="cst_extend_journal_code.menu_root"/>
-->
<!-- menu categories -->
<!--
<menuitem name="Menu 1" id="cst_extend_journal_code.menu_1" parent="cst_extend_journal_code.menu_root"/>
<menuitem name="Menu 2" id="cst_extend_journal_code.menu_2" parent="cst_extend_journal_code.menu_root"/>
-->
<!-- actions -->
<!--
<menuitem name="List" id="cst_extend_journal_code.menu_1_list" parent="cst_extend_journal_code.menu_1"
action="cst_extend_journal_code.action_window"/>
<menuitem name="Server to list" id="cst_extend_journal_code" parent="cst_extend_journal_code.menu_2"
action="cst_extend_journal_code.action_server"/>
-->
</data>
</odoo>