Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Odoo Client Error

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
v14
3862 Vistas
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
Descartar
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>

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Attached PDF file is not formatted properly
v14
Avatar
Avatar
1
dic 25
378
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
sept 25
3805
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
ago 25
1213
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
ago 25
3613
Update Initial Stock of Product using XMLRPC API [Odoo14] Resuelto
v14
Avatar
Avatar
Avatar
2
jul 25
9231
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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