Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Odoo Client Error

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
v14
3868 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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
Autor

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>

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Attached PDF file is not formatted properly
v14
Imagine profil
Imagine profil
1
dec. 25
393
Odoo14 alternative for Automated Translations through Gengo API module
v14
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
sept. 25
3815
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Imagine profil
0
aug. 25
1221
How to Managing Birthdate and Age in Odoo
v14
Imagine profil
Imagine profil
1
aug. 25
3625
Update Initial Stock of Product using XMLRPC API [Odoo14] Rezolvat
v14
Imagine profil
Imagine profil
Imagine profil
2
iul. 25
9249
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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