mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[11.0][MIG] stock_valued_picking_report
This commit is contained in:
committed by
Sergio Teruel
parent
22b3fcb9d1
commit
98e3a6c394
80
stock_picking_report_valued/README.rst
Normal file
80
stock_picking_report_valued/README.rst
Normal file
@@ -0,0 +1,80 @@
|
||||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
||||
:target: https://www.gnu.org/licenses/agpl
|
||||
:alt: License: AGPL-3
|
||||
|
||||
===========================
|
||||
Stock Picking Report Valued
|
||||
===========================
|
||||
|
||||
Add amount information to Delivery Slip report.
|
||||
You can select at partner level if picking list report must be valued or not.
|
||||
If the picking is done it's valued with quantity done, otherwise the picking
|
||||
is valued with reserved quantity.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
#. Go to *Customers > (select one of your choice) > Sales & Purchases*.
|
||||
#. Set *Valued picking* field on.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To get the stock picking valued report:
|
||||
|
||||
#. 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/11.0
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* If the picking is not reserved, values aren't computed.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/stock-logistics-reporting/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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Images
|
||||
------
|
||||
|
||||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
* Oihane Crucelaegui <oihane.crucelaegi@avanzosc.es>
|
||||
* Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||
* David Vidal <david.vidal@tecnativa.com>
|
||||
* Luis M. Ontalba <luis.martinez@tecnativa.com>
|
||||
|
||||
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 https://odoo-community.org.
|
||||
3
stock_picking_report_valued/__init__.py
Normal file
3
stock_picking_report_valued/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
26
stock_picking_report_valued/__manifest__.py
Normal file
26
stock_picking_report_valued/__manifest__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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>
|
||||
# Copyright 2017 Luis M. Ontalba - Tecnativa <luis.martinez@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Valued Picking Report",
|
||||
"summary": "Adding Valued Picking on Delivery Slip report",
|
||||
"version": "11.0.1.0.0",
|
||||
"author": "Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "https://www.tecnativa.com",
|
||||
"category": "Warehouse Management",
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
"sale_management",
|
||||
"stock",
|
||||
],
|
||||
"data": [
|
||||
'views/res_partner_view.xml',
|
||||
'report/stock_picking_report_valued.xml',
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
134
stock_picking_report_valued/i18n/es.po
Normal file
134
stock_picking_report_valued/i18n/es.po
Normal file
@@ -0,0 +1,134 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_picking_report_valued
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0c\n"
|
||||
"Report-Msgid-Bugs-To: \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"
|
||||
"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_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Discount</strong>"
|
||||
msgstr "<strong>Dto</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Subtotal</strong>"
|
||||
msgstr "<strong>Subtotal</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Taxes</strong>"
|
||||
msgstr "<strong>Impuestos</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Total</strong>"
|
||||
msgstr "<strong>Total</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Unit Price</strong>"
|
||||
msgstr "<strong>Precio Unidad</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Untaxed Amount</strong>"
|
||||
msgstr "<strong>Base imponible</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_currency_id
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Moneda"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model,name:stock_picking_report_valued.model_stock_pack_operation
|
||||
msgid "Packing Operation"
|
||||
msgstr "Operación de empaquetado"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model,name:stock_picking_report_valued.model_res_partner
|
||||
msgid "Partner"
|
||||
msgstr "Empresa"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_subtotal
|
||||
msgid "Price subtotal"
|
||||
msgstr "Subtotal"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_line
|
||||
msgid "Related order line"
|
||||
msgstr "Línea de pedido relacionada"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_discount
|
||||
msgid "Sale discount (%)"
|
||||
msgstr "Descuento venta (%)"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_unit
|
||||
msgid "Sale price unit"
|
||||
msgstr "Precio venta"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_tax_description
|
||||
msgid "Tax Description"
|
||||
msgstr "Descripción de impuesto"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_tax
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_tax_id
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_amount_tax
|
||||
msgid "Taxes"
|
||||
msgstr "Impuestos"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_total
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_amount_total
|
||||
msgid "Total"
|
||||
msgstr "Total"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model,name:stock_picking_report_valued.model_stock_picking
|
||||
msgid "Transfer"
|
||||
msgstr "Transferir"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_amount_untaxed
|
||||
msgid "Untaxed Amount"
|
||||
msgstr "Base imponible"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_res_partner_valued_picking
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_valued
|
||||
msgid "Valued picking"
|
||||
msgstr "Albarán valorado"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_website_message_ids
|
||||
msgid "Website Messages"
|
||||
msgstr "Mensajes del sitio web"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,help:stock_picking_report_valued.field_stock_picking_website_message_ids
|
||||
msgid "Website communication history"
|
||||
msgstr "Historial de comunicaciones del sitio web"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,help:stock_picking_report_valued.field_res_partner_valued_picking
|
||||
#: model:ir.model.fields,help:stock_picking_report_valued.field_stock_picking_valued
|
||||
msgid "You can select which partners have valued pickings"
|
||||
msgstr "Puede seleccionar qué empresas tienen albarán valorado"
|
||||
127
stock_picking_report_valued/i18n/hr.po
Normal file
127
stock_picking_report_valued/i18n/hr.po
Normal file
@@ -0,0 +1,127 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_picking_report_valued
|
||||
#
|
||||
# Translators:
|
||||
# Bole <bole@dajmi5.com>, 2018
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-12-01 02:22+0000\n"
|
||||
"PO-Revision-Date: 2017-12-01 02:22+0000\n"
|
||||
"Last-Translator: Bole <bole@dajmi5.com>, 2018\n"
|
||||
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: hr\n"
|
||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Discount</strong>"
|
||||
msgstr "<strong>Popust</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Subtotal</strong>"
|
||||
msgstr "<strong>Subtotal</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Taxes</strong>"
|
||||
msgstr "<strong>Porezi</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Total</strong>"
|
||||
msgstr "<strong>Total</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Unit Price</strong>"
|
||||
msgstr "<strong>Jed.cijena</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.ui.view,arch_db:stock_picking_report_valued.valued_report_picking
|
||||
msgid "<strong>Untaxed Amount</strong>"
|
||||
msgstr "<strong>Bez poreza</strong>"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_currency_id
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Valuta"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model,name:stock_picking_report_valued.model_stock_pack_operation
|
||||
msgid "Packing Operation"
|
||||
msgstr "Operacija pakiranja"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model,name:stock_picking_report_valued.model_res_partner
|
||||
msgid "Partner"
|
||||
msgstr "Partner"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_subtotal
|
||||
msgid "Price subtotal"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_line
|
||||
msgid "Related order line"
|
||||
msgstr "Povezana stavka ponude"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_discount
|
||||
msgid "Sale discount (%)"
|
||||
msgstr "Popust prodaje (%)"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_unit
|
||||
msgid "Sale price unit"
|
||||
msgstr "Prodajna cijena"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_tax_description
|
||||
msgid "Tax Description"
|
||||
msgstr "Opis poreza"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_tax
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_tax_id
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_amount_tax
|
||||
msgid "Taxes"
|
||||
msgstr "Porezi"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_pack_operation_sale_price_total
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_amount_total
|
||||
msgid "Total"
|
||||
msgstr "Ukupno"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model,name:stock_picking_report_valued.model_stock_picking
|
||||
msgid "Transfer"
|
||||
msgstr "Transfer"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_amount_untaxed
|
||||
msgid "Untaxed Amount"
|
||||
msgstr "Iznos bez poreza"
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_res_partner_valued_picking
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_res_users_valued_picking
|
||||
#: model:ir.model.fields,field_description:stock_picking_report_valued.field_stock_picking_valued
|
||||
msgid "Valued picking"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_picking_report_valued
|
||||
#: model:ir.model.fields,help:stock_picking_report_valued.field_res_partner_valued_picking
|
||||
#: model:ir.model.fields,help:stock_picking_report_valued.field_res_users_valued_picking
|
||||
#: model:ir.model.fields,help:stock_picking_report_valued.field_stock_picking_valued
|
||||
msgid "You can select which partners have valued pickings"
|
||||
msgstr ""
|
||||
4
stock_picking_report_valued/models/__init__.py
Normal file
4
stock_picking_report_valued/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
from . import res_partner
|
||||
from . import stock_move_line
|
||||
from . import stock_picking
|
||||
15
stock_picking_report_valued/models/res_partner.py
Normal file
15
stock_picking_report_valued/models/res_partner.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# 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>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
valued_picking = fields.Boolean(
|
||||
default=True,
|
||||
help='You can select which partners have valued pickings',
|
||||
)
|
||||
61
stock_picking_report_valued/models/stock_move_line.py
Normal file
61
stock_picking_report_valued/models/stock_move_line.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# 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 2018 Luis M. Ontalba - Tecnativa <luis.martinez@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = "stock.move.line"
|
||||
|
||||
currency_id = fields.Many2one(
|
||||
related='sale_line.currency_id', readonly=True,
|
||||
string='Currency')
|
||||
sale_line = fields.Many2one(
|
||||
related='move_id.sale_line_id', readonly=True,
|
||||
string="Related order line")
|
||||
sale_tax_description = fields.Char(
|
||||
compute='_compute_sale_tax_description',
|
||||
string='Tax Description')
|
||||
sale_price_unit = fields.Float(
|
||||
related='sale_line.price_unit', readonly=True,
|
||||
string="Sale price unit")
|
||||
sale_discount = fields.Float(
|
||||
related='sale_line.discount', readonly=True,
|
||||
string="Sale discount (%)")
|
||||
sale_price_subtotal = fields.Monetary(
|
||||
compute='_compute_amount',
|
||||
string="Price subtotal")
|
||||
sale_price_tax = fields.Float(
|
||||
compute='_compute_amount',
|
||||
string='Taxes')
|
||||
|
||||
@api.multi
|
||||
@api.depends('sale_line.tax_id')
|
||||
def _compute_sale_tax_description(self):
|
||||
for line in self:
|
||||
line.sale_tax_description = ', '.join([(
|
||||
x.description or x.name) for x in line.sale_line.tax_id])
|
||||
|
||||
@api.depends('product_uom_qty', 'sale_discount', 'sale_price_unit',
|
||||
'sale_line.tax_id')
|
||||
def _compute_amount(self):
|
||||
for line in self:
|
||||
price = line.sale_price_unit * (1 - (
|
||||
line.sale_discount or 0.0) / 100.0)
|
||||
if line.picking_id.state == 'done':
|
||||
qty = line.qty_done
|
||||
else:
|
||||
qty = line.product_uom_qty
|
||||
taxes = line.sale_line.tax_id.compute_all(
|
||||
price,
|
||||
line.currency_id, qty,
|
||||
product=line.sale_line.product_id,
|
||||
partner=line.sale_line.order_id.partner_shipping_id)
|
||||
line.update({
|
||||
'sale_price_tax': sum(
|
||||
t.get('amount', 0.0) for t in taxes.get('taxes', [])),
|
||||
'sale_price_subtotal': taxes['total_excluded'],
|
||||
})
|
||||
40
stock_picking_report_valued/models/stock_picking.py
Normal file
40
stock_picking_report_valued/models/stock_picking.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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 2016 Luis M. Ontalba - Tecnativa <luis.martinez@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
valued = fields.Boolean(
|
||||
related='partner_id.valued_picking', readonly=True,
|
||||
)
|
||||
currency_id = fields.Many2one(
|
||||
related='sale_id.currency_id', readonly=True,
|
||||
string='Currency')
|
||||
amount_untaxed = fields.Monetary(
|
||||
compute='_compute_amount_all',
|
||||
string='Untaxed Amount')
|
||||
amount_tax = fields.Monetary(
|
||||
compute='_compute_amount_all',
|
||||
string='Taxes')
|
||||
amount_total = fields.Monetary(
|
||||
compute='_compute_amount_all',
|
||||
string='Total')
|
||||
|
||||
@api.multi
|
||||
def _compute_amount_all(self):
|
||||
for pick in self:
|
||||
amount_untaxed = sum(pick.move_line_ids.mapped(
|
||||
'sale_price_subtotal'))
|
||||
amount_tax = sum(pick.move_line_ids.mapped(
|
||||
'sale_price_tax'))
|
||||
pick.update({
|
||||
'amount_untaxed': amount_untaxed,
|
||||
'amount_tax': amount_tax,
|
||||
'amount_total': amount_untaxed + amount_tax,
|
||||
})
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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.move_line_ids']/thead/tr"
|
||||
position="inside">
|
||||
<t t-if="o.valued and o.sale_id and o.move_line_ids">
|
||||
<t t-if="o.state != 'done'">
|
||||
<th class="text-right"><strong>Qty Reserved</strong></th>
|
||||
</t>
|
||||
<th class="text-right"><strong>Unit Price</strong></th>
|
||||
<th class="text-right" groups="sale.group_discount_per_so_line">
|
||||
<strong>Discount</strong>
|
||||
</th>
|
||||
<th class="text-right"><strong>Subtotal</strong></th>
|
||||
<th class="text-right"><strong>Taxes</strong></th>
|
||||
</t>
|
||||
</xpath>
|
||||
<xpath expr="//span[@t-field='move_line.qty_done']/.." position="after">
|
||||
<t t-if="o.valued and o.sale_id and o.move_line_ids">
|
||||
<t t-if="move_line.picking_id.state != 'done'">
|
||||
<td class="text-right">
|
||||
<span t-field="move_line.product_uom_qty"/>
|
||||
<span t-field="move_line.product_uom_id"/></td>
|
||||
</t>
|
||||
<td class="text-right"><span
|
||||
t-field="move_line.sale_price_unit" /></td>
|
||||
<td class="text-right" groups="sale.group_discount_per_so_line">
|
||||
<span t-field="move_line.sale_discount" />
|
||||
</td>
|
||||
<td class="text-right"><span
|
||||
t-field="move_line.sale_price_subtotal" /></td>
|
||||
<td class="text-right"><span
|
||||
t-field="move_line.sale_tax_description"/></td>
|
||||
</t>
|
||||
</xpath>
|
||||
<xpath expr="//table[@t-if='o.move_line_ids']" position="after">
|
||||
<t t-if="o.valued and o.sale_id and o.move_line_ids">
|
||||
<table class="table table-condensed mt32">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-right"><strong>Untaxed Amount</strong></th>
|
||||
<th class="text-right"><strong>Taxes</strong></th>
|
||||
<th class="text-right"><strong>Total</strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_untaxed"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_tax"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-field="o.amount_total"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
2
stock_picking_report_valued/tests/__init__.py
Normal file
2
stock_picking_report_valued/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
from . import test_stock_picking_valued
|
||||
@@ -0,0 +1,64 @@
|
||||
# Copyright 2017 Tecnativa - David Vidal
|
||||
# Copyright 2017 Tecnativa - Luis M. Ontalba
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.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})],
|
||||
'company_id': cls.env.user.company_id.id,
|
||||
})
|
||||
cls.sale_order.company_id.tax_calculation_rounding_method = (
|
||||
'round_per_line')
|
||||
|
||||
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:
|
||||
picking.action_assign()
|
||||
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.action_assign()
|
||||
picking.do_unreserve()
|
||||
self.assertEqual(picking.amount_untaxed, 0.0)
|
||||
self.assertEqual(picking.amount_tax, 0.0)
|
||||
self.assertEqual(picking.amount_total, 0.0)
|
||||
|
||||
def test_03_tax_rounding_method(self):
|
||||
self.sale_order.company_id.tax_calculation_rounding_method = (
|
||||
'round_globally')
|
||||
self.sale_order.action_confirm()
|
||||
self.assertTrue(len(self.sale_order.picking_ids))
|
||||
for picking in self.sale_order.picking_ids:
|
||||
picking.action_assign()
|
||||
self.assertEqual(picking.amount_untaxed, 100.0)
|
||||
self.assertEqual(picking.amount_tax, 15.0)
|
||||
self.assertEqual(picking.amount_total, 115.0)
|
||||
16
stock_picking_report_valued/views/res_partner_view.xml
Normal file
16
stock_picking_report_valued/views/res_partner_view.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="view_partner_valued_picking">
|
||||
<field name="name">Partner view (Valued picking)</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="user_id" position="after">
|
||||
<field name="valued_picking"
|
||||
attrs="{'invisible': [('customer', '=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user