Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • 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 Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and 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
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to auto generate purchase order from manufacturing in odoo8?

Odoberať

Get notified when there's activity on this post

This question has been flagged
openerpodooodooV8
1 Odpoveď
5896 Zobrazenia
Avatar
bhanukiran

I want to generate a purchase order invoice from the information obtained from mrp. I want to get products from bill of materials(raw materials),price from product's cost price.Right now I have created a button for generating purchase order,it is only copying mrp invoice no and date created it is not entering the inside for loop and also I am not getting how to retrieve the current mrp id,I have hardcoded the id itself.This method is called when the button is pressed.

from openerp import models,api
class mrp_production(models.Model):
    _inherit = 'mrp.production'

    @api.multi
    def generate_purchase_order(self,supplier_id,pricelist_id,warehouse_id):
        purchase_obj = self.env['purchase.order']
        purchase_line_obj = self.env['purchase.order.line']
        warehouse_obj = self.env['stock.warehouse']

        warehouse = warehouse_obj.browse(warehouse_id)
        if not warehouse:
            return False
        if isinstance(warehouse, list):
            warehouse = warehouse[0]

        for order in self.browse(1):#how to remove this hardcoded id?
            vals = {}
            vals = purchase_obj.onchange_partner_id(supplier_id)
            vals['origin'] = order.name
            vals['partner_id'] = supplier_id
            vals['pricelist_id'] = pricelist_id
            vals['warehouse_id'] = warehouse_id
            vals['location_id'] = warehouse.lot_stock_id.id
            vals['date_order'] = order.date_planned
            purchase_id = purchase_obj.create(vals)

            for line in self.bom_id.bom_line_ids:
            #this for loop is not getting executed
                if not line.product_id:
                    continue

                line_vals = purchase_line_obj.onchange_product_id(self,pricelist_id,line.product_id.id,
                                                line.product_uom_qty, line.product_uom.id, supplier_id,
                                                date_planned=line.date_planned)['value']

                line_vals['product_id'] = line.product_id.id
                if not line_vals.get('price_unit', False):
                    line_vals['price_unit'] = line.product_id.list_price
                line_vals['product_uom'] = line.product_uom.id
                line_vals['product_uom_qty'] = 181.13
                line_vals['order_id'] = purchase_id
                purchase_line_obj.create(line_vals)

        return True

0
Avatar
Zrušiť
Avatar
Nikunj Antala
Best Answer

Hello Bhanukiran,

As per new api we can access its fields and methods from directly using self because self it self is browsable record.

Example :

class account_invoice(models.Model):

    _name = "account.invoice"

    def test_function(self):

    for invoice in self:

        print invoice.number # It will print Number of all invoices


Hope this help.

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
How to provide the read only visibility access for an employee to "Employee" menu under "Human Resources" module in Odoo8
openerp odoo odooV8
Avatar
Avatar
1
dec 16
5601
How to create a checkbox field in odoo 8? Solved
openerp odoo odooV8
Avatar
Avatar
Avatar
Avatar
Avatar
6
aug 16
29466
how to inherit field value from one module to another module?
openerp odoo odooV8
Avatar
Avatar
Avatar
4
apr 16
7815
Unable to start odoo 8 from eclipse Solved
openerp odoo odooV8
Avatar
Avatar
Avatar
6
nov 15
6073
weekly promotions OR auto mailing after a week or defined duration to customers ?
openerp odoo odooV8
Avatar
Avatar
1
mar 15
3951
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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