跳至內容
Odoo 選單
  • 登入
  • 免費試用
  • 應用程式
    財政
    • 會計
    • 發票
    • 開支報銷
    • 試算表 (BI)
    • 文件管理
    • 電子簽名
    銷售
    • 客戶關係
    • 銷售
    • POS 銷售點管理 - 零售
    • POS 銷售點管理 - 餐廳
    • 訂閱
    • 租賃
    網站
    • 網站製作
    • 電子商務
    • 網誌
    • 討論區
    • 線上客服
    • 網上學習
    供應鏈
    • 庫存
    • 製造管理
    • 產品生命周期
    • 採購
    • 保養維護
    • 品質管理
    人力資源
    • 員工管理
    • 招聘
    • 休假
    • 工作表現評核
    • 內部推薦
    • 車隊管理
    市場推廣
    • 社交媒體推廣
    • 電郵推廣
    • 短訊營銷
    • 活動
    • 自動化推廣
    • 網上調查
    服務
    • 專案管理
    • 工時管理
    • 外勤服務管理
    • 技術支援
    • 工作規劃
    • 預約管理
    生產力
    • 聊天
    • 批核
    • 物聯網
    • VoIP
    • 知識庫
    • WhatsApp
    第三方應用程式 Odoo Studio Odoo 雲端平台
  • 行業
    零售
    • 書店
    • 服裝店
    • 家具店
    • 食品雜貨店
    • 五金店
    • 玩具店
    餐飲及款待
    • 酒吧及酒館
    • 餐廳
    • 快餐
    • 賓館
    • 飲品分銷商
    • 酒店
    房地產
    • 地產代理公司
    • 建築師事務所
    • 建造業
    • 物業管理
    • 園藝
    • 業主聯會
    顧問服務
    • 會計公司
    • Odoo 合作夥伴
    • 市場推廣公司
    • 律師事務所
    • 人才招募
    • 審計及認證
    製造管理
    • 紡織
    • 金屬
    • 家具
    • 食品
    • 啤酒廠
    • 企業禮品
    保健與健身
    • 運動俱樂部
    • 眼鏡店
    • 健身中心
    • 健康從業人員
    • 藥房
    • 髮型屋
    技術行業
    • 雜工
    • IT 硬體與支援
    • 太陽能系統
    • 鞋匠
    • 清潔服務
    • 暖通空調服務
    其他
    • 非牟利組織
    • 環境保護機構
    • 廣告板租賃
    • 攝影服務
    • 自行車租賃
    • 軟體經銷商
    瀏覽所有行業
  • 社群
    學習
    • 教學影片
    • 使用說明
    • 認證
    • 培訓
    • 網誌
    • Podcast
    增強教學效能
    • 教育計劃
    • Scale Up! 商業遊戲
    • 到訪 Odoo
    取得軟件
    • 下載
    • 版本對照表
    • 版本說明
    合作
    • GitHub
    • 討論區
    • 活動
    • 翻譯
    • 成為合作夥伴
    • 合作夥伴服務
    • 登記你的會計服務公司
    獲取服務相關資料
    • 尋找合作夥伴
    • 尋找會計服務
    • 預約顧問諮詢
    • 安裝及推行服務
    • 客戶案例
    • 支援
    • 軟件升級
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    預約示範
  • 定價
  • 技術支援

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

  • 客戶關係
  • e-Commerce
  • 會計
  • 庫存
  • PoS
  • 專案管理
  • MRP
All apps
只限註冊用戶才可與社群互動。
所有帖文 人 獎章
標籤 (查看所有)
odoo accounting v14 pos v15
關於此討論區
只限註冊用戶才可與社群互動。
所有帖文 人 獎章
標籤 (查看所有)
odoo accounting v14 pos v15
關於此討論區
支援

How to change the Invoice Line?

訂閱

此帖文有活動時,接收通知

此問題已被標幟
taxinvoice.line
3 回覆
17564 瀏覽次數
頭像
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
頭像
捨棄
頭像
NSC
最佳答案

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
頭像
捨棄
頭像
my
作者 最佳答案

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
頭像
捨棄
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
作者

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. :-)

頭像
klacus
最佳答案

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
頭像
捨棄
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
作者

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

喜歡這則討論?不要只閱讀,加入發表意見吧!

今天就建立帳戶,享受獨家功能,與我們精彩的社群互動!

註冊
相關帖文 回覆 瀏覽次數 活動
Advance customer payment and its VAT reflection
tax
頭像
頭像
1
7月 25
3037
POS Tax
tax
頭像
頭像
1
7月 25
8287
Federal Unemployment Tax (FUTA) calculates at 10X in Payroll App
tax
頭像
1
3月 25
2301
Tax rate on shipping cost Germany/ Austria
tax
頭像
頭像
2
8月 24
2945
How to hide tax column in sale order/ quotation form ?
tax
頭像
頭像
1
12月 23
12066
社群
  • 教學影片
  • 使用說明
  • 討論區
開源
  • 下載
  • GitHub
  • Runbot 測試環境
  • 翻譯
服務
  • odoo.sh 網頁寄存
  • 支援
  • 升級
  • 自訂功能開發
  • 教育及培訓
  • 尋找會計服務
  • 尋找合作夥伴
  • 成為合作夥伴
關於我們
  • 關於 Odoo 公司
  • 品牌資產
  • 聯絡我們
  • 招聘
  • 活動
  • Podcast
  • 網誌
  • 客戶
  • 法律 • 私隱政策
  • 安全性
الْعَرَبيّة 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 是一套開放源碼的商業管理系統,涵蓋你公司全部的營運需要,包括客戶關係管理(CRM)、電子商務、會計、庫存管理、POS(銷售點管理)、專案管理等應用程式。

Odoo 的獨特價值是非常簡單易用,同時將不同應用程式完美整合。

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