Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

Odoo Client Error

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
v14
3880 Visualizações
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
Cancelar
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>

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Attached PDF file is not formatted properly
v14
Avatar
Avatar
1
dez. 25
406
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
set. 25
3838
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
ago. 25
1223
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
ago. 25
3629
Update Initial Stock of Product using XMLRPC API [Odoo14] Resolvido
v14
Avatar
Avatar
Avatar
2
jul. 25
9255
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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