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

Hello, I created an extending module which inherits "account.invoice": it adds two fields and shows them in the form view.

Everything works fine until i have to reboot Odoo service, which causes "500 Internal Server Error" after the refresh. I need to remove the module from addons folder, uninstall and reinstall it to make it work again.

My files:

models.py

# -*- coding: utf-8 -*-
from openerp import models, fields, api

class provaextendinvoice(models.Model):
_inherit = "account.invoice"
x_field1 = fields.Float(string="Field1")
x_field2 = fields.Float(string="Field2")

prova_extend_invoice.xml

<openerp>
<data>
      <record model="ir.ui.view" id="view_invoice_form">
          <field name="name">account.invoice.form.inherit</field>
          <field name="model">account.invoice</field>
          <field name="inherit_id" ref="account.invoice_form"/>
      <field name="arch" type="xml">

      <field name="amount_untaxed" position="before">
      <field name="x_field1" readonly="True"/>
      </field>
      <field name="amount_untaxed" position="after">
      <field name="x_field2"readonly="True"/>
      </field>

      </field>
      </record>
</data>
</openerp>

 








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

EDIT:

I have made my module depend on product and the error is gone now.

So in your case try to depend your module from account.


I have exactly the same problem only with product.template

Does anybody have a solution?

The error message says:

../openerp/modules/registry.py ",  line 102, in __getitem__ return self.models[model_name]

KeyError product.template

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

It's your exact code ?

If so there is no space between "x_field"readonly="true" it may cause a problem in your case

<field name="x_field2" readonly="True"/> 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 24
3046
0
ต.ค. 15
3705
2
พ.ค. 15
4662
1
มี.ค. 15
3613
2
มี.ค. 15
5089