zoukankan      html  css  js  c++  java
  • odoo

    ################################
    需求:yct_analysis_v1请求不同的url,odoo返回对应的处理代码
    ################################    
    odoo
    https://hub.docker.com/_/odoo
    https://www.odoo.com/documentation/12.0/howtos/backend.html
    https://github.com/pyhunterpig/odoo_jsonrpc_client
            
            
    https://www.jianshu.com/p/db329c37adc6?isappinstalled=0
    https://hub.docker.com/_/odoo?tab=description
        配置docker镜像加速:
        curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
        systemctl restart docker
        docker安装odoo:
        docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:10
        docker run -v /home/xjj/odoo/config:/etc/odoo -v /home/xjj/odoo/addons:/mnt/extra-addons -p 8069:8069 --name odoo --link db:db -d odoo:latest
        docker run -v d:/git_jst/odoo/config:/etc/odoo -v d:/git_jst/odoo/addons:/mnt/extra-addons -p 8069:8069 --name odoo --link db:db -d odoo:latest
    
    https://www.odoo.com/documentation/12.0/howtos/backend.html
    http://www.odoov.com/index.php?title=首页
    https://github.com/odoo/docker
    https://github.com/odoo/odoo
    https://www.cnblogs.com/qianheng/p/6388105.html
    https://www.cnblogs.com/hellosen/p/11051414.html    
        /usr/bin/odoo scaffold openacademy /mnt/extra-addons
        create an empty module:
        odoo scaffold test /mnt/extra-addons/    
            PermissionError: [Errno 13] Permission denied: '/mnt/extra-addons/test'
            解决:chmod 777 /home/xjj/odoo/*
                
                
        
    ################################
    基础

    参考:https://www.odoo.com/documentation/12.0/howtos/backend.html

    https://www.odoo.com/documentation/12.0/howtos/backend.html#advanced-views
    
    Start/Stop the Odoo server
        # docker start/stop odoo
    Build an Odoo module
        Composition of a module
            # Business objects,Data files,Web controllers,Static web data
        Module structure
            # /usr/bin/odoo scaffold openacademy /mnt/extra-addons
            # /odoo/config/odoo.conf    
            # addons/openacademy/__manifest__.py
            # addons/openacademy/__init__.py
        Object-Relational Mapping
            # ORM
            # _name = 'test.model'    #which is required and defines the name for the model in the Odoo system
        Model fields    # name = fields.Char()    #Fields are used to define what the model can store and where.
            Common Attributes    
                # name = field.Char(required=True)    #fields can be configured
                # Some attributes are available on all fields, here are the most common ones    (string ,required ,help ,index )
            Simple fields
                # Example of simple fields are Boolean, Date, Char.
            Reserved fields
                # id (Id),create_date (Datetime),create_uid (Many2one),write_date (Datetime),write_uid (Many2one)
            Special fields
                # _name = 'test.model'    #which is required and defines the name for the model in the Odoo system
                # name    # various display and search behaviors    # overridden by setting _rec_name
        Data files
            # XML + CSV
            # record:model,id    field:name
            # docker restart odoo
            # how to insert data into the database? and visible?
        Actions and Menus
            # <menuitem>
    
    Basic views    # Each type of view # via their type,via their id #lowest-priority view    #View inheritance
        Generic view declaration
            # ir.ui.view    #arch xml
        Tree views
            # <tree>
        Form views
            # <form> ,groups, notebooks buttons ,fields
        Search views
            # <search>
            
    Relations between models
        Relational fields
            # Many2one,One2many,related_field,Many2many
    
    Inheritance
        Model inheritance
            # _inherit 
        View inheritance
            # inherit_id,arch ,xpath 
            Domains
                # select a subset of a model’s records
                # Domains on relational fields
                
    Computed fields and default values
        # computed on-the-fly by calling a method of the model
        # compute self
        # The object self is a recordset
        Dependencies
            # depends()
        Default values
            # default=X,self.env
    
    Onchange
        # onchange() 
        
    Model constraints
        # constrains()
        # _sql_constraints
        
    Advanced Views
        Tree views
            # decoration-{$name}
        Calendars
            # <calendar>:color,date_start,date_stop,string
        Search views
            # <field>    @filter_domain
            # <filter>    domain    context
        Gantt
            # <gantt>
        Graph views
            # <graph>    Pivot views     (Bar    Line    Pie)        (row    measure)
        Kanban
            # <kanban>        
            
    Security
        # Access control,a coherent security policy.
        Group-based access control mechanisms
            # res.groups
        Access rights
            # the Odoo interface    Settings
            # ir.model.access.csv
        Record rules
            # security.xml
        
    Wizards
        # TransientModel,    (transient,    have all permissions,    refer to)
        # wizard.py
        Launching wizards
            # ir.actions.act_window,target ,src_model 
        
    Internationalization
        # openacademy/i18n/
        # Administration ‣ Translations
        
    Reporting
        Printed reports
        Dashboards
        
    WebServices
        XML-RPC Library
        JSON-RPC Library
    文档
    ################################
    
    安装docker:
    配置docker镜像加速:
        curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
        systemctl restart docker
    docker安装odoo:
        docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres -p 5433:5432 --name db postgres:10
        docker run -v /home/xjj/odoo/config:/etc/odoo -v /home/xjj/odoo/addons:/mnt/extra-addons -p 8069:8069 --name odoo --link db:db -d odoo:latest
    配置文件及模块:
        /home/xjj/odoo/config/odoo.conf
        odoo scaffold test /mnt/extra-addons/    
            报错:PermissionError: [Errno 13] Permission denied: '/mnt/extra-addons/test'
            解决:
                方案1:chmod 777 /home/xjj/odoo/*
                方案2:参考:https://www.lmlphp.com/user/2916/article/item/25760/
                    odoo:x:101:989::/opt/odoo:/bin/bash
    在windows下开发:    
        zip -r test.zip test
        unzip test.zip 
    安装samba服务:
        共享目录:/home/xjj/odoo
        用户:smb
        密码:123456
        \192.168.1.240
    PyCharm 连接服务器进行远程开发和调试:
        https://zhuanlan.zhihu.com/p/38330654
        https://cloud.tencent.com/developer/news/231582
        
    创建新的数据库
    开发者模式
    刷新本地模块
    安装,升级
    
    docker输出日志截取:
        docker logs  -f --since="2019-09-04" odoo
        
    docker容器启动后追加端口映射:(不想删除容器重建的情况下,可以用这种方法)
        https://www.cnblogs.com/shijf/p/10386193.html
        https://www.fujieace.com/docker/portbindings.html
        /var/lib/docker/containers/967feb892faa11e71dd1cf7d252ae138e28610e03e4ae44efa3d40f11df0a1a8/hostconfig.json
            "PortBindings":{"5432/tcp":[{"HostIp":"","HostPort":"5432"}]}
        /var/lib/docker/containers/967feb892faa11e71dd1cf7d252ae138e28610e03e4ae44efa3d40f11df0a1a8/config.v2.json
            "Ports":{"5432/tcp":[{"HostIp":"0.0.0.0","HostPort":"5432"}]}
        "PortBindings":{"8069/tcp":[{"HostIp":"","HostPort":"8069"}]}
        "ExposedPorts":{"8069/tcp":{},"8071/tcp":{}}
        "Ports":{"8069/tcp":[{"HostIp":"0.0.0.0","HostPort":"8069"}],"8071/tcp":null}
            
    
    重启,刷新,升级
    model:
        设置|技术|数据库结构|模型|搜索
    view:
        data files
        Actions and Menus    
            现在我们有一个存储数据的模型,我们应该在用户界面上可以操作它
            注意权限
    webservice:
        请求url,返回code。
        api接口:url当作参数请求过去,odoo返回处理代码。
    Ok
    ################################
    项目步骤
  • 相关阅读:
    Active Directory如何用C#进行增加、删除、修改、查询用户与组织单位!
    showModalDialog和showModelessDialog的使用
    如何在GridView中使用DataFromatString
    GridView/DataGrid单元格不换行的问题
    要Gmail、Orkut邀请的请留下你的邮箱
    How to reset security settings back to the defaults
    ASP.NET 2.0 学习笔记 1: session 与 script 应用
    关闭主窗体而不退出主程序 以及如何获取操作系统的关闭、注销信息
    ASP.NET 2.0 学习笔记 2: 页面间传值
    Windows 系统常用设置方法与技巧
  • 原文地址:https://www.cnblogs.com/xujinjin18/p/11556095.html
Copyright © 2011-2022 走看看