mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[IMP] stock_valued_picking_report: Tests and comments
This commit is contained in:
@@ -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 <antonio.espinosa@tecnativa.com>
|
||||
* Oihane Crucelaegui <oihane.crucelaegi@avanzosc.es>
|
||||
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||
|
||||
* David Vidal <david.vidal@tecnativa.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Copyright 2014 Pedro M. Baeza - Tecnativa <pedro.baeza@tecnativa.com>
|
||||
# Copyright 2015 Antonio Espinosa - Tecnativa <antonio.espinosa@tecnativa.com>
|
||||
# Copyright 2016 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
|
||||
# Copyright 2017 David Vidal - Tecnativa <david.vidal@tecnativa.com>
|
||||
# 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,
|
||||
}
|
||||
|
||||
@@ -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 <carlos.dauden@tecnativa.com>\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 "<strong>Total</strong>"
|
||||
#. module: stock_valued_picking_report
|
||||
#: model:ir.ui.view,arch_db:stock_valued_picking_report.valued_report_picking
|
||||
msgid "<strong>Unit Price</strong>"
|
||||
msgstr "<strong>Precio</strong>"
|
||||
msgstr "<strong>Precio Unidad</strong>"
|
||||
|
||||
#. 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"
|
||||
|
||||
@@ -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',
|
||||
)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="valued_report_picking" inherit_id="stock.report_delivery_document">
|
||||
<xpath expr="//table[@t-if='o.pack_operation_ids']/thead/tr"
|
||||
position="inside">
|
||||
<t t-if="o.valued and o.sale_id">
|
||||
<t t-if="o.valued and o.sale_id and o.pack_operation_ids">
|
||||
<th class="text-right"><strong>Unit Price</strong></th>
|
||||
<th class="text-right" groups="sale.group_discount_per_so_line">
|
||||
<strong>Discount</strong>
|
||||
@@ -23,8 +24,8 @@
|
||||
</t>
|
||||
</xpath>
|
||||
<xpath expr="//table[@t-if='o.pack_operation_ids']" position="after">
|
||||
<t t-if="o.valued and o.sale_id">
|
||||
<table class="table table-condensed table-bordered mt32">
|
||||
<t t-if="o.valued and o.sale_id and o.pack_operation_ids">
|
||||
<table class="table table-condensed mt32">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-right"><strong>Untaxed Amount</strong></th>
|
||||
@@ -49,4 +50,5 @@
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
||||
3
stock_valued_picking_report/tests/__init__.py
Normal file
3
stock_valued_picking_report/tests/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import test_stock_picking_valued
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user