-
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from grap/8.0_account_invoice_pricelist
[8.0][ADD] account invoice pricelist
- Loading branch information
Showing
11 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
===================== | ||
Pricelist on Invoices | ||
===================== | ||
|
||
* Add a stored field pricelist on invoices, related to the partner pricelist; | ||
* Possibility to group by pricelist on account.invoice view; | ||
|
||
.. image:: static/src/description/screenshot_group_by.png | ||
|
||
|
||
This module doesn't add real feature by it self for end-users, but is useful | ||
to do reporting, in a inherited module. | ||
|
||
Installation | ||
============ | ||
|
||
Nothing special. | ||
|
||
Configuration | ||
============= | ||
|
||
Nothing to do. | ||
|
||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
* go to ... | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/95/8.0 | ||
|
||
For further information, please visit: | ||
|
||
* https://www.odoo.com/forum/help-1 | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* When changing the pricelist, give the possibility to recompute prices; | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback | ||
`here <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_pricelist%0Aversion:%208.0.1.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
from . import model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Account - Pricelist on Invoices for Odoo | ||
# Copyright (C) 2015-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
{ | ||
'name': 'Account - Pricelist on Invoices', | ||
'version': '8.0.1.0.0', | ||
'summary': 'Add partner pricelist on invoices', | ||
'category': 'Accounting & Finance', | ||
'author': 'GRAP,Odoo Community Association (OCA)', | ||
'website': 'http://www.grap.coop', | ||
'license': 'AGPL-3', | ||
'depends': [ | ||
'account', | ||
], | ||
'data': [ | ||
'view/view.xml', | ||
], | ||
'demo': [ | ||
'demo/res_groups.yml', | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Account - Price List on Invoice for Odoo | ||
# Copyright (C) 2015-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
- !record {model: res.groups, id: base.group_no_one}: | ||
users: | ||
- base.user_root | ||
|
||
- !record {model: res.groups, id: product.group_sale_pricelist}: | ||
users: | ||
- base.user_root | ||
|
||
- !record {model: res.groups, id: product.group_purchase_pricelist}: | ||
users: | ||
- base.user_root | ||
|
||
|
||
|
45 changes: 45 additions & 0 deletions
45
account_invoice_pricelist/l10n/account_invoice_pricelist.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_invoice_pricelist | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-08-31 10:03+0000\n" | ||
"PO-Revision-Date: 2015-08-31 10:03+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_invoice_pricelist | ||
#: code:addons/account_invoice_pricelist/model/account_invoice.py:68 | ||
#, python-format | ||
msgid "Can not compute Pricelist for invoices with type '%s' because 'purchase' module is not installed." | ||
msgstr "" | ||
|
||
#. module: account_invoice_pricelist | ||
#: code:addons/account_invoice_pricelist/model/account_invoice.py:73 | ||
#, python-format | ||
msgid "Can not compute Pricelist for invoices with type '%s'." | ||
msgstr "" | ||
|
||
#. module: account_invoice_pricelist | ||
#: model:ir.model,name:account_invoice_pricelist.model_account_invoice | ||
msgid "Invoice" | ||
msgstr "" | ||
|
||
#. module: account_invoice_pricelist | ||
#: view:account.invoice:account_invoice_pricelist.view_account_invoice_search | ||
#: field:account.invoice,pricelist_id:0 | ||
msgid "Pricelist" | ||
msgstr "" | ||
|
||
#. module: account_invoice_pricelist | ||
#: help:account.invoice,pricelist_id:0 | ||
msgid "The pricelist of the partner, when the invoice is created or the partner has changed. This is a technical field used to reporting." | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_invoice_pricelist | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-08-31 10:04+0000\n" | ||
"PO-Revision-Date: 2015-08-31 10:04+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_invoice_pricelist | ||
#: code:addons/account_invoice_pricelist/model/account_invoice.py:68 | ||
#, python-format | ||
msgid "Can not compute Pricelist for invoices with type '%s' because 'purchase' module is not installed." | ||
msgstr "Impossible de calculer la liste de prix pour des factures de type '%s' car le module 'achat' n'est pas installé." | ||
|
||
#. module: account_invoice_pricelist | ||
#: code:addons/account_invoice_pricelist/model/account_invoice.py:73 | ||
#, python-format | ||
msgid "Can not compute Pricelist for invoices with type '%s'." | ||
msgstr "Impossible de calculer la liste de prix pour des factures de type '%s'." | ||
|
||
#. module: account_invoice_pricelist | ||
#: model:ir.model,name:account_invoice_pricelist.model_account_invoice | ||
msgid "Invoice" | ||
msgstr "Facture" | ||
|
||
#. module: account_invoice_pricelist | ||
#: view:account.invoice:account_invoice_pricelist.view_account_invoice_search | ||
#: field:account.invoice,pricelist_id:0 | ||
msgid "Pricelist" | ||
msgstr "Liste de prix" | ||
|
||
#. module: account_invoice_pricelist | ||
#: help:account.invoice,pricelist_id:0 | ||
msgid "The pricelist of the partner, when the invoice is created or the partner has changed. This is a technical field used to reporting." | ||
msgstr "La liste de prix du partenaire, quand la facture est créé ou que le partenaire change. Il s'agit d'un champ technique utilisé pour faire des reporting." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
from . import account_invoice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Account - Pricelist on Invoices for Odoo | ||
# Copyright (C) 2015-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from openerp import models, fields, api | ||
|
||
|
||
class AccountInvoice(models.Model): | ||
_inherit = 'account.invoice' | ||
|
||
# Column Section | ||
pricelist_id = fields.Many2one( | ||
comodel_name='product.pricelist', string='Pricelist', | ||
help="The pricelist of the partner, when the invoice is created" | ||
" or the partner has changed. This is a technical field used" | ||
" for reporting.") | ||
|
||
@api.multi | ||
def onchange_partner_id( | ||
self, type, partner_id, date_invoice=False, payment_term=False, | ||
partner_bank_id=False, company_id=False): | ||
partner_obj = self.env['res.partner'] | ||
res = super(AccountInvoice, self).onchange_partner_id( | ||
type, partner_id, date_invoice=date_invoice, | ||
payment_term=payment_term, partner_bank_id=partner_bank_id, | ||
company_id=company_id) | ||
pricelist_id = False | ||
if partner_id: | ||
partner = partner_obj.browse(partner_id) | ||
if type in ('out_invoice', 'out_refund'): | ||
# Customer Invoices | ||
pricelist_id = partner.property_product_pricelist.id | ||
elif type in ('in_invoice', 'in_refund'): | ||
# Supplier Invoices | ||
if partner._model._columns.get( | ||
'property_product_pricelist_purchase', False): | ||
pricelist_id =\ | ||
partner.property_product_pricelist_purchase.id | ||
res['value']['pricelist_id'] = pricelist_id | ||
return res |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.3 KB
account_invoice_pricelist/static/src/description/screenshot_group_by.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- ********************************************************************** --> | ||
<!-- Account - Price List on Invoice for Odoo --> | ||
<!-- Copyright (C) 2015- Today GRAP (http://www.grap.coop) --> | ||
<!-- @author Sylvain LE GAL (https://twitter.com/legalsylvain) --> | ||
|
||
<!--This program is free software: you can redistribute it and/or modify --> | ||
<!--it under the terms of the GNU Affero General Public License as --> | ||
<!--published by the Free Software Foundation, either version 3 of the --> | ||
<!--License, or (at your option) any later version. --> | ||
|
||
<!--This program is distributed in the hope that it will be useful, --> | ||
<!--but WITHOUT ANY WARRANTY; without even the implied warranty of --> | ||
<!--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --> | ||
<!--GNU Affero General Public License for more details. --> | ||
|
||
<!--You should have received a copy of the GNU Affero General Public License--> | ||
<!--along with this program. If not, see <http://www.gnu.org/licenses/>. --> | ||
<!-- ********************************************************************** --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<!-- Model: account.invoice --> | ||
<record id="view_account_invoice_customer_form" model="ir.ui.view"> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="user_id" position="after"> | ||
<field name="pricelist_id"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record id="view_account_invoice_supplier_form" model="ir.ui.view"> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="user_id" position="after"> | ||
<field name="pricelist_id"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record id="view_account_invoice_search" model="ir.ui.view"> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.view_account_invoice_filter"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//filter[@string='Partner']" position="after"> | ||
<filter string="Pricelist" context="{'group_by':'pricelist_id'}"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> | ||
|
||
|