瀏覽代碼

first commit

jack 9 月之前
當前提交
a810b2863d
共有 12 個文件被更改,包括 268 次插入0 次删除
  1. 67 0
      .gitignore
  2. 0 0
      README.md
  3. 4 0
      __init__.py
  4. 34 0
      __manifest__.py
  5. 3 0
      controllers/__init__.py
  6. 22 0
      controllers/controllers.py
  7. 30 0
      demo/demo.xml
  8. 3 0
      models/__init__.py
  9. 19 0
      models/models.py
  10. 2 0
      security/ir.model.access.csv
  11. 24 0
      views/templates.xml
  12. 60 0
      views/views.xml

+ 67 - 0
.gitignore

@@ -0,0 +1,67 @@
+.DS_Store
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+.idea/*
+xml_files/
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+other/split_clash_config/split_config
+ai_news/save_data
+
+manual/clash/clash_each_node
+manual/singbox/singbox_each_node

+ 0 - 0
README.md


+ 4 - 0
__init__.py

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

+ 34 - 0
__manifest__.py

@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+{
+    'name': "depin",
+
+    'summary': "Short (1 phrase/line) summary of the module's purpose",
+
+    'description': """
+Long description of module's purpose
+    """,
+
+    'author': "My Company",
+    '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': 'Uncategorized',
+    'version': '0.1',
+
+    # any module necessary for this one to work correctly
+    'depends': ['base'],
+
+    # always loaded
+    'data': [
+        # 'security/ir.model.access.csv',
+        'views/views.xml',
+        'views/templates.xml',
+    ],
+    # only loaded in demonstration mode
+    'demo': [
+        'demo/demo.xml',
+    ],
+}
+

+ 3 - 0
controllers/__init__.py

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

+ 22 - 0
controllers/controllers.py

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

+ 30 - 0
demo/demo.xml

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

+ 3 - 0
models/__init__.py

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

+ 19 - 0
models/models.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+# from odoo import models, fields, api
+
+
+# class depin(models.Model):
+#     _name = 'depin.depin'
+#     _description = 'depin.depin'
+
+#     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 - 0
security/ir.model.access.csv

@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_depin_depin,depin.depin,model_depin_depin,base.group_user,1,1,1,1

+ 24 - 0
views/templates.xml

@@ -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 - 0
views/views.xml

@@ -0,0 +1,60 @@
+<odoo>
+  <data>
+    <!-- explicit list view definition -->
+<!--
+    <record model="ir.ui.view" id="depin.list">
+      <field name="name">depin list</field>
+      <field name="model">depin.depin</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="depin.action_window">
+      <field name="name">depin window</field>
+      <field name="res_model">depin.depin</field>
+      <field name="view_mode">list,form</field>
+    </record>
+-->
+
+    <!-- server action to the one above -->
+<!--
+    <record model="ir.actions.server" id="depin.action_server">
+      <field name="name">depin server</field>
+      <field name="model_id" ref="model_depin_depin"/>
+      <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="depin" id="depin.menu_root"/>
+-->
+    <!-- menu categories -->
+<!--
+    <menuitem name="Menu 1" id="depin.menu_1" parent="depin.menu_root"/>
+    <menuitem name="Menu 2" id="depin.menu_2" parent="depin.menu_root"/>
+-->
+    <!-- actions -->
+<!--
+    <menuitem name="List" id="depin.menu_1_list" parent="depin.menu_1"
+              action="depin.action_window"/>
+    <menuitem name="Server to list" id="depin" parent="depin.menu_2"
+              action="depin.action_server"/>
+-->
+  </data>
+</odoo>