The above error is caused when the below code is run:
sale.myquote.py:
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import time
from openerp import pooler
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare
import openerp.addons.decimal_precision as dp
from openerp import netsvc
from openerp.addons import sale
class sale_myquote:
_name = 'sale.myquote'
_inherit = 'sale.order'
_columns = {
'name' : fields.char('Quote No',size=64,required=True),
'cust': fields.many2one('res.partner', 'Customer', readonly=True, required=True, select=True, track_visibility='always'),
'user_id': fields.many2one('res.partner', 'Salesman', readonly=True, required=True, select=True, track_visibility='always'),
'qdate' : fields.date('Date'),
'cust_ref' : fields.char('Customer Ref',size=64,required=True),
'pricelist' : fields.many2one('product.pricelist', 'Pricelist'),
}
class sale_myquote_order:
_name = 'sale.myquote.order'
_inherit = 'sale.order'
_columns = {
'prod' : fields.many2one('product.product', 'Product'),
'name' :fields.many2one('product.product', 'Product'),
'qty' : fields.integer('Quantity'),
'price' : fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price'), readonly=True),
'tax' : fields.float('Tax'),
'disc' : fields.float('Discount'),
'subtotal' : fields.float('Amount'), #'subtotal' : fields.function(f_subtot, string="Amount"),
'total_wo_tax' : fields.float('Subtotal'), #'total_wo_tax' : fields.function(f_total, string="Amount"),
'total_tax' : fields.float('Tax'), #'total_tax' : fields.function(f_total, string="Tax"),
'total' : fields.float('Final'), #'total' : fields.function(_total, string="Total"),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of sales order lines."),
'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True),
}
_order = 'order_id desc, sequence, id'
_defaults = {
'disc': 0.0,
'qty': 1,
'tax' : 4.0,
'sequence': 10,
'price': 0.0,
'total' : 0.0,
}
"""
def f_total(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for order in self.browse(cr, uid, ids, context=context):
res[order.id] = {
'total_wo_tax': 0.0,
'total_tax': 0.0,
'total': 0.0,
}
val = val1 = 0.0
for line in order.order_line:
val1 += line.subtotal
val += self.tax(cr, uid, line, context=context)
res[order.id]['total_tax'] = cur_obj.round(cr, uid, cur, val)
res[order.id]['total_wo_tax'] = cur_obj.round(cr, uid, cur, val1)
res[order.id]['total'] = res[order.id]['total_wo_tax'] + res[order.id]['total_tax']
return res
def f_subtot(self, cr, uid, ids, field_name, arg, context=None):
cur_obj = self.pool.get('res.currency')
res = {}
if context is None:
context = {}
for line in self.browse(cr, uid, ids, context=context):
price = line.price * (1 - (line.disc or 0.0) / 100.0)
taxes = tax_obj.compute_all(cr, uid, line.tax, price, line.qty, line.prod, line.order_id.partner_id)
cur = line.order_id.pricelist_id.currency_id
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
return res
def f_subtot_tax(self, cr, uid, line, context=None):
val = 0.0
for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, line.price * (1-(line.disc or 0.0)/100.0), line.product_uom_qty, line.prod, line.order_id.partner_id)['taxes']:
val += c.get('amount', 0.0)
return val
"""
sale_myquote_view.ml:
MyQuote sale.myquote
ERROR TRACEBACK:
2013-08-11 16:12:54,577 4780 INFO ERP_demo openerp.modules.module: module sale_myquote: creating or updating database tables
2013-08-11 16:12:54,578 4780 INFO ERP_demo openerp.modules.loading: module sale_myquote: loading sale_myquote_view.xml
2013-08-11 16:12:55,171 4780 ERROR ERP_demo openerp.addons.base.ir.ir_ui_view: Can't render view for model: sale.myquote
Traceback (most recent call last):
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/addons/base/ir/ir_ui_view.py", line 126, in _check_render_view
fvg = self.pool.get(view.model).fields_view_get(cr, uid, view_id=view.id, view_type=view.type, context=context)
AttributeError: 'NoneType' object has no attribute 'fields_view_get'
2013-08-11 16:12:55,195 4780 ERROR ERP_demo openerp.tools.convert: Parse error in /home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/addons/sale_myquote/sale_myquote_view.xml:12: MyQuote sale.myquote
Traceback (most recent call last):
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/tools/convert.py", line 847, in parse
self._tags[rec.tag](self.cr, rec, n)
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/tools/convert.py", line 814, in _tag_record
id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/addons/base/ir/ir_model.py", line 963, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/addons/base/ir/ir_ui_view.py", line 103, in create
return super(view, self).create(cr, uid, values, context)
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/osv/orm.py", line 4470, in create
self._validate(cr, user, [id_new], context)
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/osv/orm.py", line 1544, in _validate
raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2013-08-11 16:12:55,296 4780 ERROR ERP_demo openerp.netsvc: ValidateError
Error occurred while validating the field(s) arch: Invalid XML for View Architecture!
Traceback (most recent call last):
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/osv/osv.py", line 188, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/home/naveen/eclipseworkspace/openerp-7.0-20130623-231037/openerp/osv/osv.py", line 144, in wrapper
raise except_osv(inst.name, inst.value)
except_osv: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2013-08-11 16:12:55,355 4780 INFO ERP_demo werkzeug: 127.0.0.1 - - [11/Aug/2013 16:12:55] "POST /web/dataset/call_button HTTP/1.1" 200 -
Please help.