<stock_valued_picking_report> depends on stock_picking_taxes

Template inherited and translation updates

Readme changed

<stock_valued_picking_report> code formatted

Fixed README.rst

<stock_valued_picking_report> added stock_picking view

<stock_valued_picking_report> valued field outside footer group

<stock_valued_picking_report> Fixed duplicated fields in view

stock_valued_picking_report: show sale prices in picking lines if valued
This commit is contained in:
oihane
2015-04-13 12:22:57 +02:00
committed by Pedro M. Baeza
parent beb76b403b
commit c0f36ffab6
8 changed files with 185 additions and 247 deletions

View File

@@ -4,6 +4,13 @@ Valued pickings
Add amount information to picking list report and delivery order view.
You can select at partner level if picking list report must be valued or not.
Installation
============
To install this module, stock_picking_taxes is required, that it's available at:
https://github.com/odoomrp/odoomrp-wip
Credits
=======
@@ -11,3 +18,4 @@ Contributors
------------
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Antonio Espinosa <antonioea@antiun.com>
* Oihane Crucelaegui <oihane.crucelaegi@avanzosc.es>

View File

@@ -24,18 +24,10 @@
{
"name": "Valued picking list",
"version": "1.0",
"version": "8.0.0.2.0",
"author": "Serv. Tecnol. Avanzados - Pedro M. Baeza",
"website": "www.serviciosbaeza.com",
"category": "Warehouse Management",
"description": """
Valued pickings
===============
Add amount information to picking list report and delivery order view.
You can select at partner level if picking list report must be valued or not.
""",
"license": "GPL-3",
"depends": [
"base",
@@ -43,11 +35,13 @@ You can select at partner level if picking list report must be valued or not.
"stock",
"sale",
"delivery",
"stock_picking_taxes",
"web_context_tunnel"
],
"data": [
'views/res_partner_view.xml',
'views/stock_picking_view.xml',
'report/stock_valued_report.xml',
'report/stock_picking_valued_report.xml',
],
"installable": True
}

View File

@@ -1,102 +1,62 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_valued_picking
# * stock_valued_picking_report
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-29 10:48+0000\n"
"PO-Revision-Date: 2014-05-29 09:18+0000\n"
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@gmail.com>\n"
"POT-Creation-Date: 2015-04-20 10:01+0000\n"
"PO-Revision-Date: 2015-04-20 10:01+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-10-21 07:24+0000\n"
"X-Generator: Launchpad (build 17203)\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_stock_picking_out
#, python-format
msgid "Delivery Orders"
msgstr "Albaranes de salida"
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_res_partner
#, python-format
#. module: stock_valued_picking_report
#: model:ir.model,name:stock_valued_picking_report.model_res_partner
msgid "Partner"
msgstr "Empresa"
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_stock_picking
#, python-format
#. module: stock_valued_picking_report
#: model:ir.model,name:stock_valued_picking_report.model_stock_picking
msgid "Picking List"
msgstr "Albarán"
#. module: stock_valued_picking
#: field:stock.move,sale_price_subtotal:0
msgid "Price subtotal"
msgstr "Subtotal"
#. module: stock_valued_picking
#: field:stock.picking,currency_id:0
#: field:stock.picking.out,currency_id:0
msgid "Sale currency"
msgstr "Moneda de la venta"
#. module: stock_valued_picking
#: field:stock.move,sale_discount:0
msgid "Sale discount (%)"
msgstr "Descuento de la venta (%)"
#. module: stock_valued_picking
#: field:stock.move,sale_price_unit:0
msgid "Sale price unit"
msgstr "Precio unitario de la venta"
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_stock_move
#, python-format
#. module: stock_valued_picking_report
#: model:ir.model,name:stock_valued_picking_report.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de existencias"
#. module: stock_valued_picking
#: field:stock.picking,amount_tax:0
#: field:stock.picking.out,amount_tax:0
#: report:sale.shipping:0
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Subtotal"
msgstr "Subtotal"
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Taxes"
msgstr "Impuestos"
#. module: stock_valued_picking
#: field:stock.picking,amount_total:0
#: field:stock.picking.out,amount_total:0
#: report:sale.shipping:0
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Total"
msgstr "Total"
#. module: stock_valued_picking
#: field:stock.picking,amount_untaxed:0
#: field:stock.picking.out,amount_untaxed:0
#: report:sale.shipping:0
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Untaxed amount"
msgstr "Base imponible"
#. module: stock_valued_picking
#. module: stock_valued_picking_report
#: field:stock.picking,valued:0
msgid "Valued"
msgstr "Valorado"
#. module: stock_valued_picking_report
#: field:res.partner,valued_picking:0
msgid "Valued picking"
msgstr "Albarán valorado"
#. module: stock_valued_picking
#: report:sale.shipping:0
msgid "Unit price"
msgstr "Precio unitario"
#. module: stock_valued_picking
#: report:sale.shipping:0
msgid "Subtotal"
msgstr "Subtotal"

View File

@@ -1,102 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * stock_valued_picking
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-29 10:48+0000\n"
"PO-Revision-Date: 2014-04-29 12:49+0100\n"
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.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: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_stock_picking_out
#, python-format
msgid "Delivery Orders"
msgstr ""
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_res_partner
#, python-format
msgid "Partner"
msgstr ""
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_stock_picking
#, python-format
msgid "Picking List"
msgstr ""
#. module: stock_valued_picking
#: field:stock.move,sale_price_subtotal:0
msgid "Price subtotal"
msgstr ""
#. module: stock_valued_picking
#: field:stock.picking,currency_id:0
#: field:stock.picking.out,currency_id:0
msgid "Sale currency"
msgstr ""
#. module: stock_valued_picking
#: field:stock.move,sale_discount:0
msgid "Sale discount (%)"
msgstr ""
#. module: stock_valued_picking
#: field:stock.move,sale_price_unit:0
msgid "Sale price unit"
msgstr ""
#. module: stock_valued_picking
#: code:_description:0
#: model:ir.model,name:stock_valued_picking.model_stock_move
#, python-format
msgid "Stock Move"
msgstr ""
#. module: stock_valued_picking
#: field:stock.picking,amount_tax:0
#: field:stock.picking.out,amount_tax:0
#: report:sale.shipping:0
msgid "Taxes"
msgstr ""
#. module: stock_valued_picking
#: field:stock.picking,amount_total:0
#: field:stock.picking.out,amount_total:0
#: report:sale.shipping:0
msgid "Total"
msgstr ""
#. module: stock_valued_picking
#: field:stock.picking,amount_untaxed:0
#: field:stock.picking.out,amount_untaxed:0
#: report:sale.shipping:0
msgid "Untaxed amount"
msgstr ""
#. module: stock_valued_picking
#: field:res.partner,valued_picking:0
msgid "Valued picking"
msgstr ""
#. module: stock_valued_picking
#: report:sale.shipping:0
msgid "Unit price"
msgstr ""
#. module: stock_valued_picking
#: report:sale.shipping:0
msgid "Subtotal"
msgstr ""

View File

@@ -0,0 +1,62 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_valued_picking_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-20 10:00+0000\n"
"PO-Revision-Date: 2015-04-20 10:00+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: stock_valued_picking_report
#: model:ir.model,name:stock_valued_picking_report.model_res_partner
msgid "Partner"
msgstr ""
#. module: stock_valued_picking_report
#: model:ir.model,name:stock_valued_picking_report.model_stock_picking
msgid "Picking List"
msgstr ""
#. module: stock_valued_picking_report
#: model:ir.model,name:stock_valued_picking_report.model_stock_move
msgid "Stock Move"
msgstr ""
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Subtotal"
msgstr ""
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Taxes"
msgstr ""
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Total"
msgstr ""
#. module: stock_valued_picking_report
#: view:website:stock.report_picking
msgid "Untaxed amount"
msgstr ""
#. module: stock_valued_picking_report
#: field:stock.picking,valued:0
msgid "Valued"
msgstr ""
#. module: stock_valued_picking_report
#: field:res.partner,valued_picking:0
msgid "Valued picking"
msgstr ""

View File

@@ -21,8 +21,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import fields, models, api
from openerp.addons.decimal_precision import decimal_precision as dp
from openerp import fields, models
class StockPicking(models.Model):
@@ -31,46 +31,3 @@ class StockPicking(models.Model):
valued = fields.Boolean(
string='Valued', related='partner_id.valued_picking', store=True,
readonly=True)
currency_id = fields.Many2one(
string='Sale currency', related='sale_id.currency_id', store=True,
readonly=True)
amount_untaxed = fields.Float(
string='Untaxed amount', compute='_compute_amounts',
digits=dp.get_precision('Account'), store=True, readonly=True)
amount_tax = fields.Float(
string='Taxes', compute='_compute_amounts',
digits=dp.get_precision('Account'), store=True, readonly=True)
amount_total = fields.Float(
string='Total', compute='_compute_amounts',
digits=dp.get_precision('Account'), store=True, readonly=True)
@api.one
@api.depends(
'move_lines.sale_price_subtotal',
'move_lines.product_id',
'move_lines.procurement_id.sale_line_id.tax_id',
'move_lines.procurement_id.sale_line_id.order_id.partner_id',
)
def _compute_amounts(self):
# Calculate untaxed amount
untaxed = 0.0
for move in self.move_lines:
untaxed += move.sale_price_subtotal
# Calculate taxed amount
tax = 0.0
for move in self.move_lines:
if not (move.procurement_id and
move.procurement_id.sale_line_id):
continue
sale_line = move.procurement_id.sale_line_id
for c in sale_line.tax_id.compute_all(
move.sale_price_subtotal, move.product_qty,
move.product_id, sale_line.order_id.partner_id)['taxes']:
tax += c.get('amount', 0.0)
currency = self.currency_id
if currency:
tax = currency.round(tax)
# Write calculated amounts into recorrd
self.amount_untaxed = untaxed
self.amount_tax = tax
self.amount_total = untaxed + tax

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="valued_report_picking" inherit_id="stock.report_picking">
<xpath expr="//table[@t-if='not o.pack_operation_ids']//strong[.='Destination']/../.."
position="after">
<t t-if="o.partner_id.valued_picking">
<th><strong>Unit Price</strong></th>
<th groups="sale.group_discount_per_so_line">
<strong>Discount</strong>
</th>
<th><strong>Subtotal</strong></th>
</t>
</xpath>
<xpath expr="//span[@t-field='move.location_dest_id']/../.." position="after">
<t t-if="o.partner_id.valued_picking">
<td><span t-field="move.sale_price_unit" /></td>
<td groups="sale.group_discount_per_so_line">
<span t-field="move.sale_discount" />
</td>
<td><span t-field="move.sale_price_subtotal" /></td>
</t>
</xpath>
<xpath expr="//table[@t-if='o.pack_operation_ids']" position="after">
<br />
<br />
<table>
<tr>
<td>Untaxed amount</td>
<td><span t-field="o.amount_untaxed" /></td>
</tr>
<tr>
<td>Taxes</td>
<td><span t-field="o.amount_tax" />
<table>
<tr t-foreach="o.taxes" t-as="tax">
<td><span t-field="tax.name" /></td>
<td><span t-field="tax.amount" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Total</td>
<td><span t-field="o.amount_total" /></td>
</tr>
</table>
</xpath>
</template>
</data>
</openerp>

View File

@@ -2,31 +2,39 @@
<openerp>
<data>
<record model="ir.ui.view" id="view_move_picking_tree">
<field name="name">stock.move.tree</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_picking_tree" />
<field name="arch" type="xml">
<field name="location_id" position="before">
<field name="sale_price_unit" invisible="not context.get('show_valued')"/>
<field name="sale_discount" invisible="not context.get('show_valued')" groups="sale.group_discount_per_so_line"/>
<field name="sale_price_subtotal" invisible="not context.get('show_valued')"/>
</field>
</field>
</record>
<!-- Inherited from : /addons/stock/stock_view.xml -->
<record model="ir.ui.view" id="view_picking_form_valued">
<field name="name">Valued Stock Picking</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="inherit_id" ref="stock_picking_taxes.view_picking_form"/>
<field name="arch" type="xml">
<field name="move_lines" position="after">
<group class="oe_subtotal_footer oe_right"
attrs="{'invisible': ['|', ('sale_id', '=', False),
('valued', '=', False)]}">
<field name="sale_id" invisible="1"/>
<field name="valued" invisible="1"/>
<field name="amount_untaxed"
widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<field name="amount_tax"
widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<field name="amount_total"
class="oe_subtotal_footer_separator"
widget="monetary"
options="{'currency_field': 'currency_id'}"/>
</group>
<div class="oe_clear"/>
<field name="move_lines" position="attributes">
<attribute name="context_valued">{'show_valued': bool(sale_id) and valued}</attribute>
</field>
<group name="subtotal_footer" position="before">
<group class="oe_subtotal_footer oe_right" name="valued_info">
<field name="valued" invisible="1"/>
</group>
</group>
<group name="subtotal_footer" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('sale_id', '=', False),('valued', '=', False)]}</attribute>
</group>
<page string="Taxes" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('sale_id', '=', False),('valued', '=', False)]}</attribute>
</page>
</field>
</record>