Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

How to avoid double entry?

Suscribirse

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

Se marcó esta pregunta
functionentriesinsertsale.orderduplicate
5047 Vistas
Avatar
evon_dun

I added a field cartage about an half year ago, and i tried adding another field the exact same way. I get only one issue that is the entry i insert gets a double insert. Please anyone could help?

>     def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
>         cur_obj = self.pool.get('res.currency')
>         res = {}
>         cartageflag = 'false'
>         ordercartageflag = 'true'
>         line_id = 0
>         order_id = 0
>         cartage_price = 0
>         oldcartage = 0
>         oldlabour = 0
>         labour_price = 0
>         labourflag = 'false'
>         orderlabourflag = 'true'
>         checklabourflag = 'false'
>         oid = 0
> 
> 
>         for order in self.browse(cr, uid, ids, context=context):
>             res[order.id] = {
>                 'amount_untaxed': 0.0,
>                 'amount_tax': 0.0,
>                 'amount_total': 0.0,
>           }
>             val = val1 = 0.0
>             cur = order.pricelist_id.currency_id        
> 
>             if order.cartage > 0.0:
>                 cartageflag = 'true'
>             if order.labour > 0.0:
>                 labourflag = 'true'
> 
>             for line in order.order_line:
>                 if cartageflag == 'true':
>                     if line.name == 'Cartage':
>                         ordercartageflag = 'false'            line_id
> = line.id             oldcartage = line.price_unit            cr.execute('update
> sale_order_line set price_unit=%s
> where id=%s',(order.cartage,line.id,))
>       
>           #line.update({'price_unit':order.cartage})
>       if labourflag == 'true':
>                     if line.name == 'Labour':
>                         orderlabourflag = 'false'
>                         line_id = line.id
>                         oldlabour = line.price_unit
>                         cr.execute('update sale_order_line set
> price_unit=%s where
> id=%s',(order.labour,line.id,))
>                 val1 += line.price_subtotal
>                 val += self._amount_line_tax(cr, uid, line,
> context=context)             
> 
>             res[order.id]['amount_tax'] =
> cur_obj.round(cr, uid, cur, val)
>             res[order.id]['amount_untaxed'] =
> cur_obj.round(cr, uid, cur, val1)
>             res[order.id]['amount_total'] =
> res[order.id]['amount_untaxed'] +
> res[order.id]['amount_tax']
>             
>             if ordercartageflag == 'true':
>                 res[order.id]['amount_total'] =
> res[order.id]['amount_total'] +
> order.cartage            
>             elif ordercartageflag == 'false':
>                 if oldcartage != order.cartage:
>                     res[order.id]['amount_total'] =
> (res[order.id]['amount_total'] +
> order.cartage) - oldcartage
>                     
>             if orderlabourflag == 'true':
>                 res[order.id]['amount_total'] =
> res[order.id]['amount_total'] +
> order.labour            
>             elif orderlabourflag == 'false':
>                 if oldlabour != order.labour:
>                     res[order.id]['amount_total'] =
> (res[order.id]['amount_total'] +
> order.labour) - oldlabour
> 
> 
>         
>         oid = order.id
>         if cartageflag == 'true' and ordercartageflag == 'true':
>             self.pool.get('sale.order.line').create(cr,
> uid, {
>                 'order_id':oid,
>                 'name':'Cartage',               
>                 'price_unit':order.cartage,
>                 'product_uos_qty':1,                
>                 'product_uom':1,
>                 'product_uom_qty':1,
>                 'delay':7,
>                 'discount': 0.0})
> 
>             if labourflag == 'true' and orderlabourflag == 'true':
>                 self.pool.get('sale.order.line').create(cr,
> uid, {
>                     'order_id':oid,
>                     'name':'Labour',               
>                     'price_unit':order.labour,
>                     'product_uos_qty':1,                
>                     'product_uom':1,
>                     'product_uom_qty':1,
>                     'delay':7,
>                     'discount': 0.0})




        return res
0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Function _get_default_shop
function sale.order
Avatar
Avatar
1
mar 15
3528
How to remove duplicate products from the system without affecting sales orders for those duplicate products ? Resuelto
sales product sale.order duplicate
Avatar
Avatar
Avatar
Avatar
3
ene 24
16281
List quotations + sale orders from within a function
function view quotation sale.order
Avatar
0
feb 16
3603
How can I hide the 'duplicate' option in the 'more' button for a specific object Resuelto
duplicate
Avatar
Avatar
Avatar
Avatar
Avatar
4
oct 25
16734
production of not enough materials for a PO
function
Avatar
Avatar
Avatar
2
sept 25
1151
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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