Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5837 มุมมอง

I'm using odoo 9 and i have created a custom module to add stamp tax in invoice automatically . I have created a new page to enter stamp value and account in res.company. My problem is stamp tax does not add automatically to invoice. Any help please ??

account_invoice.py

from openerp import tools
from openerp.osv import fields,osv

class res_partner(osv.osv):
_name="res.company"
_inherit="res.company"
_columns={
"default_stamp_tax_account":fields.many2one('account.account',"stamp tax account"),
"default_stamp_tax_value":fields.float('stamp tax value'),
}
class account_invoice(osv.osv):
_name="account.invoice"
_inherit="account.invoice"
def create(self,cr,uid,values,context=None):

    stamp_account=self.pool.get('res.company').browse(cr,uid,values.get('company_id')).default_stamp_tax_account.id
    tax_value=self.pool.get('res.company').browse(cr,uid,values.get('company_id')).default_stamp_tax_value
    #pos_account=self.pool.get('pos.order').browse(cr, uid, values.get('company_id')).partner_id.property_account_receivable.id
    print stamp_account
    print tax_value

    #print pos_account

    if stamp_account:
        tax_line=[]
        tax_line.append([0, False, {'base_amount': 0, 'amount': tax_value, 'tax_amount': tax_value, 'name': 'Timbre', 'account_id': stamp_account}])
        values.update({
        'tax_line':tax_line,

        })

        print values
    return super(account_invoice,self).create(cr,uid,values,context)
อวตาร
ละทิ้ง
ผู้เขียน

Any help please ?? i'm stuck with this problem

Why don't you just create a TAX and configure that as the default sales tax?

Then it will be added to all products and services as sales tax.

So when you create invoices with these items, this tax will come automatically

ผู้เขียน

I can't because it's a tax for invoice not for product it should be added one time

ผู้เขียน

I used "print line_taxe" it shows the values in the console but my problem that return doesn't return any thing.Could you help me ??

คำตอบที่ดีที่สุด

Please answer on the same question?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

hello , do you find a solution ?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 21
6285
0
ก.ค. 18
2947
1
พ.ค. 18
9344
1
ก.ค. 17
10555
create a notification on odoo v9 แก้ไขแล้ว
1
ก.ค. 17
3153