Skip to content

Commit

Permalink
Merge PR #1676 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Aug 7, 2024
2 parents dbc322c + 159918f commit c7e41c6
Show file tree
Hide file tree
Showing 19 changed files with 837 additions and 0 deletions.
84 changes: 84 additions & 0 deletions product_form_account_move_line_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
===================================
Product From Account Move Line Link
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c66f8eed82c46d7964f692f3d3aa1bf60529d4ec3539dc7a53ea4e53d3ebaa40
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/17.0/product_form_account_move_line_link
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-product_form_account_move_line_link
: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/account-invoicing&target_branch=17.0
:alt: Try me on Runboat

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

Adds a button on product forms to access Journal Items

**Table of contents**

.. contents::
:local:

Usage
=====

Go to Products > Products or Products > Product Variants tab on any of
the Sales, Purchase or Inventory apps.

Click on the button 'Journal Items' with the list icon

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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/account-invoicing/issues/new?body=module:%20product_form_account_move_line_link%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
-------

* ForgeFlow

Contributors
------------

- Jaume Bernaus <[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/account-invoicing <https://github.com/OCA/account-invoicing/tree/17.0/product_form_account_move_line_link>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_form_account_move_line_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions product_form_account_move_line_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Product From Account Move Line Link",
"summary": """
Adds a button on product forms to access Journal Items""",
"version": "17.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"category": "Account",
"license": "AGPL-3",
"depends": ["account"],
"data": [
"views/account_move_line_views.xml",
"views/product_product_views.xml",
"views/product_template_views.xml",
],
"installable": True,
}
41 changes: 41 additions & 0 deletions product_form_account_move_line_link/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_form_account_move_line_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-27 14:33+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_form_account_move_line_link
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_product__account_move_lines_count
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_template__account_move_lines_count
msgid "Invoiced"
msgstr "Facturada"

#. module: product_form_account_move_line_link
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_product_tree
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_tree
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_normal_form_view_inherit
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_template_only_form_view_inherit
msgid "Journal Items"
msgstr "Artículos Diarios"

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_template
msgid "Product"
msgstr "Producto"

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_product
msgid "Product Variant"
msgstr "Variante de Producto"
41 changes: 41 additions & 0 deletions product_form_account_move_line_link/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_form_account_move_line_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-23 14:36+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_form_account_move_line_link
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_product__account_move_lines_count
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_template__account_move_lines_count
msgid "Invoiced"
msgstr "Fatturato"

#. module: product_form_account_move_line_link
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_product_tree
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_tree
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_normal_form_view_inherit
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_template_only_form_view_inherit
msgid "Journal Items"
msgstr "Movimenti contabili"

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_template
msgid "Product"
msgstr "Prodotto"

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_product
msgid "Product Variant"
msgstr "Variante prodotto"
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_form_account_move_line_link
#
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: product_form_account_move_line_link
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_product__account_move_lines_count
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_template__account_move_lines_count
msgid "Invoiced"
msgstr ""

#. module: product_form_account_move_line_link
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_product_tree
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_tree
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_normal_form_view_inherit
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_template_only_form_view_inherit
msgid "Journal Items"
msgstr ""

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_template
msgid "Product"
msgstr ""

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_product
msgid "Product Variant"
msgstr ""
41 changes: 41 additions & 0 deletions product_form_account_move_line_link/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_form_account_move_line_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-21 16:35+0000\n"
"Last-Translator: Adriano Prado <[email protected]>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_form_account_move_line_link
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_product__account_move_lines_count
#: model:ir.model.fields,field_description:product_form_account_move_line_link.field_product_template__account_move_lines_count
msgid "Invoiced"
msgstr "Faturado"

#. module: product_form_account_move_line_link
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_product_tree
#: model:ir.actions.act_window,name:product_form_account_move_line_link.action_account_move_line_product_tree
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_normal_form_view_inherit
#: model_terms:ir.ui.view,arch_db:product_form_account_move_line_link.product_template_only_form_view_inherit
msgid "Journal Items"
msgstr "Itens Diário"

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_template
msgid "Product"
msgstr "Produto"

#. module: product_form_account_move_line_link
#: model:ir.model,name:product_form_account_move_line_link.model_product_product
msgid "Product Variant"
msgstr "Variante do Produto"
2 changes: 2 additions & 0 deletions product_form_account_move_line_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_product
from . import product_template
29 changes: 29 additions & 0 deletions product_form_account_move_line_link/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ProductProduct(models.Model):
_inherit = "product.product"

account_move_lines_count = fields.Integer(
compute="_compute_account_move_lines_count", string="Invoiced"
)

def _compute_account_move_lines_count(self):
if not self.user_has_groups("account.group_account_invoice") or not self.ids:
self.purchase_lines_count = 0
return
domain = [
("product_id", "in", self.ids),
("company_id", "in", self.env.companies.ids),
]
account_move_line_data = self.env["account.move.line"].read_group(
domain, ["product_id"], ["product_id"]
)
mapped_data = {
m["product_id"][0]: m["product_id_count"] for m in account_move_line_data
}
for product in self:
product.account_move_lines_count = mapped_data.get(product.id, 0)
21 changes: 21 additions & 0 deletions product_form_account_move_line_link/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import api, fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

account_move_lines_count = fields.Integer(
compute="_compute_account_move_lines_count", string="Invoiced"
)

@api.depends("product_variant_ids.account_move_lines_count")
def _compute_account_move_lines_count(self):
for product in self:
product.account_move_lines_count = sum(
p.account_move_lines_count
for p in product.with_context(active_test=False).product_variant_ids
)
3 changes: 3 additions & 0 deletions product_form_account_move_line_link/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions product_form_account_move_line_link/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Jaume Bernaus \<<[email protected]>\>
1 change: 1 addition & 0 deletions product_form_account_move_line_link/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds a button on product forms to access Journal Items
4 changes: 4 additions & 0 deletions product_form_account_move_line_link/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Go to Products \> Products or Products \> Product Variants tab on any of
the Sales, Purchase or Inventory apps.

Click on the button 'Journal Items' with the list icon
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 c7e41c6

Please sign in to comment.