diff --git a/stock_valued_picking_report/README.rst b/stock_valued_picking_report/README.rst index a58704d..491d490 100644 --- a/stock_valued_picking_report/README.rst +++ b/stock_valued_picking_report/README.rst @@ -9,24 +9,32 @@ Stock Valued Picking Report Add amount information to Delivery Slip report. You can select at partner level if picking list report must be valued or not. +Configuration +============= + +#. Go to *Customers > (select one of your choice) > Sales & Purchases*. +#. Set *Valued picking* field on. Usage ===== -To use this module, you need: +To get the stock picking valued report: -#. Go to Customers -#. Set valued field -#. Create a Sale Order with stockable products -#. Confirm Sale Order -#. Click Deliveries button -#. Go to Print > Delivery Slip +#. Create a Sale Order with stockable products a *Valued picking* able + customer. +#. Confirm the Sale Order. +#. Click on *Deliveries* stat button. +#. Go to *Print > Delivery Slip*. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/151/9.0 +Known issues / Roadmap +====================== + +* If the picking is not reserved, values aren't computed. Bug Tracker =========== @@ -51,7 +59,7 @@ Contributors * Antonio Espinosa * Oihane Crucelaegui * Carlos Dauden - +* David Vidal Maintainer ---------- diff --git a/stock_valued_picking_report/__openerp__.py b/stock_valued_picking_report/__openerp__.py index ce1f9ab..5cee1f6 100644 --- a/stock_valued_picking_report/__openerp__.py +++ b/stock_valued_picking_report/__openerp__.py @@ -2,6 +2,7 @@ # Copyright 2014 Pedro M. Baeza - Tecnativa # Copyright 2015 Antonio Espinosa - Tecnativa # Copyright 2016 Carlos Dauden - Tecnativa +# Copyright 2017 David Vidal - Tecnativa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { @@ -23,5 +24,5 @@ 'views/res_partner_view.xml', 'report/stock_picking_valued_report.xml', ], - "installable": True + "installable": True, } diff --git a/stock_valued_picking_report/i18n/es.po b/stock_valued_picking_report/i18n/es.po index 67d4bc0..b258761 100644 --- a/stock_valued_picking_report/i18n/es.po +++ b/stock_valued_picking_report/i18n/es.po @@ -4,17 +4,17 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 9.0c\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-03-13 14:39+0100\n" -"PO-Revision-Date: 2017-03-13 14:41+0100\n" +"POT-Creation-Date: 2017-08-21 08:13+0000\n" +"PO-Revision-Date: 2017-08-21 10:13+0200\n" "Last-Translator: Carlos Dauden \n" "Language-Team: \n" -"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" +"Language: es\n" "X-Generator: Poedit 1.8.7.1\n" #. module: stock_valued_picking_report @@ -40,7 +40,7 @@ msgstr "Total" #. module: stock_valued_picking_report #: model:ir.ui.view,arch_db:stock_valued_picking_report.valued_report_picking msgid "Unit Price" -msgstr "Precio" +msgstr "Precio Unidad" #. module: stock_valued_picking_report #: model:ir.ui.view,arch_db:stock_valued_picking_report.valued_report_picking @@ -71,7 +71,7 @@ msgstr "Subtotal" #. module: stock_valued_picking_report #: model:ir.model.fields,field_description:stock_valued_picking_report.field_stock_pack_operation_sale_line msgid "Related order line" -msgstr "Linea pedido relacionada" +msgstr "Línea de pedido relacionada" #. module: stock_valued_picking_report #: model:ir.model.fields,field_description:stock_valued_picking_report.field_stock_pack_operation_sale_discount @@ -117,11 +117,18 @@ msgstr "Base imponible" msgid "Valued picking" msgstr "Albarán valorado" +#. module: stock_valued_picking_report +#: model:ir.model.fields,field_description:stock_valued_picking_report.field_stock_picking_website_message_ids +msgid "Website Messages" +msgstr "Mensajes del sitio web" + +#. module: stock_valued_picking_report +#: model:ir.model.fields,help:stock_valued_picking_report.field_stock_picking_website_message_ids +msgid "Website communication history" +msgstr "Historial de comunicaciones del sitio web" + #. module: stock_valued_picking_report #: model:ir.model.fields,help:stock_valued_picking_report.field_res_partner_valued_picking #: model:ir.model.fields,help:stock_valued_picking_report.field_stock_picking_valued msgid "You can select which partners have valued pickings" -msgstr "Puede seleccionar que empresas tienen albarán valorado" - -#~ msgid "Amount total" -#~ msgstr "Importe total" +msgstr "Puede seleccionar qué empresas tienen albarán valorado" diff --git a/stock_valued_picking_report/models/res_partner.py b/stock_valued_picking_report/models/res_partner.py index 2218d30..cb471a4 100644 --- a/stock_valued_picking_report/models/res_partner.py +++ b/stock_valued_picking_report/models/res_partner.py @@ -12,5 +12,5 @@ class ResPartner(models.Model): valued_picking = fields.Boolean( default=True, - help='You can select which partners have valued pickings' + help='You can select which partners have valued pickings', ) diff --git a/stock_valued_picking_report/models/stock_pack_operation.py b/stock_valued_picking_report/models/stock_pack_operation.py index 2bd1e34..8536327 100644 --- a/stock_valued_picking_report/models/stock_pack_operation.py +++ b/stock_valued_picking_report/models/stock_pack_operation.py @@ -12,7 +12,7 @@ class StockPackOperation(models.Model): _inherit = "stock.pack.operation" currency_id = fields.Many2one( - related='sale_line.currency_id', + related='sale_line.currency_id', readonly=True, string='Currency') sale_line = fields.Many2one( comodel_name='sale.order.line', diff --git a/stock_valued_picking_report/models/stock_picking.py b/stock_valued_picking_report/models/stock_picking.py index ed57f64..8e4333d 100644 --- a/stock_valued_picking_report/models/stock_picking.py +++ b/stock_valued_picking_report/models/stock_picking.py @@ -10,9 +10,11 @@ from openerp import api, fields, models class StockPicking(models.Model): _inherit = "stock.picking" - valued = fields.Boolean(related='partner_id.valued_picking') + valued = fields.Boolean( + related='partner_id.valued_picking', readonly=True, + ) currency_id = fields.Many2one( - related='sale_id.currency_id', + related='sale_id.currency_id', readonly=True, string='Currency') amount_untaxed = fields.Monetary( compute='_compute_amount_all', diff --git a/stock_valued_picking_report/report/stock_picking_valued_report.xml b/stock_valued_picking_report/report/stock_picking_valued_report.xml index f6fc3fe..d8d2cac 100644 --- a/stock_valued_picking_report/report/stock_picking_valued_report.xml +++ b/stock_valued_picking_report/report/stock_picking_valued_report.xml @@ -1,9 +1,10 @@ + + diff --git a/stock_valued_picking_report/tests/__init__.py b/stock_valued_picking_report/tests/__init__.py new file mode 100644 index 0000000..84e9599 --- /dev/null +++ b/stock_valued_picking_report/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_stock_picking_valued diff --git a/stock_valued_picking_report/tests/test_stock_picking_valued.py b/stock_valued_picking_report/tests/test_stock_picking_valued.py new file mode 100644 index 0000000..04a4d64 --- /dev/null +++ b/stock_valued_picking_report/tests/test_stock_picking_valued.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp.tests import common + + +class TestStockPickingValued(common.SavepointCase): + + @classmethod + def setUpClass(cls): + super(TestStockPickingValued, cls).setUpClass() + cls.tax = cls.env['account.tax'].create({ + 'name': 'TAX 15%', + 'amount_type': 'percent', + 'type_tax_use': 'sale', + 'amount': 15.0, + }) + cls.product = cls.env['product.product'].create({ + 'name': 'Test stuff', + 'list_price': 100.0, + 'taxes_id': [(6, 0, cls.tax.ids)], + }) + cls.partner = cls.env['res.partner'].create({ + 'name': 'Mr. Odoo', + }) + cls.sale_order = cls.env['sale.order'].create({ + 'partner_id': cls.partner.id, + 'order_line': [(0, 0, {'product_id': cls.product.id})], + }) + + def test_01_confirm_order(self): + self.assertTrue(self.partner.valued_picking) + self.sale_order.action_confirm() + self.assertTrue(len(self.sale_order.picking_ids)) + for picking in self.sale_order.picking_ids: + self.assertEqual(picking.amount_untaxed, 100.0) + self.assertEqual(picking.amount_tax, 15.0) + self.assertEqual(picking.amount_total, 115.0) + + def test_02_confirm_order(self): + """ Valued picking isn't computed if not reserved """ + self.sale_order.action_confirm() + for picking in self.sale_order.picking_ids: + picking.do_unreserve() + self.assertEqual(picking.amount_untaxed, 0.0) + self.assertEqual(picking.amount_tax, 0.0) + self.assertEqual(picking.amount_total, 0.0)