Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] l10n_es_sigaus_stock_picking_report_valued: Migration to 17.0 #3775

Open
wants to merge 9 commits into
base: 17.0
Choose a base branch
from
89 changes: 89 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,89 @@
============================
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/17.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-17-0/l10n-spain-17-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=17.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:%2017.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/17.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": "17.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-29 00:13+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\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: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\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 "<strong>Total 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_stock_report_delivery_has_serial_move_line_sigaus
msgid "Aportación SIGAUS (RD 679/2006):"
msgstr "Aportación SIGAUS (RD 679/2006):"

#. 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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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"
"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: 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 ""

#. 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 ""

#. 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 ""

#. 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 ""

#. 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 ""

#. 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 ""

#. 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 ""

#. 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 ""

#. 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 ""
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", "quantity_product_uom")
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
)
3 changes: 3 additions & 0 deletions l10n_es_sigaus_stock_picking_report_valued/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
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,3 @@
- [Sygel](https://www.sygel.es):
- Manuel Regidor \<<[email protected]>\>
- Harald Panten \<<[email protected]>\>
Loading
Loading