Skip to content

Commit

Permalink
Merge pull request #221 from incaser/sale_packaging_price
Browse files Browse the repository at this point in the history
[ADD] sale_packaging_price: New module to assign a package price.
  • Loading branch information
rafaelbn committed Dec 21, 2015
2 parents 17c5c09 + 473b536 commit 4e078a5
Show file tree
Hide file tree
Showing 16 changed files with 686 additions and 0 deletions.
78 changes: 78 additions & 0 deletions sale_packaging_price/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. 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

====================
Sale Packaging Price
====================

This module was written to extends the functionality of sale workflow
and allow you to assign a selling price of a complete package.
This price is split for having the price unit according the number of pieces
that fits in that packaging, so there can be rounding issues to get the exact
price that are warned if happens.

Configuration
=============

To configure this module, you need to:

* go to warehouse config and check 'Use packages: pallets, boxes, ...' and
'Allow to define several packaging methods on products'

Usage
=====

To use this module, you need to:

* go to product and into inventory tab you can add new packages with a
sale price

* This module also adds a new entry into product menu called 'Packaging' to
add quickly combinations packages

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/167/8.0

For further information, please visit:

* https://www.odoo.com/forum/help-1

Known issues / Roadmap
======================


Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale_workflow/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/sale_workflow/issues/new?body=module:%20sale_packaging_price%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Contributors
------------

* Rafael Blasco <rafabn@antiun.com>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Carlos Dauden <carlos@incaser.es>
* Sergio Teruel <sergio@incaser.es>

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.
7 changes: 7 additions & 0 deletions sale_packaging_price/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import models
from . import report
22 changes: 22 additions & 0 deletions sale_packaging_price/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
'name': "Sale Packaging Price",
'category': 'Sales Management',
'version': '8.0.1.0.0',
'depends': ['sale_stock'],
'data': [
'views/product_view.xml',
'views/sale_stock_view.xml',
'views/sale_packaging_price_menu.xml',
],
'author': 'Antiun Ingeniería S.L., '
'Incaser Informatica S.L., '
'Odoo Community Association (OCA)',
'website': 'http://www.incaser.es',
'license': 'AGPL-3',
'installable': True,
}
116 changes: 116 additions & 0 deletions sale_packaging_price/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_packaging_price
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-13 08:28+0000\n"
"PO-Revision-Date: 2015-11-13 09:30+0100\n"
"Last-Translator: Carlos Incaser <carlos@incaser.es>\n"
"Language-Team: \n"
"Language: es-ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.4\n"

#. module: sale_packaging_price
#: model:ir.actions.act_window,help:sale_packaging_price.action_product_packaging_form
msgid ""
"<p class=\"oe_view_nocontent_create\">\n"
" Click to add a packaging for your products.\n"
" </p>\n"
" "
msgstr "Pinche aquí crear empaquetados de productos"

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Group By..."
msgstr "Agrupar por..."

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Logistic Unit"
msgstr "Unidad logística"

#. module: sale_packaging_price
#: field:product.packaging,list_price:0
#: view:sale.order:sale_packaging_price.view_order_form_inherit
msgid "Package Price"
msgstr "Precio paquete"

#. module: sale_packaging_price
#: view:sale.order:sale_packaging_price.view_order_form_inherit
#: field:sale.order.line,packaging_weight:0
msgid "Package Weight"
msgstr "Peso empaquetado"

#. module: sale_packaging_price
#: model:ir.model,name:sale_packaging_price.model_product_packaging
msgid "Packaging"
msgstr "Empaquetado"

#. module: sale_packaging_price
#: code:addons/sale_packaging_price/models/product.py:31
#, python-format
msgid "Problem with price"
msgstr "Problema con el precio"

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Product"
msgstr "Producto"

#. module: sale_packaging_price
#: field:sale.report,product_packaging:0
msgid "Product Package"
msgstr "Empaquetado"

#. module: sale_packaging_price
#: model:ir.actions.act_window,name:sale_packaging_price.action_product_packaging_form
#: model:ir.ui.menu,name:sale_packaging_price.menu_product_packaging_action
#: model:ir.ui.menu,name:sale_packaging_price.menu_product_packaging_wh_action
msgid "Product Packaging"
msgstr "Empaquetado"

#. module: sale_packaging_price
#: field:sale.report,qty_packaging:0
msgid "Qty Package"
msgstr "Núm. paquetes"

#. module: sale_packaging_price
#: model:ir.model,name:sale_packaging_price.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea pedido de venta"

#. module: sale_packaging_price
#: model:ir.model,name:sale_packaging_price.model_sale_report
msgid "Sales Orders Statistics"
msgstr "Estadísticas pedidos de venta"

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Search Product Packaging"
msgstr "Buscar empaquetado"

#. module: sale_packaging_price
#: help:product.packaging,list_price:0
msgid "This price will be considered as a price for complete package"
msgstr "Este precio sera considerado como precio para el paquete completo"

#. module: sale_packaging_price
#: code:addons/sale_packaging_price/models/product.py:32
#, python-format
msgid ""
"With the current decimal precision, you can't get this price. (Approx. price "
"suggested: %s)"
msgstr ""
"Con la precisión decimal actual no puedes obtener este precio. (Precio "
"sugerido aproximado: %s)"

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_tree_inherit
msgid "top"
msgstr "Arriba"
111 changes: 111 additions & 0 deletions sale_packaging_price/i18n/sale_packaging_price.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_packaging_price
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-13 08:28+0000\n"
"PO-Revision-Date: 2015-11-13 08:28+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: sale_packaging_price
#: model:ir.actions.act_window,help:sale_packaging_price.action_product_packaging_form
msgid "<p class=\"oe_view_nocontent_create\">\n"
" Click to add a packaging for your products.\n"
" </p>\n"
" "
msgstr ""

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Group By..."
msgstr ""

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Logistic Unit"
msgstr ""

#. module: sale_packaging_price
#: field:product.packaging,list_price:0
#: view:sale.order:sale_packaging_price.view_order_form_inherit
msgid "Package Price"
msgstr ""

#. module: sale_packaging_price
#: view:sale.order:sale_packaging_price.view_order_form_inherit
#: field:sale.order.line,packaging_weight:0
msgid "Package Weight"
msgstr ""

#. module: sale_packaging_price
#: model:ir.model,name:sale_packaging_price.model_product_packaging
msgid "Packaging"
msgstr ""

#. module: sale_packaging_price
#: code:addons/sale_packaging_price/models/product.py:31
#, python-format
msgid "Problem with price"
msgstr ""

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Product"
msgstr ""

#. module: sale_packaging_price
#: field:sale.report,product_packaging:0
msgid "Product Package"
msgstr ""

#. module: sale_packaging_price
#: model:ir.actions.act_window,name:sale_packaging_price.action_product_packaging_form
#: model:ir.ui.menu,name:sale_packaging_price.menu_product_packaging_action
#: model:ir.ui.menu,name:sale_packaging_price.menu_product_packaging_wh_action
msgid "Product Packaging"
msgstr ""

#. module: sale_packaging_price
#: field:sale.report,qty_packaging:0
msgid "Qty Package"
msgstr ""

#. module: sale_packaging_price
#: model:ir.model,name:sale_packaging_price.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_packaging_price
#: model:ir.model,name:sale_packaging_price.model_sale_report
msgid "Sales Orders Statistics"
msgstr ""

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_filter
msgid "Search Product Packaging"
msgstr ""

#. module: sale_packaging_price
#: help:product.packaging,list_price:0
msgid "This price will be considered as a price for complete package"
msgstr ""

#. module: sale_packaging_price
#: code:addons/sale_packaging_price/models/product.py:32
#, python-format
msgid "With the current decimal precision, you can't get this price. (Approx. price suggested: %s)"
msgstr ""

#. module: sale_packaging_price
#: view:product.packaging:sale_packaging_price.product_packaging_tree_inherit
msgid "top"
msgstr ""

7 changes: 7 additions & 0 deletions sale_packaging_price/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import product
from . import sale_order
37 changes: 37 additions & 0 deletions sale_packaging_price/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import api, fields, models, _
from openerp.addons.decimal_precision import decimal_precision as dp


class ProductPackaging(models.Model):
_inherit = 'product.packaging'

list_price = fields.Float(
string='Package Price',
digits_compute=dp.get_precision('Product Price'),
help="This price will be considered as a price for complete package")

@api.onchange('list_price', 'qty')
def _onchange_list_price(self):
price_precision = self.env['decimal.precision'].precision_get(
'Product Price')
if self.qty:
price_computed = (
round(self.list_price / self.qty, price_precision) *
self.qty)
else:
price_computed = 0.0
if str(self.list_price) != str(price_computed):
return {
'warning': {
'title': _('Problem with price'),
'message': _(
"With the current decimal precision, you can't get "
"this price. (Approx. price suggested: %s)"
) % str(price_computed)
}
}
Loading

0 comments on commit 4e078a5

Please sign in to comment.