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.

0

Purchase Order Module..Cannot Install..Odoo8

By
Mazhar Iqbal Rana
on 12/6/14, 6:11 AM 848 views

Good Day!

 

I am trying to install module purchase_order_approval in odoo8 but unable to do that. Can anyone mentioned errors or wrong place of me?

 

Thanks

 

__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.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.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() 

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>

 

Please guide me where is I am going wrong

 

Error I am getting  is:

Traceback (most recent call last):
  File "/opt/odoo/odoo/openerp/http.py", line 517, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo/openerp/http.py", line 535, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo/openerp/http.py", line 294, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/http.py", line 291, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/odoo/odoo/openerp/http.py", line 751, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo/openerp/http.py", line 387, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 953, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 941, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/addons/base/module/module.py", line 450, in button_immediate_install
    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
  File "/opt/odoo/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/odoo/openerp/addons/base/module/module.py", line 498, in _button_immediate_function
    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
  File "/opt/odoo/odoo/openerp/modules/registry.py", line 341, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/odoo/odoo/openerp/modules/loading.py", line 358, in load_modules
    loaded_modules, update_module)
  File "/opt/odoo/odoo/openerp/modules/loading.py", line 263, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/opt/odoo/odoo/openerp/modules/loading.py", line 182, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/opt/odoo/odoo/openerp/modules/loading.py", line 118, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/opt/odoo/odoo/openerp/tools/convert.py", line 901, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/opt/odoo/odoo/openerp/tools/convert.py", line 978, in convert_xml_import
    relaxng.assert_(doc)
  File "lxml.etree.pyx", line 3313, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:159862)
AssertionError: Invalid attribute type for element field, line 109

 

 

 

 

 

 

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/6/14, 6:11 AM
Seen: 848 times
Last updated: 3/16/15, 8:10 AM