Skip to content

Commit

Permalink
Merge PR OCA#3453 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Feb 28, 2024
2 parents fa91a83 + 0158201 commit 7b82b5a
Show file tree
Hide file tree
Showing 18 changed files with 1,265 additions and 0 deletions.
88 changes: 88 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
============================
SIGAUS Report Picking Valued
============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c9f800b5f26497407e26da0525efaa1c2a389d31dba205ecadec991edc604950
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-spain/tree/16.0/l10n_es_sigaus_stock_picking_report_valued
:alt: OCA/l10n-spain
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-spain-16-0/l10n-spain-16-0-l10n_es_sigaus_stock_picking_report_valued
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Mostrar la aportación SIGAUS en los albaranes valorados que proceden de un pedido de
ventas. Los cálculos se realizan según el valor de cantidad hecha si este es distinto a
0. En caso contrario, los calculos se realizan según la cantidad reservada.

**Table of contents**

.. contents::
:local:

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

Para que la aportación SIGAUS aparezca en el albarán valorado, el contacto del albarán
tiene que tener activada la opción "Albarán valorado" de la pestaña "Venta y compra" de
su ficha.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_sigaus_stock_picking_report_valued%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Sygel

Contributors
~~~~~~~~~~~~

* `Sygel <https://www.sygel.es>`_:

* Manuel Regidor <[email protected]>
* Harald Panten <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/16.0/l10n_es_sigaus_stock_picking_report_valued>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "SIGAUS Report Picking Valued",
"summary": "Show SIGAUS amount in valued stock pickings.",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Sygel, Odoo Community Association (OCA)",
"category": "Stock",
"website": "https://github.com/OCA/l10n-spain",
"depends": [
"stock_picking_report_valued",
"l10n_es_sigaus_sale",
],
"data": ["report/report_deliveryslip.xml"],
"installable": True,
}
76 changes: 76 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_es_sigaus_stock_picking_report_valued
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-27 12:24+0000\n"
"PO-Revision-Date: 2024-02-27 13:25+0100\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"
"Plural-Forms: \n"
"Language: es\n"
"X-Generator: Poedit 2.3\n"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model_terms:ir.ui.view,arch_db:l10n_es_sigaus_stock_picking_report_valued.l10n_es_sigaus_report_delivery_document
msgid "<strong>SIGAUS Taxes</strong>"
msgstr "<strong>Impuesto SIGAUS</strong>"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model_terms:ir.ui.view,arch_db:l10n_es_sigaus_stock_picking_report_valued.l10n_es_sigaus_report_delivery_document
msgid "<strong>SIGAUS Untaxed Amount</strong>"
msgstr "<strong>SIGAUS Imponible</strong>"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model_terms:ir.ui.view,arch_db:l10n_es_sigaus_stock_picking_report_valued.l10n_es_sigaus_report_delivery_document
msgid "<strong>Total Picking</strong>"
msgstr "<strong>TOTAL ALBARÁN</strong>"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model_terms:ir.ui.view,arch_db:l10n_es_sigaus_stock_picking_report_valued.l10n_es_sigaus_report_delivery_document
msgid "<strong>Total SIGAUS</strong>"
msgstr ""

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model_terms:ir.ui.view,arch_db:l10n_es_sigaus_stock_picking_report_valued.l10n_es_sigaus_stock_report_delivery_has_serial_move_line_sigaus
msgid "Aportación SIGAUS (RD 679/2006):"
msgstr ""

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_picking__picking_total_with_sigaus
msgid "Picking Total With Sigaus"
msgstr "Total de albarán con SIGAUS"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model:ir.model,name:l10n_es_sigaus_stock_picking_report_valued.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos de Producto (Stock Move Line)"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_move_line__sigaus_amount_subtotal
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_picking__sigaus_amount_subtotal
msgid "Sigaus Amount Subtotal"
msgstr "Subtotal SIGAUS"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_move_line__sigaus_amount_tax
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_picking__sigaus_amount_tax
msgid "Sigaus Amount Tax"
msgstr "Impuesto SIGAUS"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_move_line__sigaus_amount_total
#: model:ir.model.fields,field_description:l10n_es_sigaus_stock_picking_report_valued.field_stock_picking__sigaus_amount_total
msgid "Sigaus Amount Total"
msgstr "Total SIGAUS"

#. module: l10n_es_sigaus_stock_picking_report_valued
#: model:ir.model,name:l10n_es_sigaus_stock_picking_report_valued.model_stock_picking
msgid "Transfer"
msgstr "Albarán"
5 changes: 5 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import stock_picking
from . import stock_move_line
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2024 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

sigaus_amount_subtotal = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)
sigaus_amount_tax = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)
sigaus_amount_total = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)

def _get_sigaus_product_taxes(self, sigaus_product):
self.ensure_one()
taxes = sigaus_product.taxes_id
if not taxes:
return False
fiscal_position = self.sale_line.order_id.fiscal_position_id
return fiscal_position.map_tax(taxes)

def _get_sigaus_product_taxes_values(self, sigaus_product, price, qty):
self.ensure_one()
return self.env["account.tax"]._convert_to_tax_base_line_dict(
self,
partner=self.sale_line.order_partner_id,
currency=self.currency_id,
product=sigaus_product,
taxes=self._get_sigaus_product_taxes(sigaus_product),
price_unit=price,
quantity=qty,
)

@api.depends("product_id", "date", "qty_done", "reserved_qty")
def _compute_sigaus_amount(self):
for line in self:
subtotal = 0.0
tax_amount = 0.0
total = 0.0
if (
line.product_id
and line.sale_line
and line.sale_line.order_id.is_sigaus
and line.product_id.sigaus_has_amount
):
sigaus_product_id = self.env.ref(
"l10n_es_sigaus_account.aportacion_sigaus_product_template"
)
price = self.env["l10n.es.sigaus.amount"].get_sigaus_amount(
line.sale_line.order_id.date_order
)
quantity = line._get_report_valued_quantity()
weight = quantity * line.product_id.weight
tax_results = self.env["account.tax"]._compute_taxes(
[
line._get_sigaus_product_taxes_values(
sigaus_product_id, price, weight
)
]
)
totals = list(tax_results["totals"].values())[0]
subtotal = totals["amount_untaxed"]
tax_amount = totals["amount_tax"]
total = subtotal + tax_amount
line.sigaus_amount_subtotal = subtotal
line.sigaus_amount_tax = tax_amount
line.sigaus_amount_total = total
41 changes: 41 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2024 Manuel Regidor <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class StockPicking(models.Model):
_inherit = "stock.picking"

sigaus_amount_subtotal = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)
sigaus_amount_tax = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)
sigaus_amount_total = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)
picking_total_with_sigaus = fields.Monetary(
compute="_compute_sigaus_amount", compute_sudo=True
)

@api.depends(
"amount_total",
"move_line_ids.sigaus_amount_subtotal",
"move_line_ids.sigaus_amount_tax",
"move_line_ids.sigaus_amount_total",
)
def _compute_sigaus_amount(self):
for pick in self:
sigaus_amount_subtotal = sigaus_amount_tax = sigaus_amount_total = 0.0
for line in pick.move_line_ids:
sigaus_amount_subtotal += line.sigaus_amount_subtotal
sigaus_amount_tax += line.sigaus_amount_tax
sigaus_amount_total += line.sigaus_amount_total
pick.sigaus_amount_subtotal = sigaus_amount_subtotal
pick.sigaus_amount_tax = sigaus_amount_tax
pick.sigaus_amount_total = sigaus_amount_total
pick.picking_total_with_sigaus = (
pick.sigaus_amount_total + pick.amount_total
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Para que la aportación SIGAUS aparezca en el albarán valorado, el contacto del albarán
tiene que tener activada la opción "Albarán valorado" de la pestaña "Venta y compra" de
su ficha.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Sygel <https://www.sygel.es>`_:

* Manuel Regidor <[email protected]>
* Harald Panten <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Mostrar la aportación SIGAUS en los albaranes valorados que proceden de un pedido de
ventas. Los cálculos se realizan según el valor de cantidad hecha si este es distinto a
0. En caso contrario, los calculos se realizan según la cantidad reservada.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<odoo>
<!-- Copyright 2024 Manuel Regidor <[email protected]>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<template
id="l10n_es_sigaus_report_delivery_document"
inherit_id="stock_picking_report_valued.valued_report_picking"
>
<xpath expr="//span[@t-field='o.amount_untaxed']/../../../.." position="after">
<t
t-if="o.valued and o.sale_id and o.sale_id.is_sigaus and o.move_line_ids and is_outgoing"
>
<table class="table table-sm mt32" name="sigaus_valued">
<thead>
<tr>
<th class="text-end"><strong
>SIGAUS Untaxed Amount</strong></th>
<th class="text-end"><strong>SIGAUS Taxes</strong></th>
<th class="text-end"><strong>Total SIGAUS</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-end">
<span t-field="o.sigaus_amount_subtotal" />
</td>
<td class="text-end">
<span t-field="o.sigaus_amount_tax" />
</td>
<td class="text-end">
<span t-field="o.sigaus_amount_total" />
</td>
</tr>
</tbody>
</table>
<div class="col-6 ms-auto">
<table
class="table table-sm"
style="background-color: rgba(0, 0, 0, 0.2);"
name="sigaus_total"
>
<tr>
<td>
<strong>Total Picking</strong>
</td>
<td class="text-end">
<strong t-field="o.picking_total_with_sigaus" />
</td>
</tr>
</table>
</div>
</t>
</xpath>
</template>
<template
id="l10n_es_sigaus_stock_report_delivery_has_serial_move_line_sigaus"
inherit_id="stock.stock_report_delivery_has_serial_move_line"
>
<xpath expr="//span[@t-field='move_line.product_id']/.." position="inside">
<t
t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing and move_line.sigaus_amount_total"
>
<br /><span
style="font-size: 70%; opacity: 0.7;"
>Aportación SIGAUS (RD 679/2006): <span
t-field="move_line.sigaus_amount_total"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/></span>
</t>
</xpath>
</template>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7b82b5a

Please sign in to comment.