Reputation: 1
i tried to make a calculation module in odoo but internal server error after i install the module and i don't know it. I just learned odoo and i hope for your help.
hit.py
from openerp import osv, fields
class hit(osv.osv):
_name = 'eha.hit'
_columns = {
'num1' : fields.float('Number 1'),
'num2' : fields.float('Number 2')
}
def on_change_price(self,cr,user,ids,num1,num2,context=None):
#Calculate the total
total = num1 + num2
res = {
'value': {
#This sets the total price on the field standard_price.
'standard_price': total
}
}
#Return the values to update it in the view.
return res
hit.xml:
<openerp>
<data>
<record id="hitung_list" model="ir.ui.view">
<field name="name">pajak_list</field>
<field name="model">eha.hit</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='standard_price']" position="before">
<field name ="num1" on_change="on_change_price(num1,num2)"/>
<field name ="num2" on_change="on_change_price(num1,num2)" />
</xpath>
</field>
</record>
</data>
</openerp>
after i install the module i got "internal server odoo"
File "E:\Odoo 8.0-20160615\server\openerp\addons\pajak\__init__.py", line 2, in <module>
import pph
File "E:\Odoo 8.0-20160615\server\openerp\addons\pajak\pph.py", line 6
results = {}
^
IndentationError: unindent does not match any outer indentation level
Upvotes: 0
Views: 494
Reputation: 805
After class
, it should be intented
class hit(osv.osv):
_name = 'eha.hit'
Upvotes: 0