Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Odoo Client Error

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
v14
3861 Tampilan
Avatar
DIPOK RAY

Hello all !!

i have created a custom  module when I am trying to  save or edit any record this problem is occurred .

Please someone tell me how can i solve this problem ?


An error occurred

Please use the copy button to report the error to your support service.

See details
Traceback:
TypeError: Cannot read properties of undefined (reading 'classList')
    at Class.setLocalState (http://yuko3-pc:8069/web/content/1163-41039ea/web.assets_backend.js:2248:50)
    at http://yuko3-pc:8069/web/content/1163-41039ea/web.assets_backend.js:1346:190
    at async Promise.all (index 0)
    at async Class.update (http://yuko3-pc:8069/web/content/1163-41039ea/web.assets_backend.js:1346:269)
    at async Class.update (http://yuko3-pc:8069/web/content/1163-41039ea/web.assets_backend.js:2302:58)

0
Avatar
Buang
Sudhir Arya (ERP Harbor Consulting Services)

Error is not helping to find the root cause. Please share the code of your custom module.

DIPOK RAY
Penulis

hey ! here is my code please tell me how can i solve the problem

model file :

from datetime import datetime
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError

class EbmManagement(models.Model):
_name = "ebm.management"
_inherit = ['mail.thread', 'mail.activity.mixin']
_description = "EBM Management"

@api.depends('pre_costing_line_ids', 'pre_costing_line_ids.amount')
def compute_total_pre_costing_amount(self):
for rec in self:
total = 0
for line in rec.pre_costing_line_ids:
total += line.amount
rec['total_pre_costing_amount'] = total

@api.depends('entertainment_expense_line_ids', 'entertainment_expense_line_ids.entertainment_bill_amount')
def compute_entertainment_total(self):
for rec in self:
total = 0
for line in rec.entertainment_expense_line_ids:
total += line.entertainment_bill_amount
rec['entertainment_total'] = total

@api.depends('conveyance_expense_line_ids', 'conveyance_expense_line_ids.conveyance_bill_amount')
def compute_conveyance_total(self):
for rec in self:
total = 0
for line in rec.conveyance_expense_line_ids:
total += line.conveyance_bill_amount
rec['conveyance_total'] = total

@api.depends('miscellaneous_expense_line_ids', 'miscellaneous_expense_line_ids.miscellaneous_bill_amount')
def compute_miscellaneous_total(self):
for rec in self:
total = 0
for line in rec.miscellaneous_expense_line_ids:
total += line.miscellaneous_bill_amount
rec['miscellaneous_total'] = total

@api.depends('entertainment_total', 'conveyance_total', 'miscellaneous_total')
def compute_total_bill_amount(self):
for rec in self:
rec.total_billing_amount = rec.entertainment_total + rec.conveyance_total + rec.miscellaneous_total

ebm_no = fields.Char(string='EBM No :', required=True, copy=False, readonly=True, default=lambda
self: _('New')) # sequence_id
name = fields.Many2one('hr.employee', string='Created By :', default=lambda self: self.env.user.employee_id,
readonly=True)
dept = fields.Many2one('hr.department', string='Department :', default=lambda self: self.env.user.department_id,
readonly=True)
expense_dept_for = fields.Selection([
('own', 'Own'),
('other', 'Other'),
], string='Expense For :', required=True, default='own', tracking=True)
employee_id = fields.Many2one('hr.employee', string='Employee :', tracking=True)
expense_dept = fields.Char(string='Exp Department :')
ebm_date = fields.Datetime(string='EBM Create Date :', default=datetime.today(), readonly=True)
required_date = fields.Date(string='Required Date :', required=True, tracking=True)

reference = fields.Char(string='Reference :', required=True, tracking=True)
purpose = fields.Text(string='Purpose :', required=True, tracking=True)
state = fields.Selection([('draft', 'Draft'), ('department manager', 'Department Manager'), ('audit', 'Audit'),
('account', 'Account'), ('management', 'Management')], default='draft', string="Status",
tracking=True)

# Notebook Line Added field for pre-costing
pre_costing_line_ids = fields.One2many('pre_costing.lines', 'pre_costing_id', string='Pre-costing Line')
# Notebook Line Added field for entertainment
entertainment_expense_line_ids = fields.One2many('entertainment.expense.lines', 'EEL_id',
string='Entertainment Line')
# Notebook Line Added field for conveyance
conveyance_expense_line_ids = fields.One2many('conveyance.expense.lines', 'CEL_id', string='Conveyance Line')
# Notebook Line Added field for miscellaneous
miscellaneous_expense_line_ids = fields.One2many('miscellaneous.expense.lines', 'MEL_id', string='Miscellaneous '
'Line')
#################### Computed Field ##################
total_pre_costing_amount = fields.Float(compute='compute_total_pre_costing_amount', store=True,
string='Total Pre-Costing '
'Amount ')

entertainment_total = fields.Float(string='Entertainment Total',
compute='compute_entertainment_total', store=True)
conveyance_total = fields.Float(string='Conveyance Total',
compute='compute_conveyance_total', store=True)
miscellaneous_total = fields.Float(string='Miscellaneous Total', store=True,
compute='compute_miscellaneous_total')
total_billing_amount = fields.Float(string='Total Bill Amount', store=True,
compute='compute_total_bill_amount')

def action_department(self):
for rec in self:
rec.state = 'department manager'

def action_audit(self):
for rec in self:
rec.state = 'audit'

def action_account(self):
for rec in self:
rec.state = 'account'

def action_draft(self):
for rec in self:
rec.state = 'draft'

def action_management(self):
for rec in self:
rec.state = 'management'

# sequence value
@api.model
def create(self, vals):
if vals.get('ebm_no', _('New')) == _('New'):
vals['ebm_no'] = self.env['ir.sequence'].next_by_code('ebm.management') or _(
'New') # sequence value
res = super(EbmManagement, self).create(vals)
return res

# field validation
@api.constrains('requested_amount')
def check_requested_amount(self):
for rec in self:
if rec.requested_amount == 0:
raise ValidationError(
_("Please Enter Correct Amount. Amount can not be Zero !!\n ---- দয়া করে সঠিক পরিমাণ লিখুন "
"----!"))

# Date field validation
@api.constrains('required_date')
def _check_required_date(self):
for rec in self:
if rec.required_date < fields.Date.today():
raise ValidationError("The Required date cannot be set in the past !!\n --- প্রয়োজনীয় তারিখ অতীতে "
"সেট "
"করা যাবে না ---|")

# Get automatic department after selecting employee
@api.onchange('employee_id')
def onchange_employee_id(self):
if self.employee_id:
if self.employee_id.department_id.name:
self.expense_dept = self.employee_id.department_id.name
else:
self.expense_dept = ''

# Notebook model for pre-costing
class PreCostingLines(models.Model):
_name = "pre_costing.lines"
_description = "Pre-Costing Lines"

pre_costing_id = fields.Many2one('ebm.management', string='pre_costing')
name = fields.Char(string='Description', required=True)
display_type = fields.Selection([
('line_section', "Section"),
('line_note', "Note")], default=False, help="Technical field for UX purpose.")
amount = fields.Integer(string='Amount')

# Notebook model for Entertainment
class EntertainmentExpenseLines(models.Model):
_name = "entertainment.expense.lines"
_description = "Entertainment Expense Lines"

# Computed function
@api.depends('req_qty', 'unit_cost')
def _get_entertainment_bill_amount(self):
for rec in self:
rec.entertainment_bill_amount = rec.req_qty * rec.unit_cost

EEL_id = fields.Many2one('ebm.management', string='EEL')
product_id = fields.Many2one('ebm.product', string='Product', domain=[('is_entertainment', '=', True)],
change_default=True, required=True) # Category based product
req_qty = fields.Integer(string="Quantity ", required=True)
unit_cost = fields.Float(string="Unit Price")
entertainment_bill_amount = fields.Float(string='Bill Amount', compute='_get_entertainment_bill_amount', store=True)

# Get unit cost of any product after selecting the product
@api.onchange('product_id')
def onchange_product_id(self):
if self.product_id:
if self.product_id.unit_cost:
self.unit_cost = self.product_id.unit_cost
else:
self.unit_cost = ''

# Notebook model for Conveyance
class ConveyanceExpenseLines(models.Model):
_name = "conveyance.expense.lines"
_description = "Conveyance Expense Lines"

CEL_id = fields.Many2one('ebm.management', string='CEL')
product_id = fields.Many2one('ebm.product', string='Product', domain=[('is_conveyance', '=', True)],
change_default=True, required=True)
con_from = fields.Char(string="From", required=True)
con_to = fields.Char(string="Destination", required=True)
conveyance_bill_amount = fields.Float(string='Bill Amount')

# Notebook model for Miscellaneous
class MiscellaneousExpenseLines(models.Model):
_name = "miscellaneous.expense.lines"
_description = "Miscellaneous Expense Lines"

MEL_id = fields.Many2one('ebm.management', string='CEL')
product_id = fields.Many2one('ebm.product', string='Product', domain=[('is_miscellaneous', '=',
True)],
change_default=True, required=True)
name = fields.Char(string='Name')
designation = fields.Char(string='Designation', required=True)
dept = fields.Char(string='Department')
dist = fields.Char(string='Home District')
phone = fields.Char(string='Phone No')
payment_date = fields.Date(string='Payment Date', required=True)
work_place = fields.Char(string='Place of Work')
miscellaneous_bill_amount = fields.Float(string='Bill Amount')
purpose = fields.Text(string='Purpose')
remark = fields.Char(string='Remarks')

@api.constrains('payment_date')
def _check_payment_date(self):
for rec in self:
if rec.payment_date < fields.Date.today():
raise ValidationError("The Payment date cannot be set in the past !!\n --- প্রয়োজনীয় তারিখ অতীতে "
"সেট "
"করা যাবে না ---|")

view file :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Action view -->

<record id="action_ebm_management" model="ir.actions.act_window">
<field name="name">EBM</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ebm.management</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create Your New EBM Record !!!
</p>
</field>
</record>

<!-- from view -->

<record id="view_ebm_form" model="ir.ui.view">
<field name="name">ebm.management.form</field>
<field name="model">ebm.management</field>
<field name="arch" type="xml">
<form>
<header>
<button id="button_department" name="action_department" string="Department Manager Approve"
class="btn-primary"
states="draft" type="object"/>
<button id="button_audit" name="action_audit" string="Audit Approve" class="btn-primary"
states="department manager" type="object"/>
<button id="button_account" name="action_account" string="Account Approve" class="btn-primary"
states="audit" type="object"/>
<button id="button_draft" name="action_draft" string="Set To Draft" class="btn-primary"
states="management" type="object"/>
<button id="button_management" name="action_management" string="Management Approve"
class="btn-primary"
states="account" type="object"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,department manager,audit,account,management"/>
</header>
<sheet>
<!-- For Sequence Id-->
<div class="oe_title">
<h3>
<field name="ebm_no" readonly="1"/>
</h3>
</div>
<!-- End -->
<group>
<group>
<field name="name" readonly="1"/>
<field name="dept" readonly="1"/>
<field name="expense_dept_for"/>
<field name="employee_id" attrs="{'invisible':[('expense_dept_for','=','own')]}"/>
<field name="expense_dept" attrs="{'invisible':[('expense_dept_for','=','own')]}"/>
</group>
<group>
<field name="ebm_date"/>
<field name="required_date"/>
<field name="reference"/>
<field name="purpose"/>
</group>
</group>

<!-- Bottom part in Notebook -->
<h3>Pre-costing</h3>
<notebook>
<page string="Pre-costing" name="pre_costing_line">
<field name="pre_costing_line_ids" widget="section_and_note_one2many">
<tree editable="bottom">
<control>
<create name="add_line_control" string="Add a Product"/>
<create name="add_section_control" string="Add a section"
context="{'default_display_type': 'line_section'}"/>
</control>
<field name="name" widget="section_and_note_text"/>
<field name="display_type" invisible="1"/>
<field name="amount"/>
</tree>
<form>
<group>
<group>
<field name="name"/>
</group>
<group>
<field name="amount"/>
</group>
</group>
</form>
</field>
<group class="oe_subtotal_footer">
<field name="total_pre_costing_amount" class="oe_subtotal_footer_separator"/>
</group>
</page>
</notebook>
<h3>Billing</h3>
<notebook>
<page string="Entertainment" name="entertainment_expense">
<field name="entertainment_expense_line_ids">
<tree editable="bottom">
<field name="product_id"/>
<field name="req_qty" optional="show"/>
<field name="unit_cost" optional="show"/>
<field name="entertainment_bill_amount" optional="show"/>
</tree>
<form>
<group>
<group>
<group>
<field name="product_id"/>
</group>
<group>
<field name="req_qty"/>
</group>
<group>
<field name="unit_cost"/>
</group>
<group>
<field name="entertainment_bill_amount"/>
</group>
</group>
</group>
</form>
</field>
</page>

<page string="Conveyance" name="conveyance_expense">
<field name="conveyance_expense_line_ids">
<tree editable="bottom">
<field name="product_id"/>
<field name="con_from" optional="show"/>
<field name="con_to" optional="show"/>
<field name="conveyance_bill_amount" optional="show"/>
</tree>
<form>
<group>
<group>
<field name="product_id"/>
</group>
<group>
<field name="con_from"/>
</group>
<group>
<field name="con_to"/>
</group>
<group>
<field name="conveyance_bill_amount"/>
</group>
</group>
</form>
</field>
</page>
<page string="Miscellaneous" name="miscellaneous_expenses">
<field name="miscellaneous_expense_line_ids">
<tree editable="bottom">
<field name="product_id"/>
<field name="name" optional="show"/>
<field name="dept" optional="show"/>
<field name="designation" optional="show"/>
<field name="dist" optional="show"/>
<field name="phone" optional="show"/>
<field name="payment_date" optional="show"/>
<field name="work_place" optional="show"/>
<field name="miscellaneous_bill_amount" optional="show"/>
<field name="purpose" optional="show"/>
<field name="remark" optional="show"/>
</tree>
<form>
<group>
<group>
<field name="product_id"/>
</group>
<group>
<field name="name"/>
</group>
<group>
<field name="dept"/>
</group>
<group>
<field name="designation"/>
</group>
<group>
<field name="dist"/>
</group>
<group>
<field name="phone"/>
</group>
<group>
<field name="payment_date"/>
</group>
<group>
<field name="work_place"/>
</group>
<group>
<field name="miscellaneous_bill_amount"/>
</group>
<group>
<field name="purpose"/>
</group>
<group>
<field name="remark"/>
</group>
</group>
</form>
</field>
</page>

</notebook>
<!--Notebook End-->
<group class="oe_subtotal_footer">
<field name="entertainment_total"/>
<field name="conveyance_total"/>
<field name="miscellaneous_total"/>
<field name="total_billing_amount" class="oe_subtotal_footer_separator"/>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>

<!-- Tree view-->

<record id="view_ebm_tree" model="ir.ui.view">
<field name="name">ebm.management.tree</field>
<field name="model">ebm.management</field>
<field name="arch" type="xml">
<tree sample="1" multi_edit="1">
<field name="ebm_no"/>
<field name="name" optional="show"/>
<field name="dept" optional="show"/>
<field name="employee_id" optional="show"/>
<field name="expense_dept" optional="show"/>
<field name="ebm_date" optional="show"/>
<field name="required_date" optional="show"/>
<field name="expense_dept_for" optional="show"/>
<field name="reference" optional="show"/>
<field name="purpose" optional="show"/>
</tree>
</field>
</record>
</odoo>

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Attached PDF file is not formatted properly
v14
Avatar
Avatar
1
Des 25
377
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
Sep 25
3804
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
Agu 25
1212
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
Agu 25
3613
Update Initial Stock of Product using XMLRPC API [Odoo14] Diselesaikan
v14
Avatar
Avatar
Avatar
2
Jul 25
9230
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik 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