Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Module Install Error!

By
Mazhar Iqbal Rana
on 12/27/14, 2:41 AM 1,565 views

Heya.. I am installing a custom module and erorr below comes..in ODOO8

AssertionError: Invalid attribute type for element field, line 109

 

Where in Line 109 is this Fields:

<field name="subflow_id" search="[('osv','=','account.invoice')]">

Need your special guidance

 

Thanks

 

 

A Complete Module is below:

init.py

import po import user

openerp.py

{ "name": "Project PO Management", "version": "1.0", "author": "Rana", "category": "Generic Modules/Projects & Services", "depends": ["purchase"], "description": """ """, "data":["po.xml","user.xml"], #"data":["user.xml"], 'installable': True, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

po.py

from openerp.osv import orm, fields,osv from openerp.osv.osv import except_osv from openerp.tools.translate import _ from openerp import netsvc from openerp.addons.decimal_precision import decimal_precision as dp class user_extension(osv.osv): _inherit="res.users" _columns={ 'maxamounttoapprovepo': fields.float('Max amount to approve po', help="jjj"), } _defaults={ 'maxamounttoapprovepo':0, } user_extension() class purchase_extension(osv.osv): _inherit="purchase.order" def approvequot(self,cr,uid,id): purchase_quot_total=0 max_amount_to_approve=0 user_obj=self.pool.get('res.users') user_browse_record=user_obj.browse(cr,uid,[uid]) for i in user_browse_record: max_amount_to_approve=i.maxamounttoapprovepo purchase_browse=self.browse(cr,uid,id) for i in purchase_browse: purchase_quot_total=i.amount_total if purchase_quot_total>max_amount_to_approve: raise osv.except_osv(_('Quotation confirm Error!'),_("You don't have rights to confirm more than PO total:"+str(max_amount_to_approve))) else: self.write(cr,uid,id,{'state':'approvedraft'}) STATE_SELECTION = [ ('draft', 'Draft PO'), ('approvedraft', 'Draft PO approve'), ('sent', 'RFQ Sent'), ('confirmed', 'Waiting Approval'), ('approved', 'Purchase Order'), ('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled') ] _columns={ 'state': fields.selection(STATE_SELECTION, 'Status', readonly=True, help="The status of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' status. Then the order has to be confirmed by the user, the status switch to 'Confirmed'. Then the supplier must confirm the order to change the status to 'Approved'. When the purchase order is paid and received, the status becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the status becomes in exception.", select=True), }

user.py

from openerp.osv import orm, fields,osv from openerp.osv.osv import except_osv from openerp.tools.translate import _ from openerp import netsvc from openerp.addons.decimal_precision import decimal_precision as dp class user_extension(osv.osv): _inherit="res.users" _columns={ 'maxamounttoapprovepo': fields.float('Max amount to approve po', help="jjj"), } _defaults={ 'maxamounttoapprovepo':0, } user_extension()

po.xml

<?xml version="1.0" encoding="utf-8"?> <openerp> <data> <record id="purchase_order_form_extension" model="ir.ui.view"> <field name="name">purchase.order.form.extension</field> <field name="model">purchase.order</field> <field name="type">form</field> <field name="inherit_id" ref="purchase.purchase_order_form"/> <field name="arch" type="xml"> <xpath expr="/form/header/field[@name='state']" position="replace"> <field name="state" widget="statusbar" statusbar_visible="draft,approvedraft,sent,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/> </xpath> <xpath expr="/form/header/button[@name='action_cancel']" position="after"> <button name="quot_confirm" states="draft" string="Confirm quotation"/> <!-- <button name="purchase_confirm" states="approvedraft" string="Confirm Order"/>--> </xpath> <xpath expr="/form/header/button[@name='purchase_confirm']" position="replace"> <button name="purchase_confirm" states="approvedraft" string="Confirm Order"/> </xpath> <xpath expr="/form/header/button[@name='wkf_send_rfq']" position="replace"> <button name="wkf_send_rfq" states="approvedraft" string="Send by Email" type="object" context="{'send_rfq':True}" class="oe_highlight"/> </xpath> <xpath expr="/form/header/button[@name='purchase_cancel']" position="replace"> <button name="purchase_cancel" states="approvedraft,draft,confirmed,sent" string="Cancel Order"/> </xpath> <!-- <button name="wkf_send_rfq" states="sent" string="Send by Email" type="object" context="{'send_rfq':True}"/> <button name="print_quotation" string="Print" type="object" states="sent" groups="base.group_user"/> <button name="purchase_confirm" states="draft" string="Confirm Order"/> <button name="purchase_confirm" states="sent" string="Confirm Order" class="oe_highlight"/> <button name="wkf_send_rfq" states="confirmed" string="Resend Purchase Order" type="object" class="oe_highlight"/> <button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel Order" type="object" /> <button name="picking_ok" states="except_picking" string="Manually Corrected"/> <button name="invoice_ok" states="except_invoice" string="Manually Corrected"/> <button name="purchase_approve" states="confirmed" string="Approve Order" class="oe_highlight" groups="purchase.group_purchase_manager"/> <button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/> <button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','=','picking'), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/> <button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" />--> </field> </record> <record id="purchase_order" model="workflow"> <field name="name">Purchase Order Basic Workflow</field> <field name="osv">purchase.order</field> <field name="on_create">True</field> </record> <record id="act_draft" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="flow_start">True</field> <field name="name">draft</field> </record> <record id="act_approvedraft" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">approvedraft</field> <field name="kind">function</field> <field name="action">approvequot()</field> </record> <record id="act_sent" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">sent</field> <field name="kind">function</field> <field name="action">write({'state':'sent'})</field> </record> <record id="act_confirmed" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">confirmed</field> <field name="split_mode">OR</field> <field name="kind">function</field> <field name="action">wkf_confirm_order()</field> </record> <record id="act_cancel" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">cancel</field> <field name="kind">function</field> <field name="flow_stop">True</field> <field name="action">write({'state':'cancel'})</field> </record> <record id="act_except_invoice" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">except_invoice</field> <field name="kind">function</field> <field name="action">write({'state':'except_invoice'})</field> </record> <record id="act_except_picking" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">except_picking</field> <field name="kind">function</field> <field name="action">write({'state':'except_picking'})</field> </record> <record id="act_router" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">router</field> <field name="split_mode">OR</field> <field name="kind">function</field> <field name="join_mode">AND</field> <field name="action">wkf_approve_order()</field> </record> <record id="act_invoice" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">invoice</field> <field name="kind">subflow</field> <field name="subflow_id" search="[('osv','=','account.invoice')]" type="int"/> <field name="action">action_invoice_create()</field> </record> <record id="act_invoice_done" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">invoice_done</field> <field name="action">invoice_done()</field> <field name="kind">function</field> </record> <record id="act_invoice_end" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">invoice_end</field> </record> <record id="act_picking" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">picking</field> <field name="kind">subflow</field> <field name="subflow_id" search="[('osv','=','stock.picking')]"/> <field name="action">action_picking_create()</field> </record> <record id="act_picking_done" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">picking_done</field> <field name="action">picking_done()</field> <field name="kind">function</field> <field name="signal_send">subflow.delivery_done</field> </record> <record id="act_done" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">done</field> <field name="action">write({'state':'done'})</field> <field name="kind">function</field> <field name="flow_stop">True</field> <field name="join_mode">AND</field> </record> <record id="trans_draft_confirmed" model="workflow.transition"> <field name="act_from" ref="act_draft"/> <field name="act_to" ref="act_confirmed"/> <field name="signal">purchase_confirm</field> </record> <record id="trans_draft_confirmed" model="workflow.transition"> <field name="act_from" ref="act_draft"/> <field name="act_to" ref="act_approvedraft"/> <field name="signal">quot_confirm</field> </record> <record id="trans_draft_sent" model="workflow.transition"> <field name="act_from" ref="act_approvedraft"/> <field name="act_to" ref="act_sent"/> <field name="signal">send_rfq</field> </record> <record id="trans_sent_confirmed" model="workflow.transition"> <field name="act_from" ref="act_sent"/> <field name="act_to" ref="act_confirmed"/> <field name="signal">purchase_confirm</field> </record> <record id="trans_sent_cancel" model="workflow.transition"> <field name="act_from" ref="act_sent"/> <field name="act_to" ref="act_cancel"/> <field name="signal">purchase_cancel</field> </record> <record id="trans_confirmed_cancel" model="workflow.transition"> <field name="act_from" ref="act_confirmed"/> <field name="act_to" ref="act_cancel"/> <field name="signal">purchase_cancel</field> </record> <record id="trans_draft_cancel" model="workflow.transition"> <field name="act_from" ref="act_draft"/> <field name="act_to" ref="act_cancel"/> <field name="signal">purchase_cancel</field> </record> <record id="trans_confirmed_router" model="workflow.transition"> <field name="act_from" ref="act_confirmed"/> <field name="act_to" ref="act_router"/> <!-- <field name="signal">purchase_approve</field> removed from simplification/useability --> </record> <record id="trans_router_picking" model="workflow.transition"> <field name="act_from" ref="act_router"/> <field name="act_to" ref="act_picking"/> <field name="condition">has_stockable_product()</field> </record> <record id="trans_router_picking_done" model="workflow.transition"> <field name="act_from" ref="act_router"/> <field name="act_to" ref="act_picking_done"/> <field name="condition">not has_stockable_product()</field> </record> <record id="trans_router_invoice" model="workflow.transition"> <field name="act_from" ref="act_router"/> <field name="act_to" ref="act_invoice"/> <field name="condition">invoice_method=='order'</field> </record> <record id="trans_router_invoice_no_order" model="workflow.transition"> <field name="act_from" ref="act_router"/> <field name="act_to" ref="act_invoice_end"/> <field name="condition">invoice_method&lt;&gt;'order'</field> </record> <record id="trans_except_picking_picking_done" model="workflow.transition"> <field name="act_from" ref="act_except_picking"/> <field name="act_to" ref="act_picking_done"/> <field name="signal">picking_ok</field> </record> <record id="trans_except_invoice_invoice_done" model="workflow.transition"> <field name="act_from" ref="act_except_invoice"/> <field name="act_to" ref="act_invoice_done"/> <field name="signal">invoice_ok</field> </record> <record id="trans_except_picking" model="workflow.transition"> <field name="act_from" ref="act_except_picking"/> <field name="act_to" ref="act_cancel"/> <field name="signal">purchase_cancel</field> </record> <record id="trans_except_invoice" model="workflow.transition"> <field name="act_from" ref="act_except_invoice"/> <field name="act_to" ref="act_cancel"/> <field name="signal">purchase_cancel</field> </record> <record id="trans_picking_except_picking" model="workflow.transition"> <field name="act_from" ref="act_picking"/> <field name="act_to" ref="act_except_picking"/> <field name="signal">subflow.cancel</field> </record> <record id="trans_invoice_except_invoice" model="workflow.transition"> <field name="act_from" ref="act_invoice"/> <field name="act_to" ref="act_except_invoice"/> <field name="signal">subflow.cancel</field> </record> <record id="trans_picking_picking_done" model="workflow.transition"> <field name="act_from" ref="act_picking"/> <field name="act_to" ref="act_picking_done"/> <field name="signal">subflow.done</field> </record> <record id="trans_invoice_invoice_done" model="workflow.transition"> <field name="act_from" ref="act_invoice"/> <field name="act_to" ref="act_invoice_done"/> <field name="signal">subflow.paid</field> </record> <record id="trans_picking_done_done" model="workflow.transition"> <field name="act_from" ref="act_picking_done"/> <field name="act_to" ref="act_done"/> </record> <record id="trans_invoice_done_done" model="workflow.transition"> <field name="act_from" ref="act_invoice_done"/> <field name="act_to" ref="act_invoice_end"/> </record> <record id="trans_invoice_end_done" model="workflow.transition"> <field name="act_from" ref="act_invoice_end"/> <field name="act_to" ref="act_done"/> <field name="condition">invoiced</field> </record> <!-- Procurement --> <record id="act_buy" model="workflow.activity"> <field name="wkf_id" ref="procurement.wkf_procurement"/> <field name="name">buy</field> <field name="kind">subflow</field> <field name="subflow_id" search="[('osv','=','purchase.order')]"/> <field name="action">action_po_assign()</field> </record> <record id="trans_confirm_mto_purchase" model="workflow.transition"> <field name="act_from" ref="procurement.act_confirm_mto"/> <field name="act_to" ref="act_buy"/> <field name="condition">check_buy() and check_supplier_info()</field> </record> <record id="trans_buy_make_done" model="workflow.transition"> <field name="act_from" ref="act_buy"/> <field name="act_to" ref="procurement.act_make_done"/> <field name="signal">subflow.delivery_done</field> </record> <record id="trans_buy_cancel" model="workflow.transition"> <field name="act_from" ref="act_buy"/> <field name="act_to" ref="procurement.act_cancel"/> <field name="signal">subflow.cancel</field> </record> </data> </openerp>

user.xml

<?xml version="1.0" encoding="UTF-8"?> <openerp> <data> <record id="view_users_form_inherit" model="ir.ui.view"> <field name="name">res.users.form.inherit</field> <field name="model">res.users</field> <field name="type">form</field> <field name="inherit_id" ref="base.view_users_form"/> <field name="arch" type="xml"> <xpath expr="//page[@string='Access Rights']" position="after"> <page string="PO Authorization"> <group> <field name="maxamounttoapprovepo" /> </group> </page> </xpath> </field> </record> </data> </openerp>

Baiju! Still the same error AssertionError: Invalid attribute type for element field, line 109

Mazhar Iqbal Rana
on 12/28/14, 12:30 AM
0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 1/2/15, 5:46 PM

Hello Mazhar,

The issue is with extra attribute (type="int") in xml tag:

<field name="subflow_id" search="[('osv','=','account.invoice')]" type="int"/>

So just remove the attribute type="int" and try again.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/27/14, 2:41 AM
Seen: 1565 times
Last updated: 3/16/15, 8:10 AM