Odoo Help


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.


Check Pricelist on Invoice module

Paulo Matos‏
on 11/14/14, 3:31 PM 1,051 views

Hi all,
Core Odoo v7 does not support pricelists for invoices. The pricelist is just used on sales orders.

My problem is that we often make direct invoices without using the sales order.

There is a module on apps.odoo.com, named "account_invoice_change_prices".
This module adds a button on the Invoice form that allows us to apply the price for each product line based on the partner pricelist.

This is a solution but it raised another problem. Often users forget to click the "Check Prices" button.

The module uses basically 2 main files.

The account_invoice.py has only one class:

class account_invoice(osv.osv):
    _inherit = 'account.invoice'

    def action_check_prices(self, cr, uid, ids, context=None):
        _sale_orders = self.pool.get('sale.order').search(cr, uid, [('invoice_ids','=',ids[0])])
        if len(_sale_orders) == 0:
            _change = False
            for _invoice in self.browse(cr, uid, ids, context):
                _partner = _invoice.partner_id
                _pricelist = _partner.property_product_pricelist and _partner.property_product_pricelist.id or False
                if _pricelist:
                    for _line in _invoice.invoice_line:
                        _price = self.pool.get('product.pricelist').price_get(cr, uid, [_pricelist],
                                 _line.product_id.id, _line.quantity or 1.0, _partner.id, {
                                     'uom': _line.uos_id.id or result.get('product_uos'),
                                     'date': _invoice.date_invoice,
                        if _price and _price != _line.price_unit:
                            _change = True
                            _line.write({'price_unit': _price,
                                         'price_subtotal': False})
            if _change:
                self.button_reset_taxes(cr, uid, ids, context)
        return True

The account_invoice_view.xml only 1 "record":

        <record id="invoice_check_form" model="ir.ui.view">
            <field name="name">account.invoice.check.form</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_form"/>
            <field name="arch" type="xml">
                <button name="invoice_open" position="before">
                    <button name="action_check_prices" states="draft" string="Check Prices" type="object" groups="base.group_user"/>

Can anyone help me on changing this files/codes in order to automatically add the correct price (based on partner pricelist) on each added product line to the invoice?
This way, everytime a user adds a product to the invoice, the system will add it with the correct price without having to click the "Check Prices" button.

Thank you very much




Hi Paulo, I have partner specific price module for v8. We can customize it the way you want. For any queries: akhil.p.sivan007@gmail.com

Akhil P Sivan
on 1/13/15, 12:52 AM

Do you have some free development for this problem?

Pascal Tremblay
on 4/6/15, 10:06 PM

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

2 follower(s)


Asked: 11/14/14, 3:31 PM
Seen: 1051 times
Last updated: 4/6/15, 10:06 PM