Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How i can add a new state to PO?

Naroči se

Get notified when there's activity on this post

This question has been flagged
inheritanceinheritstate
2 Odgovori
6911 Prikazi
Avatar
mirko lazzarini

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>

0
Avatar
Opusti
Avatar
joseph d'souza
Best Answer

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

0
Avatar
Opusti
Avatar
AJ Schrafel Paper Corp
Best Answer

did you stop/ start your server?

did you make your module depend on purchase?

try these two things and see if that fixes it.

0
Avatar
Opusti
mirko lazzarini
Avtor

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

AJ Schrafel Paper Corp

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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
How to extend an existing class and include social newtork features in the sub class
inheritance inherit
Avatar
Avatar
3
jul. 18
4628
Inheritance in discuss module (mail)
inheritance inherit discuss
Avatar
0
jan. 22
3372
How to create tree view of sibling models ? Solved
treeview inheritance inherit
Avatar
1
jul. 15
4506
Change sale module view, treestrings, names, button names
inheritance inherit sale.order
Avatar
0
mar. 15
5811
Calling two models in one model Solved
inheritance models multiple inherit
Avatar
Avatar
3
dec. 22
5225
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now