Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions account_move_line_repair_info/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=============================
Account Move Line Repair Info
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:44a807b48cf561e9c5eb22bd9e1308e78246ab34e9ca623cea3ae9d108f29e80
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/18.0/account_move_line_repair_info
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-18-0/account-financial-tools-18-0-account_move_line_repair_info
: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-financial-tools&target_branch=18.0
:alt: Try me on Runboat

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

This module will add the repair order to journal items.

**Table of contents**

.. contents::
:local:

Usage
=====

The repair order will be automatically copied to the journal items.

- The journal entries created by the consumption of materials and the
repaired product, are associated with the repair order
- For Invoice(s) made from related sales please use the module
account_move_line_repair_info_sale

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/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-financial-tools/issues/new?body=module:%20account_move_line_repair_info%0Aversion:%2018.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 S.L.

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

- Christopher Ormaza <chris.ormaza@forgeflow.com>

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-financial-tools <https://github.com/OCA/account-financial-tools/tree/18.0/account_move_line_repair_info>`_ project on GitHub.

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

{
"name": "Account Move Line Repair Info",
"summary": "Introduces the repair order to the journal items",
"version": "18.0.1.0.0",
"author": "ForgeFlow S.L., " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"category": "Generic",
"depends": [
"account",
"repair",
"stock_account",
],
"license": "AGPL-3",
"data": ["security/account_security.xml", "views/account_move_view.xml"],
"installable": True,
"post_init_hook": "post_init_hook",
}
38 changes: 38 additions & 0 deletions account_move_line_repair_info/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2022 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


def post_init_hook(env):
# Material consumed on repair
env.cr.execute(
"""
update account_move_line as aml set repair_order_id = q.order_id
from (
select aml.id, ro.id as order_id
from account_move_line as aml
left join account_move as am on am.id = aml.move_id
left join stock_valuation_layer svl on svl.account_move_id = am.id
left join stock_move as sm on sm.id = svl.stock_move_id
left join repair_order as ro on sm.repair_id = ro.id
where ro.id is not null
) as q
where q.id = aml.id
"""
)

# Product Repaired
env.cr.execute(
"""
update account_move_line as aml set repair_order_id = q.order_id
from (
select aml.id, ro.id as order_id
from account_move_line as aml
left join account_move as am on am.id = aml.move_id
left join stock_valuation_layer svl on svl.account_move_id = am.id
left join stock_move as sm on sm.id = svl.stock_move_id
left join repair_order as ro on sm.id = ro.move_id
where ro.id is not null
) as q
where q.id = aml.id
"""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_line_repair_info
#
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: account_move_line_repair_info
#: model:ir.model.fields,field_description:account_move_line_repair_info.field_repair_order__account_move_line_ids
msgid "Journal Entries"
msgstr ""

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_account_move_line
msgid "Journal Item"
msgstr ""

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_repair_order
#: model:ir.model.fields,field_description:account_move_line_repair_info.field_account_move_line__repair_order_id
#: model_terms:ir.ui.view,arch_db:account_move_line_repair_info.view_account_move_line_filter
msgid "Repair Order"
msgstr ""

#. module: account_move_line_repair_info
#: model:res.groups,name:account_move_line_repair_info.group_account_move_repair_order_info
msgid "Repair Order info in Journal Items"
msgstr ""

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr ""
49 changes: 49 additions & 0 deletions account_move_line_repair_info/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_line_repair_info
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-06-24 18:38+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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: account_move_line_repair_info
#: model:ir.model.fields,field_description:account_move_line_repair_info.field_repair_order__account_move_line_ids
msgid "Journal Entries"
msgstr "Registrazioni contabili"

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_account_move
msgid "Journal Entry"
msgstr "Registrazione contabile"

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_account_move_line
msgid "Journal Item"
msgstr "Movimento contabile"

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_repair_order
#: model:ir.model.fields,field_description:account_move_line_repair_info.field_account_move_line__repair_order_id
#: model_terms:ir.ui.view,arch_db:account_move_line_repair_info.view_account_move_line_filter
msgid "Repair Order"
msgstr "Ordine di riparazione"

#. module: account_move_line_repair_info
#: model:res.groups,name:account_move_line_repair_info.group_account_move_repair_order_info
msgid "Repair Order info in Journal Items"
msgstr "Informazioni ordine di riparazione nei movimenti contabili"

#. module: account_move_line_repair_info
#: model:ir.model,name:account_move_line_repair_info.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr "Livello valutazione magazzino"
3 changes: 3 additions & 0 deletions account_move_line_repair_info/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import account_move
from . import repair_order
from . import stock_valuation_layer
16 changes: 16 additions & 0 deletions account_move_line_repair_info/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2022 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

repair_order_id = fields.Many2one(
comodel_name="repair.order",
string="Repair Order",
ondelete="set null",
index=True,
copy=False,
)
15 changes: 15 additions & 0 deletions account_move_line_repair_info/models/repair_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2022 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class RepairOrder(models.Model):
_inherit = "repair.order"

account_move_line_ids = fields.One2many(
comodel_name="account.move.line",
inverse_name="repair_order_id",
string="Journal Entries",
required=False,
)
21 changes: 21 additions & 0 deletions account_move_line_repair_info/models/stock_valuation_layer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


class StockValuationLayer(models.Model):
_inherit = "stock.valuation.layer"

def _validate_accounting_entries(self):
res = super()._validate_accounting_entries()
for svl in self:
if svl.stock_move_id.repair_id:
current_move = svl.account_move_id
if current_move:
current_move.line_ids.write(
{
"repair_order_id": svl.stock_move_id.repair_id.id,
}
)
return res
3 changes: 3 additions & 0 deletions account_move_line_repair_info/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 account_move_line_repair_info/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Christopher Ormaza \<<chris.ormaza@forgeflow.com>\>
1 change: 1 addition & 0 deletions account_move_line_repair_info/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module will add the repair order to journal items.
5 changes: 5 additions & 0 deletions account_move_line_repair_info/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The repair order will be automatically copied to the journal items.

- The journal entries created by the consumption of materials and the
repaired product, are associated with the repair order
- For Invoice(s) made from related sales please use the module account_move_line_repair_info_sale
8 changes: 8 additions & 0 deletions account_move_line_repair_info/security/account_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="group_account_move_repair_order_info" model="res.groups">
<field name="name">Repair Order info in Journal Items</field>
<field name="category_id" ref="base.module_category_hidden" />
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading