跳至內容
Odoo 選單
  • 登入
  • 免費試用
  • 應用程式
    財政
    • 會計
    • 發票
    • 開支報銷
    • 試算表 (BI)
    • 文件管理
    • 電子簽名
    銷售
    • 客戶關係
    • 銷售
    • POS 銷售點管理 - 零售
    • POS 銷售點管理 - 餐廳
    • 訂閱
    • 租賃
    網站
    • 網站製作
    • 電子商務
    • 網誌
    • 討論區
    • 線上客服
    • 網上學習
    供應鏈
    • 庫存
    • 製造管理
    • 產品生命周期
    • 採購
    • 保養維護
    • 品質管理
    人力資源
    • 員工管理
    • 招聘
    • 休假
    • 工作表現評核
    • 內部推薦
    • 車隊管理
    市場推廣
    • 社交媒體推廣
    • 電郵推廣
    • 短訊營銷
    • 活動
    • 自動化推廣
    • 網上調查
    服務
    • 專案管理
    • 工時管理
    • 外勤服務管理
    • 技術支援
    • 工作規劃
    • 預約管理
    生產力
    • 聊天
    • 批核
    • 物聯網
    • VoIP
    • 知識庫
    • WhatsApp
    第三方應用程式 Odoo Studio Odoo 雲端平台
  • 行業
    零售
    • 書店
    • 服裝店
    • 家具店
    • 食品雜貨店
    • 五金店
    • 玩具店
    餐飲及款待
    • 酒吧及酒館
    • 餐廳
    • 快餐
    • 賓館
    • 飲品分銷商
    • 酒店
    房地產
    • 地產代理公司
    • 建築師事務所
    • 建造業
    • 物業管理
    • 園藝
    • 業主聯會
    顧問服務
    • 會計公司
    • Odoo 合作夥伴
    • 市場推廣公司
    • 律師事務所
    • 人才招募
    • 審計及認證
    製造管理
    • 紡織
    • 金屬
    • 家具
    • 食品
    • 啤酒廠
    • 企業禮品
    保健與健身
    • 運動俱樂部
    • 眼鏡店
    • 健身中心
    • 健康從業人員
    • 藥房
    • 髮型屋
    技術行業
    • 雜工
    • IT 硬體與支援
    • 太陽能系統
    • 鞋匠
    • 清潔服務
    • 暖通空調服務
    其他
    • 非牟利組織
    • 環境保護機構
    • 廣告板租賃
    • 攝影服務
    • 自行車租賃
    • 軟體經銷商
    瀏覽所有行業
  • 社群
    學習
    • 教學影片
    • 使用說明
    • 認證
    • 培訓
    • 網誌
    • Podcast
    增強教學效能
    • 教育計劃
    • Scale Up! 商業遊戲
    • 到訪 Odoo
    取得軟件
    • 下載
    • 版本對照表
    • 版本說明
    合作
    • GitHub
    • 討論區
    • 活動
    • 翻譯
    • 成為合作夥伴
    • 合作夥伴服務
    • 登記你的會計服務公司
    獲取服務相關資料
    • 尋找合作夥伴
    • 尋找會計服務
    • 預約顧問諮詢
    • 安裝及推行服務
    • 客戶案例
    • 支援
    • 軟件升級
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    預約示範
  • 定價
  • 技術支援

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • 客戶關係
  • e-Commerce
  • 會計
  • 庫存
  • PoS
  • 專案管理
  • MRP
All apps
只限註冊用戶才可與社群互動。
所有帖文 人 獎章
標籤 (查看所有)
odoo accounting v14 pos v15
關於此討論區
只限註冊用戶才可與社群互動。
所有帖文 人 獎章
標籤 (查看所有)
odoo accounting v14 pos v15
關於此討論區
支援

Module creation issues for v17

訂閱

此帖文有活動時,接收通知

此問題已被標幟
developmentdevelopementerrorhelp
3 回覆
3396 瀏覽次數
頭像
Justin hul

Hi everyone and thank you in advance for any assistance. Long time odoo user trying out some module creations. I am trying to create a module to hold data from excel. mass data. unfortunately running into issues and I am worried that it is my build - missing dependencies?
Here is my code can someone tell me where I am going wrong?




manifest.py


# -*- coding: utf-8 -*-

{

    'name': 'Alpha Jobs',

    'version': '1.0',

    'summary': 'Manage Alpha Jobs',

    'sequence': 10,

    'category': 'Uncategorized',

    'depends': ['base','contacts'],

    'data': [

        'security/ir.model.access.csv',

        'views/alpha_jobs_menus.xml',

        'views/alpha_jobs_views.xml',

        'views/alpha_jobs_actions.xml',

    ],

    'demo': [],

    'installable': True,

    'auto_install': False,

    'application': True,

}



---------------


alphajobs.py


from odoo import models, fields, api


class AlphaJobs(models.Model):

    _name = 'alpha.jobs'

    _description = 'Alpha Jobs'

    _rec_name = 'job_id'


    job_id = fields.Char(string='Job ID', compute='_compute_job_id', store=True, readonly=True, index=True)

    job_no = fields.Char('Job Number', required=True)

    sub_job_no = fields.Char('Sub Job Number')

    customer = fields.Many2one('res.partner', string='Customer')

    QUOTE_NO = fields.Char('Quote Number')

    QUOTE_SUB_NO = fields.Char('Quote Sub Number')

    ALCONTACT = fields.Char('Contact')

    ALDATE_OPENED = fields.Integer('Date Opened')

    ALDATE_DUE = fields.Integer('Alpha Date Due')

    DATE_SHIPPED = fields.Integer('Date Shipped')

    JOB_STATUS = fields.Char('Job Status')

    CUSTOMER_PO_NO = fields.Char('Customer PO Number')

    ALCLASS = fields.Char('Class')

    ORIENTATION = fields.Char('Orientation')

    CUSTOMER_PO = fields.Char('Customer PO')

    DWG_NO = fields.Char('Drawing Number')

    ALPART_NAME = fields.Char('Alpha Part Name')

    ALPART_CODE = fields.Char('ALpha Part Code')

    ALQTY = fields.Char('Quantity')

    PART_STATUS = fields.Char('Part Status')

    REQUIREMENT = fields.Char('Requirement')

    ALPRICE = fields.Char('Price(al)')

    ALTOTAL = fields.Char('Total(al)')

    ALTOTAL_GST = fields.Char('Including GST')

    SHIPPING_CHECK = fields.Char('Shipping Check')

    PC_SN = fields.Char('PC SN')

    ALSHIP_DATE = fields.Char('Ship Date')

    ALSHIP_QTY = fields.Char('Shipped Quantity')

    MFG_QTY = fields.Char('Manufactured Quantity')

    BO_QTY = fields.Char('Billed Quantity')

    ALSTOCK_QTY = fields.Char('Stock Quantity')

    JOBJOBID = fields.Char('Job job ID')

    MFG_CHECK = fields.Char('Manufacturing Check')

    ALDUE_DATE = fields.Char('Due Date')

    SHP_INV = fields.Char('Shop Invoice')

    INVOICE_QTY = fields.Char('Invoiced Quantity')

    C_OR_V = fields.Char('C or V')

    INV_NUM = fields.Char('Invoice Number')

    INV_DATE = fields.Char('Date Invoiced')

    INV_DUE_DATE = fields.Char('Inv Due Date')

    CUSTOMER_PO_NUM = fields.Char('Customer PO Number main')

    INV_CUSTOMER = fields.Char('Invoice Customer')

    INVOICELINEDESC = fields.Char('Invoice line Description')

    INVOICELINEQUANTITY = fields.Char('Invoice line Quantity')

    INVOICELINEAMOUNT = fields.Char('Invoice line Amount')

    CUSTOMFIELDBLACKLAWJOBNO = fields.Char('BL Job Number')

    INVGST = fields.Char('Invoice GST')

    II_INDEX = fields.Char('II Index')

    INV_ITEM = fields.Char('Invoice Item')

    PS_NO = fields.Char('PS Number')

    PI_INDEX = fields.Char('PI Index')

    PACKINGSLIP_NO = fields.Char('Packing Slip Number')

    ALITEM = fields.Char('Item')

    AL_QTY = fields.Char('AL Quantity')

    AL_DESCRIPTION = fields.Char('Description')

    WT = fields.Char('Weight')

    PURPOSE_AL = fields.Char('Purpose')

    PRICE_Al = fields.Char('Price al')

    PER_UNITS_AL = fields.Char('Per Units')

    T_WT = fields.Char('Total Weight')

    PART_NO_AL = fields.Char('Part Number')

    EXT_PRICE = fields.Char('Extended Price')

    PO_AL = fields.Char('PO Number')

    PART_NAME = fields.Char('Part Name')

    PI_INDEX = fields.Char('PI Index')

    AL_SN = fields.Char('Serial Number')

    SHIP_TO = fields.Char('Ship to')

    CO = fields.Char('CO')

    CUSTOMER_PO = fields.Char('Customer PO')

    SHIPPED_BY = fields.Char('Shipped by')

    CARRIER_AL = fields.Char('Carrier')

    PAYMENT_TYPE = fields.Char('Payment Type')

    DATE_SHIP_AL = fields.Char('Date Shipped AL')

    DWG_NO = fields.Char('Drawing Number')

    PART_CODE = fields.Char('Part Code')

    PART_NAME1 = fields.Char('Part Name1')

    REQUIREMENT = fields.Char('Requirement')

    QTY_AL = fields.Char('Quantity_AL')

    PRICEA = fields.Char('Price')

    AMOUNT_AL = fields.Char('Amount')

    MARKUP = fields.Char('Markup')

    TOTAL_CHARGE = fields.Char('Total Charge')

    PRICE_CHARGE = fields.Char('Price Charge')

    CHECK = fields.Char('Check')

    FINISH_DATE = fields.Char('Finish Date')

    PC_SN = fields.Char('PC_SN')

    JQJ_INDEX = fields.Char('JQJ_INDEX')

    DATE_OPENED = fields.Char('Job Date Opened')

    QUOTE_STS = fields.Char('Quote STS')

    ATTENTION = fields.Char('Attention')

    ATTEN_ID = fields.Char('Attention ID')

    SHIP_VIA = fields.Char('Ship Via')

    FOB = fields.Char('FOB')

    TERMS = fields.Char('Terms')

    DAYS = fields.Char('Days')

    CONTACT_AL = fields.Char('Alpha Contact')

    CONTACT_ID = fields.Char('Contact ID')

    REL_QUOTE_NO = fields.Char('Related Quote NO')

    # Link sub-jobs to their parent jobs

    parent_job_id = fields.Many2one('alpha.jobs', string='Parent Job')


    # One2many fields for purchases and employee entries

    purchase_ids = fields.One2many('alpha.purchase', 'job_id', string='Purchases')

    employee_time_ids = fields.One2many('alpha.employee.time', 'job_id', string='Employee Times')


    @api.depends('job_no', 'sub_job_no')

    def _compute_job_id(self):

        for record in self:

            job_id = record.job_no

            if record.sub_job_no:

                job_id += '-' + record.sub_job_no

            record.job_id = job_id


    @api.constrains('job_id')

    def _check_unique_job_id(self):

        for record in self:

            existing_record = self.search([('job_id', '=', record.job_id)])

            if len(existing_record) > 1 or (len(existing_record) == 1 and existing_record != record):

                raise ValidationError("Job ID '%s' already exists. Please choose a unique Job ID." % record.job_id)



class AlphaEmployeeTime(models.Model):

    _name = 'alpha.employee.time'

    _description = 'Alpha Employee Time'


    # Define fields to store employee entries

    job_id = fields.Many2one('alpha.jobs', string='Job')

    Name = fields.Char(string='Employee Name')

    EMDATE = fields.Date('Date of Work')

    EMPLOYEE_DESCRIPTION = fields.Text('Work Description')

    REGULAR_HOURS = fields.Float('Regular Hours')

    EMPLOYEE_ID = fields.Char('Employee ID')

    EMPLOYEE_STATION = fields.Char('Station')

    EMNAME = fields.Char('Name')

    EMPLYEE_OVERTIME = fields.Float('Overtime')

    EMPLOYEE_REG_HRS = fields.Float('Employee Regular Hours')

    TOTAL_STATION_HRS = fields.Float('Total Station Hours')



class AlphaPurchase(models.Model):

    _name = 'alpha.purchase'

    _description = 'Alpha Purchase'


    # Define fields to store purchase information

    job_id = fields.Many2one('alpha.jobs', string='Job')

    POITEM_INDEX = fields.Char(string='PO Item Index')

    POITEM = fields.Char(string='PO Item')

    PORF_NO = fields.Char(string='PO Reference Number')

    VENDOR = fields.Char(string='Vendor')

    PODATE = fields.Date(string='PO Date')

    SHIPPING_TO = fields.Char(string='Shipping to')

    PO_AL = fields.Char(string='PO Number')

    PART_NO_AL = fields.Char(string='Part Number')

    PART_NAME = fields.Char(string='Part Name')

    QTY_AL = fields.Char(string='Quantity')

    PRICEA = fields.Char(string='Price')

    AMOUNT_AL = fields.Char(string='Amount')

    AL_SN = fields.Char(string='Serial Number')

    SHIP_TO = fields.Char(string='Ship to')

    CO = fields.Char(string='CO')

    CUSTOMER_PO = fields.Char(string='Customer PO')

    SHIPPED_BY = fields.Char(string='Shipped by')

    CARRIER_AL = fields.Char(string='Carrier')

    PAYMENT_TYPE = fields.Char(string='Payment Type')

    DATE_SHIP_AL = fields.Char(string='Date Shipped AL')

    DWG_NO = fields.Char(string='Drawing Number')

    PART_CODE = fields.Char(string='Part Code')

    PART_NAME1 = fields.Char(string='Part Name1')

    REQUIREMENT = fields.Char(string='Requirement')

    PRICE_CHARGE = fields.Char(string='Price Charge')

    CHECK = fields.Char(string='Check')

    FINISH_DATE = fields.Char(string='Finish Date')

    PC_SN = fields.Char(string='PC_SN')

    JQJ_INDEX = fields.Char(string='JQJ_INDEX')




---------------


ir.model.access.csv


id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

access_alpha_jobs,model_alpha_jobs,model_alpha_jobs,base.group_user,1,1,1,1


---------------


alpha_jobs_menus.xml

   

 

   

       

           

           

       

   


---------------


alpha_jobs_views.xml


   


       

       

            Alpha Jobs Tree

            alpha.jobs

            tree,form

            []

       


       

       

            Alpha Jobs Kanban

            alpha.jobs

            kanban,form

            []

       


   




   


---------------


alpha_jobs_actions.xml

   

       

       

            Alpha Jobs

            alpha.jobs

            tree,form,kanban

            []

            {}

           

               

                    Click to create a new record.

               

           

       


       

       

            Alpha Jobs Kanban

            alpha.jobs

            kanban,tree,form

            []

            {}

           

               

                    Click to create a new record.

               

           

       

   


   



0
頭像
捨棄
Justin hul
作者


alpha_jobs_menus.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menu id="menu_alpha_jobs_root" name="Alpha Jobs" sequence="10">
<menuitem id="menu_alpha_jobs_tree" name="Alpha Jobs Tree" parent="menu_alpha_jobs_root" action="action_alpha_jobs_tree" sequence="10" />
<menuitem id="menu_alpha_jobs_kanban" name="Alpha Jobs Kanban" parent="menu_alpha_jobs_root" action="action_alpha_jobs_kanban" sequence="20" />
</menu>
</odoo>

---------------

alpha_jobs_views.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>

<!-- Action for Tree View -->
<record id="action_alpha_jobs_tree" model="ir.actions.act_window">
<field name="name">Alpha Jobs Tree</field>
<field name="res_model">alpha.jobs</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
</record>

<!-- Action for Kanban View -->
<record id="action_alpha_jobs_kanban" model="ir.actions.act_window">
<field name="name">Alpha Jobs Kanban</field>
<field name="res_model">alpha.jobs</field>
<field name="view_mode">kanban,form</field>
<field name="domain">[]</field>
</record>

</data>
</odoo>

---------------

alpha_jobs_actions.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Action for Tree View -->
<record id="action_alpha_jobs_tree" model="ir.actions.act_window">
<field name="name">Alpha Jobs</field>
<field name="res_model">alpha.jobs</field>
<field name="view_mode">tree,form,kanban</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new record.
</p>
</field>
</record>

<!-- Action for Kanban View -->
<record id="action_alpha_jobs_kanban" model="ir.actions.act_window">
<field name="name">Alpha Jobs Kanban</field>
<field name="res_model">alpha.jobs</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new record.
</p>
</field>
</record>
</data>
</odoo>

won't let me edit my original post

頭像
Lawrence
最佳答案

Hello.


I've never seen and tried your code before in terms of creating menus in Odoo.

I think you should try to remove the menu tag and don't forget to the end tag.


   

 



try this instead.


<?xml version="1.0" encoding="utf-8"?>

<odoo>

<menuitem id="menu_alpha_jobs_root" name="Alpha Jobs" sequence="10"/>

/cp<menuitem id="menu_alpha_jobs_tree" name="Alpha Jobs Tree" parent="menu_alpha_jobs_root" action="action_alpha_jobs_tree" sequence="10" />

<menuitem id="menu_alpha_jobs_kanban" name="Alpha Jobs Kanban" parent="menu_alpha_jobs_root" action="action_alpha_jobs_kanban" sequence="20" />

</odoo>



menu_alpha_jobs_root is your main menu or root menu, the parent of your menu (Alpha Jobs Tree and Alpha Jobs Kanban)

instead of menu tag make it menuitem

like menuitem id="menu_alpha_jobs_root" 




0
頭像
捨棄
Justin hul
作者

Thank you I will try this. will mark as solved if it works.

Justin hul
作者

ParseError('while parsing %s:%s, somewhere inside\n%s' % (
views/alpha_jobs_menus.xml:5, somewhere inside
<menuitem id="menu_alpha_jobs_tree" name="Alpha Jobs Tree" parent="menu_alpha_jobs_root" action="action_alpha_jobs_tree" sequence="10"/>

in reviewing my code it is all wrong...
going to have to rebuild my views I think.
Can anyone link me to a proper view example for tree form and kanban v17. thanks in advance

Lawrence

ParseError('while parsing %s:%s, somewhere inside\n%s' % (
views/alpha_jobs_menus.xml:5, somewhere inside
<menuitem id="menu_alpha_jobs_tree" name="Alpha Jobs Tree" parent="menu_alpha_jobs_root" action="action_alpha_jobs_tree" sequence="10"/>

I think the error shows because in my given xml code it has extra letters "/cp" before the <menuitem id="menu_alpha_jobs_tree" ~ remove it, don't copy and paste all my code.

Lawrence

<?xml version="1.0" encoding="utf-8"?>

<odoo>

<menuitem id="menu_alpha_jobs_root" name="Alpha Jobs" sequence="10"/>

<menuitem id="menu_alpha_jobs_tree" name="Alpha Jobs Tree" parent="menu_alpha_jobs_root" action="action_alpha_jobs_tree" sequence="10" />

<menuitem id="menu_alpha_jobs_kanban" name="Alpha Jobs Kanban" parent="menu_alpha_jobs_root" action="action_alpha_jobs_kanban" sequence="20" />

</odoo>

try this.

Justin hul
作者

I actually removed that when trying your code. still parse error.

頭像
Justin hul
作者 最佳答案

thank you for the reply.

The module installs - up to views and menus

Log error

views/alpha_jobs_menus.xml' does not fit the required schema!

AssertionError: Element odoo has extra content: menu, line 3 


Problem is no matter what I do to change this, removed

changed to , even changed the menu and view structure and load sequence in manifest. will not install the menus/views
0
頭像
捨棄
Niyas Raphy (Walnut Software Solutions)

the error saying that the file alpha_jobs_menus is not written in proper xml syntax

Justin hul
作者

alpha_jobs_menus.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menu id="menu_alpha_jobs_root" name="Alpha Jobs" sequence="10">
<menuitem id="menu_alpha_jobs_tree" name="Alpha Jobs Tree" parent="menu_alpha_jobs_root" action="action_alpha_jobs_tree" sequence="10" />
<menuitem id="menu_alpha_jobs_kanban" name="Alpha Jobs Kanban" parent="menu_alpha_jobs_root" action="action_alpha_jobs_kanban" sequence="20" />
</menu>
</odoo>

indentation is proper in the .xml. I have used this menu structure previous. never with v17
should it be different?

Niyas Raphy (Walnut Software Solutions)

<menu id= its wrong,

the Keyword is menuitem as mentioned by Lawrence

See: https://www.youtube.com/watch?v=kxbPgOLkNxw&list=PLqRRLx0cl0hq0T4SV-BHhCicWOpzyWcHd

頭像
Niyas Raphy (Walnut Software Solutions)
最佳答案

Hi,
Along with the post try adding the information regarding the issue ? Is it getting installed ? Any exceptions are raised ? such information is missing.

So answering generically, you can refer to this tutorial:  Odoo 17 Development Tutorials

Thanks

0
頭像
捨棄
喜歡這則討論?不要只閱讀,加入發表意見吧!

今天就建立帳戶,享受獨家功能,與我們精彩的社群互動!

註冊
相關帖文 回覆 瀏覽次數 活動
Issue on Account move lline
error help account.move.line
頭像
頭像
頭像
3
12月 23
6754
When i click on Print Button RML get error
development error rml
頭像
頭像
1
3月 15
6517
How do I deal with the "Invalid XML for View Architecture!" error?
development error view
頭像
頭像
頭像
2
3月 15
7821
How To Hide User Group From Users Form View In Odoo
development error users group
頭像
頭像
頭像
頭像
4
9月 25
2693
odoo 15 development error
development error v15 psycopg2.errors
頭像
頭像
1
7月 24
4769
社群
  • 教學影片
  • 使用說明
  • 討論區
開源
  • 下載
  • GitHub
  • Runbot 測試環境
  • 翻譯
服務
  • odoo.sh 網頁寄存
  • 支援
  • 升級
  • 自訂功能開發
  • 教育及培訓
  • 尋找會計服務
  • 尋找合作夥伴
  • 成為合作夥伴
關於我們
  • 關於 Odoo 公司
  • 品牌資產
  • 聯絡我們
  • 招聘
  • 活動
  • Podcast
  • 網誌
  • 客戶
  • 法律 • 私隱政策
  • 安全性
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo 是一套開放源碼的商業管理系統,涵蓋你公司全部的營運需要,包括客戶關係管理(CRM)、電子商務、會計、庫存管理、POS(銷售點管理)、專案管理等應用程式。

Odoo 的獨特價值是非常簡單易用,同時將不同應用程式完美整合。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now