콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
6533 화면

This is my script but it don't function (AttributeError: 'purchase.order' object has no attribute 'req_aut')

import time import datetime

from openerp.osv import fields, osv from openerp.tools.translate import _

class Purchase(osv.osv): '''Purchase'''

_name = "purchase.order"
_inherit = 'purchase.order'

#def create(self, cr, uid, ids, context=None):
    #TODO:Definire i gruppi e mandare mail
 #   mail_message = self.pool.get('mail.message')
  #  mail_message.schedule_with_attach(cr, uid, 'api@ipi.it','ati@gmail.com',"aaaaaa","asdd",subtype='html',)i
    #notification_obj.create(cr, uid, {'user_id': uid, 'message_id': msg_id}, context=context)
    #return True

def set_req_aut(self, cr, uid, ids, context=None):    
    self.write(cr, uid, ids, { 'state' : 'req_aut' }, context=context)
    return True

def set_aut_conf(self, cr, uid, ids, context=None):
     self.write(cr, uid, ids, { 'state' : 'aut_conf' })
    return True

STATE_SELECTION = [ ('draft', 'Draft PO'), ('sent', 'RFQ Sent'), ('confirmed', 'Waiting Approval'), ('req_aut', 'Request Authorization'), ('aut_conf', 'Authorization Confirmed'), ('approved', 'Purchase Order'), ('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled') ]

_columns = {
    'project_ids': fields.many2one('project.project', string='Project refs'),

    '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),

}

Purchase()

<openerp> <data>

<record model="ir.ui.view" id="edit_order_form">
    <field name="name">purchase.order.form</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/button[@name='purchase_confirm']" position="before">
                <button name="req_aut" states="sent" string="Request Authorization" type="object"/>
                     <button name="aut_conf" states="req_aut" string="Authorization Confirmed" type="object"/>
              </xpath>
        <xpath expr="/form/header/field[@name='state']" position="replace">
                       <field name="state" widget="statusbar" statusbar_visible="draft, sent, req_aut, aut_conf, approved, done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/>
              </xpath>
        <xpath expr="/form/sheet/group/group/field[@name='partner_ref']" position="after">
                 <field name="project_ids" />
            </xpath>
            </field>
   </record>
</data>

</openerp>

아바타
취소
베스트 답변

Remove this things in your inherited class

 _name = "purchase.order"

Add purchase in custom module __openerp__.py file

'depends': ['purchase'],

Restart your OpenERP serevr and update or install your custom module in your database.

Hope it works !!

Thanks,

dsouzajoseph199@gmail.com

아바타
취소
베스트 답변

did you stop/ start your server?

did you make your module depend on purchase?

try these two things and see if that fixes it.

아바타
취소
작성자

yes it depend on purchase... but don't function

did you completely stop/ start your server? Stop the server then type ps aux | grep openerp or look at your process list in windows to make sure you have stopped all instances of the server.

관련 게시물 답글 화면 활동
3
7월 18
4230
0
1월 22
3019
1
7월 15
4071
0
3월 15
5432
3
12월 22
4854