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

A new Due date invoices

Suscribirse

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

Se marcó esta pregunta
invoicedate
5960 Vistas
Avatar
Quentin

I would like to modify the source code of a module to allow the calculation of a "due date invoices", the topic is to calculate it from the last day of a month.

I modified a file already modified and there is an associated view.xml but I don't know how I can modify this view.

I saved the former code in comment.

my account.py :

from openerp.osv import osv, fields

def compute(self, cr, uid, id, value, context=None):
    date_ref = datetime.now().strftime('%Y-%m-%d')
    if date_ref.month in (1,3,5,7,8,10,12):
        date_ref.day = 31
    elif date_ref.month in (4,6,9,11):
        date_ref.day = 30
    elif date_ref.month == 2:
        if date_ref.year % 400 == 0:
            date_ref.day = 29
        else :
            date_ref.day = 28
    date_ref = str(date_ref.year) + '-' + str(date_ref.month) + '-' + str(date_ref.day)
    pt = self.browse(cr, uid, id, context=context)
    amount = value
    result = []
    obj_precision = self.pool.get('decimal.precision')
    prec = obj_precision.precision_get(cr, uid, 'Account')
    for line in pt.line_ids:
        if line.value == 'fixed':
            amt = round(line.value_amount, prec)
        elif line.value == 'procent':
            amt = round(value * line.value_amount, prec)
        elif line.value == 'balance':
            amt = round(amount, prec)
        if amt:
            next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days))
            if line.days2 < 0:
                next_first_date = next_date + relativedelta(day=1) #Getting 1st of required month
                next_date = next_first_date + relativedelta(days=line.days2)
            if line.days2 > 0:
                next_date += relativedelta(day=line.days2)
            result.append( (next_date.strftime('%Y-%m-%d'), amt) )
            amount -= amt

    amount = reduce(lambda x,y: x+y[1], result, 0.0)
    dist = round(value-amount, prec)
    if dist:
        result.append( (time.strftime('%Y-%m-%d'), dist) )
    return result
#class account_payment_term_line(osv.osv):
#    _inherit = 'account.payment.term.line'
#    _name = 'account.payment.term.line'
#   _columns = {
#       'months': fields.integer('Months', required=True, help="Month, set 0 for the last day of the current month. This adds complete months to the calculation."),
#   }
#    _defaults = {
#        'months': 0,
#   }
#account_payment_term_line()

my monthly_payment_term_view.xml :

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>

        <record id="monthly_payment_term_view" model="ir.ui.view">
            <field name="name">account.view_payment_term_line_form</field>
            <field name="inherit_id" ref="account.view_payment_term_line_form"/>
            <field name="model">account.payment.term.line</field>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='days']" position="before">
                    <field name="months"/>
                </xpath>
            </field>
        </record>

    </data>
</openerp>

Thanks

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
Revenue - set a different accounting date to date of invoice Resuelto
accounting invoice date
Avatar
Avatar
Avatar
Avatar
3
mar 25
7732
Invoice Date importing
invoice import date
Avatar
0
sept 24
1826
Timesheet Date Range on Invoice
invoice date timesheet
Avatar
Avatar
1
ago 24
2270
How to insert requested_date to invoice
invoice date delivery
Avatar
2
oct 18
4413
Can i edit the date or the Tax Amount Once the Invoice is Created
invoice date edit
Avatar
Avatar
2
jun 15
4362
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