Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to change the Invoice Line?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
taxinvoice.line
3 Respostes
17528 Vistes
Avatar
my

Hi i want to change the code in this field in the line of Invoice: [[ formatLang(l.price_subtotal, digits get_digits(dp 'Account')) ]] [[ o.currency_id.symbol ]]. I want it incl. tax. How had to be this code? Who can help me?

1
Avatar
Descartar
Avatar
NSC
Best Answer

I have a similar issue. Maybe somebody can help. I need to add only product.name_template to account.invoice.line. This is the very left part of the invoice lines shown inside form view. Booking text joins Internal ID, product name and product description. This is too much and these three fields can not be accessed separately. Internal Id and description are only for internal use and should not appear on my invoices. I would be grateful for help.

0
Avatar
Descartar
Avatar
my
Autor Best Answer

Hi klacus, hi i get an Error

OpenERP Server Error

Client Traceback (most recent call last): File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\http.py", line 204, in dispatch File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\controllers\main.py", line 1133, in call_button File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\controllers\main.py", line 1121, in _call_kw File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\session.py", line 43, in proxy File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\session.py", line 31, in proxy_method File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\session.py", line 104, in send

Server Traceback (most recent call last): File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\web\session.py", line 90, in send File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\netsvc.py", line 293, in dispatch_rpc File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\service\web_services.py", line 626, in dispatch File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\osv.py", line 188, in execute_kw File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\osv.py", line 131, in wrapper File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\osv.py", line 197, in execute File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\osv.py", line 185, in execute_cr File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\sale\sale.py", line 579, in action_button_confirm File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\wkf_service.py", line 119, in trg_validate File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\instance.py", line 43, in validate File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 60, in process File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 175, in _split_test File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 183, in _join_test File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 40, in create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 60, in process File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 175, in _split_test File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 183, in _join_test File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 40, in create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 60, in process File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 175, in _split_test File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 183, in _join_test File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 40, in create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 52, in process File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\workitem.py", line 127, in _execute File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\wkf_expr.py", line 67, in execute File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\workflow\wkf_expr.py", line 57, in _eval_expr File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\tools\safe_eval.py", line 241, in safe_eval File "", line 1, in <module> File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\orm.py", line 374, in function_proxy File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\sale_stock\sale_stock.py", line 190, in action_invoice_create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\sale\sale.py", line 519, in action_invoice_create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\sale\sale.py", line 809, in invoice_line_create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\orm.py", line 4478, in create File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\orm.py", line 4627, in _store_set_values File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server.\openerp\osv\fields.py", line 1131, in get File "C:\Program Files (x86)\OpenERP 7.0-20130327-002325\Server\server\openerp\addons\csysc_inh_account_inv_tax\account_invoice.py", line 10, in _amount_line TypeError: _amount_line() takes exactly 7 arguments (8 given)

Whats wrong?

0
Avatar
Descartar
klacus

Morgen.. :-) Yeah, just a wait a few hours. I will help you, as I can... Please try the upside code.

klacus

Hi. Just do it. If I can I will help you. Regards.

klacus

Your problem is raised here: def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):

but the problem is there: _columns = { 'tax_percent' : fields.float('tax_percent'), # percentage of the tax 'tax_amount' : fields.float('tax_amount'), # amount of the tax 'line_total' : fields.float('line_total'), # calculate line tax + line amount 'price_subtotal': fields.function(_amount_line, string='Subtotal', type="float",digits_compute= dp.get_precision('Account'), store=True),
} Please check again. the price_subtotal..

my
Autor

hi, thanks for your help. Now I can indeed confirm an offer again in an order, but unfortunately at the 'price_subtota'l nothing changed. Here, the net amount is still displayed.

klacus

What is the situation now? 1. The program is running? 2. You should restart your server, after change something in python. 3. Price subtotal is change by auto, if you create a new invoice line. May you forget the restart. :-)

klacus

What is the situation now? 1. The program is running? 2. You should restart your server, after change something in python. 3. Price subtotal is change by auto, if you create a new invoice line. May you forget the restart. :-)

Avatar
klacus
Best Answer

Hi.

The account.invoice.line table is not include the tax. So if you want to see the tax by row, first your need to inherit the account.invoice.line table to add tax. After that you need some code in python what is filling it. If you have all of this things you can add a report. Just put somewhere [[o.your_tax_column_name]].

If you use Open/libre for editing, sometimes the system not found your custom record, but do not hesitate write it by hand, and try to see the filed values.

You need to understand the followings: - inherit a model. - some basics in python.

Hi.

In python you can add like this your own inherit module: My module name is: csysc_inh_account_inv_tax You just create a folder under addons. . create the following files with a same name - install a module. (first refresh the modules list, after looking the csysc_... module)

account_invoice.py

from osv import fields, osv
import decimal_precision as dp
import time

# inherit account_invoice line by standard way

class account_invoice_line(osv.osv):
    # override this methode to get the tax info's by invoice line   
    def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):
        values = super(account_invoice_line, self)._amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict)
        res = {}
        tax_obj = self.pool.get('account.tax')
        cur_obj = self.pool.get('res.currency')
        for line in self.browse(cr, uid, ids):
            price = line.price_unit * (1-(line.discount or 0.0)/100.0)
            taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity, product=line.product_id, address_id=line.invoice_id.address_invoice_id, partner=line.invoice_id.partner_id)
            res[line.id] = taxes['total']
                        #-----------------------------------------------------------------------------------
        for r in taxes['taxes']: # listing the result list
            id = r.get('id')    # get id of the taxes       
        tax_percent = self.pool.get('account.tax').browse(cr, uid, id).amount               
        tax_amount  = taxes['total_included'] -  taxes['total']
        tax_total   = taxes['total_included'] 
        for r in ids:
            id = r
            cr.execute('UPDATE account_invoice_line SET tax_percent = %s  WHERE id=%s', (tax_percent,id,))
            cr.execute('UPDATE account_invoice_line SET Tax_amount = %s  WHERE id=%s', (tax_amount,id,))
            cr.execute('UPDATE account_invoice_line SET Line_total = %s  WHERE id=%s', (tax_total,id,)) 
        #-----------------------------------------------------------------------------------            
            if line.invoice_id:
                cur = line.invoice_id.currency_id
                res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
        return res  

    _inherit= "account.invoice.line"
    _description = "account.invoice.line"  

    _columns = {
        'tax_percent' : fields.float('tax_percent'),    # percentage of the tax 
        'tax_amount' : fields.float('tax_amount'),      # amount of the tax
        'line_total' : fields.float('line_total'),      # calculate line tax + line amount
        'price_subtotal': fields.function(_amount_line, string='Subtotal', type="float",digits_compute= dp.get_precision('Account'), store=True),       
            }


account_invoice_line()

__openerp__.py:

{
    "name" : "csysc_inh_account_inv_tax",
    "version" : "1.0",
    "author" : "Company System Controll LTD",
    "website" : "",
    "category" : "Generic Modules/Others",
    "depends" : ["base","account"],
    "description" : "Overvrite account invoice line. Put and calculate tax by line.",
    "init_xml" : [],
    "demo_xml" : [],
    "update_xml" : [],
    "active": False,
    "installable": True
}

__init__.py:

import account_invoice

Comment: I use update sql,. because the orm write methode is always call _amount_line methode, so I want to avoid the never ending story.. :-)

If you want to modify the report of the invoices, now you can find the new, and hopefully filled records, when you browse that in Libreoffice report designer.

In the report designer. 1. Join to the server 2. Modify report >> account.invoice 3. Go to the second section. 4. Insert the field. >> [[ l.tax_amount ]] 5. Save report. 7. Send to the server.

or direct in rml open the addons/account/report/acount_print_invoice.rml modify Table 7 and Table8
- modify the table description:

<blockTable colWidths="185.0,70.0,80.0,60.0,**50.0**,50.0,85.0" style="Table7">
  <tr>
    <td>
      <para style="terp_tblheader_General">Description</para>
    </td>
    <td>
      <para style="terp_tblheader_General_Centre">Taxes</para>
    </td>
    <td>
      <para style="terp_tblheader_General_Right">Quantity</para>
    </td>
    <td>
      <para style="terp_tblheader_General_Right">Unit Price</para>
    </td>
    <td>
      <para style="terp_tblheader_General_Right">Disc.(%)</para>
    </td>
    <td>
      <para style="terp_tblheader_General_Right">Tax amount</para>
    </td>
    <td>
      <para style="terp_tblheader_General_Right">Price</para>
    </td>
  </tr>
</blockTable>

and Table 8 modify also: (put the data record)

<para style="terp_default_2">[[ repeatIn(o.invoice_line,'l') ]]</para>
  <blockTable colWidths="185.0,70.0,80.0,60.0,50.0,85.0" style="Table8">
    <tr>
      <td>
        <para style="terp_default_9">[[ l.name ]]</para>
      </td>
      <td>
        <para style="terp_default_Centre_9">[[ ', '.join([ lt.name or '' for lt in l.invoice_line_tax_id ]) ]]</para>
      </td>
      <td>
        <para style="terp_default_Right_9">[[ formatLang(l.quantity)]] [[ (l.uos_id and l.uos_id.name) or '' ]]</para>
      </td>
      <td>
        <para style="terp_default_Right_9">[[ formatLang(l.price_unit) ]]</para>
      </td>
      <td>
        <para style="terp_default_Centre_9">[[ formatLang(l.discount, dp='Account') ]] </para>
      </td>
      **<td>
        <para style="terp_default_9">[[ l.tax_amount ]]</para>
      </td>**
      <td>
        <para style="terp_default_Right_9">[[ formatLang(l.price_subtotal, dp='Account', currency_obj=o.currency_id) ]]</para>
      </td>
    </tr>
    <tr>
      <td>
        <para style="terp_default_Note">[[ format(l.note or '') or removeParentNode('tr') ]]</para>
      </td>
      <td>
        <para style="terp_default_9">
          <font color="white"> </font>
        </para>
      </td>
      <td>
        <para style="terp_default_Right_9">
          <font color="white"> </font>
        </para>
      </td>
      <td>
        <para style="terp_default_Right_9">
          <font color="white"> </font>
        </para>
      </td>
      <td>
        <para style="terp_default_Right_9">
          <font color="white"> </font>
        </para>
      </td>
      <td>
        <para style="terp_default_Right_9">
          <font color="white"> </font>
        </para>
      </td>
      <td>
        <para style="terp_default_Right_9">
          <font color="white"> </font>
        </para>
      </td>
    </tr>
  </blockTable>
0
Avatar
Descartar
klacus

What is the situation now? 1. The program is running? 2. You should restart your server, after change something in python. 3. Price subtotal is change by auto, if you create a new invoice line. May you forget the restart. :-)

klacus

In libre office, you can copy a field from existing field, and rename it to [[o.tax_amount]] >> this should be your new record from your account.invoice.line object. The SQL update is must be done from system side, when you install the module. You can check it by PGAdmin. (Must be find out the new records in account_invoice_line table)

klacus

Ok I checked. Please be note the report has two object: o.recordname >> come from account.invoice l.recordname >> come from account.invoice.line object. So your case you need to add by l.tax_amount. Sorry about, because I did not check the account_print_invoice.rml, I wrote down all of my head. :-( But try this way, and never give up! :-)

klacus

I refreshed the answer, please check, how to modify the report. Like a small how to :-)

klacus

Hi. Please check the table. Do you have a data in the table of account_invoice_line? (I mean the new records.)

klacus

You check by PgAdmin? What kind of tool use for the coding? Eclipse? Can you debug the code by breakpoint?

my
Autor

Hi, Yes i checked by PgAdmin. I copy and pasted your code with notepad. How can i debug the cde?

klacus

You need to refer the following: http://stackoverflow.com/questions/10087899/how-to-debug-python-code-in-openerp-6-1

Sajt Mano

HI! I applied this modification in OERP 7.0, account/account_invoice.py. But when I try to create an Invoice from a Sales order I got this error: File "/home/openerp/server/openerp/addons/account/account_invoice.py", line 1395, in _amount_line for r in taxes['taxes']: # listing the result list UnboundLocalError: local variable 'id' referenced before assignment

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Advance customer payment and its VAT reflection
tax
Avatar
Avatar
1
de jul. 25
3016
POS Tax
tax
Avatar
Avatar
1
de jul. 25
8253
Federal Unemployment Tax (FUTA) calculates at 10X in Payroll App
tax
Avatar
1
de març 25
2279
Tax rate on shipping cost Germany/ Austria
tax
Avatar
Avatar
2
d’ag. 24
2916
How to hide tax column in sale order/ quotation form ?
tax
Avatar
Avatar
1
de des. 23
12012
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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