Skip to Content
Odoo Menu
  • Sign in
  • 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
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Discount on invoices from purchase orders

Subscribe

Get notified when there's activity on this post

This question has been flagged
invoicediscountpurchase_order
2 Replies
4878 Views
Avatar
Roberto Barreiro

I added a discount field to my purchase orders, I make my purchase invoices based on them, and I need discount passes from purchase orders to purchase invoices. I was looking for the method who reads the lines from purchase orders, and writes it on purchase invoices, but I don't find it. Anyone knows wich function make this operation? Thanks in advice.

0
Avatar
Discard
Zbik

purchase/purchase.py - method: _prepare_inv_line(self, cr, uid, account_id, order_line, context=None)

Roberto Barreiro
Author

Thanks zbik, it helps to break my mind on the next step ;)

Avatar
Roberto Barreiro
Author Best Answer

zbkik solves my problem. He said:

If your Default invoicing control method = Based on incoming shipments, you see _get_invoice_line_vals in stock_account/stock.py
 

0
Avatar
Discard
Avatar
Bole
Best Answer

if you are looking for discount on order lines.. take a look here:
https://www.odoo.com/apps/7.0/purchase_discount/

if youre looking for additional discount (on total of invoice) maybe google a bit over partners repositories ... you will find some interesting stuf...

0
Avatar
Discard
Roberto Barreiro
Author

That module is not working for 8.0, i'm doing a new module based on purchase_discount existing addon. It has this code, to do what I want, but it doesn,t work: class purchase_order(orm.Model): def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None): result = super(purchase_order, self)._prepare_inv_line(cr, uid, account_id, order_line, context) result['discount'] = order_line.discount or 0.0 return result class stock_picking(orm.Model): _inherit = 'stock.picking' def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id): if move_line.purchase_line_id: line = {'discount': move_line.purchase_line_id.discount} self.pool.get('account.invoice.line').write(cr, uid, [invoice_line_id], line) return super(stock_picking, self)._invoice_line_hook(cr, uid, move_line, invoice_line_id)

Roberto Barreiro
Author

I have new objetcs on my addon inheriting purchase.order and stock.picking, with new functions to _prepare_inv_line from purchase.order and _invoice_line_hook from stock.picking, but them seems not to be called from the invoice process, because the code I have for these methods does nothing. I put a message with raise osv.except_osv into the code, to be sure the functions are called from the make invoice process, but it isn't showed. Because of this, I think odoo 8 uses another functions to the invoice process, but I can find them.

Zbik

If your Default invoicing control method = Based on incoming shipments, you see _get_invoice_line_vals in stock_account/stock.py

Roberto Barreiro
Author

Thanks zbik, it helps to break my mind on the next step ;)

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

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

Sign up
Related Posts Replies Views Activity
Cash Discount on Customer and Supplier Invoices Solved
invoice discount
Avatar
1
Jan 23
9132
Vendor orders of the month on a single invoice Solved
invoice purchase_order
Avatar
Avatar
2
Jul 19
3428
No invoice button for partial purchase order
invoice purchase_order
Avatar
0
May 16
4136
Invoice from Purchase order
invoice purchase_order
Avatar
Avatar
2
Apr 16
6133
Discount for prepayment, how?
invoice discount
Avatar
0
Mar 15
4206
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