Good afternoon, I have an error in my Odoo 8 module, the error is like this: MissingError
One of the documents you are trying to access has been deleted, please try again after refreshing.
Screenshoot Error: Screenshoot Error 1 Screenshoot Error 2
Detail full error:
File "C:\Tunas_Ridean\Odoo-8.0\addons\sale\sale.py", line 1067, in product_id_change
if product_obj.taxes_id:
File "C:\Tunas_Ridean\Odoo-8.0\openerp\fields.py", line 840, in __get__
return record._cache[self]
File "C:\Tunas_Ridean\Odoo-8.0\openerp\models.py", line 6041, in __getitem__
return value.get() if isinstance(value, SpecialValue) else value
File "C:\Tunas_Ridean\Odoo-8.0\openerp\fields.py", line 56, in get
raise self.exception
MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')
My Code Modul:
File Script Models sale_order.py:
# models/sale_order.py
from openerp import models, fields
from openerp import api
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
product_id = fields.Many2one(
'product.custom', string='Product', required=True,
domain=[('state', 'in', ['confirmed', 'approved'])]
)
price_unit = fields.Float(
string='Price Unit',
related='product_id.price', # Mengambil harga dari `product.custom`
store=True,
readonly=True
)
@api.onchange('product_id.price','price_unit')
def _onchange_product_id(self):
#import ipdb; ipdb.set_trace()
self.price_unit = self.product_id.price
self.name = self.product_id.description
self.product_uom_qty = self.product_id.qty
File Script XML sale_order_view.xml:
<!-- views/sale_order_view.xml -->
<openerp>
<data>
<record id="view_order_form_custom" model="ir.ui.view">
<field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="replace">
<field name="product_id"/>
</xpath>
<xpath expr="//field[@name='price_unit']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
</data>
</openerp>