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

A new Due date invoices

Abonare

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

Această întrebare a fost marcată
invoicedate
6005 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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
Revenue - set a different accounting date to date of invoice Rezolvat
accounting invoice date
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
mar. 25
7765
Invoice Date importing
invoice import date
Imagine profil
0
sept. 24
1855
Timesheet Date Range on Invoice
invoice date timesheet
Imagine profil
Imagine profil
1
aug. 24
2290
How to insert requested_date to invoice
invoice date delivery
Imagine profil
2
oct. 18
4438
Can i edit the date or the Tax Amount Once the Invoice is Created
invoice date edit
Imagine profil
Imagine profil
2
iun. 15
4397
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