-
-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] sale_order_recalculate_prices: Module to allow to recalculate o…
…n demand sale order line prices
- Loading branch information
1 parent
49a9181
commit 3a5e5e8
Showing
8 changed files
with
214 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,8 @@ | ||
Recalculation of sale order lines prices on demand | ||
================================================== | ||
|
||
This module adds a button on sale orders below pricelist that recalculates the | ||
prices of the order lines that contain a product in them. | ||
|
||
It is launched manually as a button to get the user decide if he/she wants to | ||
recalculate prices when pricelist is changed. |
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,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# # | ||
# OpenERP, Open Source Management Solution. # | ||
# # | ||
# @author Carlos Sánchez Cifuentes <csanchez@grupovermon.com> # | ||
# # | ||
# 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 . import models |
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,43 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# # | ||
# OpenERP, Open Source Management Solution. # | ||
# # | ||
# @author Carlos Sánchez Cifuentes <csanchez@grupovermon.com> # | ||
# # | ||
# 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": "Sale Order Recalculate Prices", | ||
"version": "1.0", | ||
"depends": [ | ||
"sale", | ||
], | ||
"author": "OdooMRP team", | ||
"contributors": [ | ||
"Carlos Sánchez Cifuentes <csanchez@grupovermon.com>", | ||
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>", | ||
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>", | ||
"Ana Juaristi <ajuaristio@gmail.com>", | ||
], | ||
"category": "Sales Management", | ||
"website": "http://www.odoomrp.com", | ||
"summary": "", | ||
"data": [ | ||
"views/sale_order_view.xml", | ||
], | ||
"installable": True, | ||
} |
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,29 @@ | ||
# Translation of OpenERP Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_recalculate_prices | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: OpenERP Server 7.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2014-08-05 13:14+0000\n" | ||
"PO-Revision-Date: 2014-08-05 13:14+0000\n" | ||
"Last-Translator: Carlos Sánchez Cifuentes <csanchez@grupovermon.com>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: sale_order_recalculate_prices | ||
#: view:sale.order:0 | ||
msgid "(Recalculate prices)" | ||
msgstr "(Recalcular precios)" | ||
|
||
#. module: sale_order_recalculate_prices | ||
#: code:_description:0 | ||
#: model:ir.model,name:sale_order_recalculate_prices.model_sale_order | ||
#, python-format | ||
msgid "Sales Order" | ||
msgstr "Pedido de venta" | ||
|
29 changes: 29 additions & 0 deletions
29
sale_order_recalculate_prices/i18n/sale_order_recalculate_prices.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,29 @@ | ||
# Translation of OpenERP Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_recalculate_prices | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: OpenERP Server 7.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2014-08-05 13:14+0000\n" | ||
"PO-Revision-Date: 2014-08-05 13:14+0000\n" | ||
"Last-Translator: Carlos Sánchez Cifuentes <csanchez@grupovermon.com>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: sale_order_recalculate_prices | ||
#: view:sale.order:0 | ||
msgid "(Recalculate prices)" | ||
msgstr "" | ||
|
||
#. module: sale_order_recalculate_prices | ||
#: code:_description:0 | ||
#: model:ir.model,name:sale_order_recalculate_prices.model_sale_order | ||
#, python-format | ||
msgid "Sales Order" | ||
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,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# # | ||
# OpenERP, Open Source Management Solution. # | ||
# # | ||
# @author Carlos Sánchez Cifuentes <csanchez@grupovermon.com> # | ||
# # | ||
# 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 . import sale_order |
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,42 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# # | ||
# OpenERP, Open Source Management Solution. # | ||
# # | ||
# @author Carlos Sánchez Cifuentes <csanchez@grupovermon.com> # | ||
# # | ||
# 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, api | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = 'sale.order' | ||
|
||
@api.multi | ||
def recalculate_prices(self): | ||
for record in self: | ||
if record.order_line: | ||
for line in record.order_line: | ||
res = line.product_id_change( | ||
record.pricelist_id.id, line.product_id.id, | ||
line.product_uom_qty, False, line.product_uos_qty, | ||
False, line.name, record.partner_id.id, False, | ||
True, record.date_order, False, | ||
record.fiscal_position.id, False, | ||
context=self.env.context) | ||
line.write(res['value']) | ||
return True |
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<record id="sorp_view_order_form" model="ir.ui.view"> | ||
<field name="name">sale.order.form</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="pricelist_id" position="after"> | ||
<button name="recalculate_prices" string="(Recalculate prices)" type="object" colspan="4" class="oe_link"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |