mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] account_move_line_manufacture_info: Migration to 13.0
This commit is contained in:
@@ -14,13 +14,13 @@ Account Move Line Manufacture Information
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/manufacture/tree/12.0/account_move_line_manufacture_info
|
||||
:target: https://github.com/OCA/manufacture/tree/13.0/account_move_line_manufacture_info
|
||||
:alt: OCA/manufacture
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-0-account_move_line_manufacture_info
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-account_move_line_manufacture_info
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/129/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/129/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -47,7 +47,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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 <https://github.com/OCA/manufacture/issues/new?body=module:%20account_move_line_manufacture_info%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20account_move_line_manufacture_info%0Aversion:%2013.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.
|
||||
|
||||
@@ -57,12 +57,12 @@ Credits
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Eficent
|
||||
* ForgeFlow
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Adria Gil <adria.gil@eficent.com>
|
||||
* Adria Gil <adria.gil@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -77,6 +77,6 @@ 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/manufacture <https://github.com/OCA/manufacture/tree/12.0/account_move_line_manufacture_info>`_ project on GitHub.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/13.0/account_move_line_manufacture_info>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# © 2019 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Account Move Line Manufacture Information",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"depends": ["stock_account", "mrp"],
|
||||
"author": "Eficent," "Odoo Community Association (OCA)",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/manufacture",
|
||||
"category": "Manufacture Management",
|
||||
"installable": True,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2019 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2019 Eficent Business and IT Consulting Services S.L.
|
||||
# © 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, models
|
||||
@@ -9,16 +9,17 @@ class StockMove(models.Model):
|
||||
|
||||
@api.model
|
||||
def _prepare_account_move_line(
|
||||
self, qty, cost, credit_account_id, debit_account_id
|
||||
self, qty, cost, credit_account_id, debit_account_id, description
|
||||
):
|
||||
res = super(StockMove, self)._prepare_account_move_line(
|
||||
qty, cost, credit_account_id, debit_account_id
|
||||
qty, cost, credit_account_id, debit_account_id, description
|
||||
)
|
||||
for line in res:
|
||||
if self.production_id:
|
||||
line[2]["manufacture_order_id"] = self.production_id.id
|
||||
elif self.raw_material_production_id:
|
||||
line[2]["manufacture_order_id"] = self.raw_material_production_id.id
|
||||
line[2]["name"] = self.raw_material_production_id.name
|
||||
elif self.unbuild_id:
|
||||
line[2]["unbuild_order_id"] = self.unbuild_id.id
|
||||
elif self.consume_unbuild_id:
|
||||
|
||||
@@ -1 +1 @@
|
||||
* Adria Gil <adria.gil@eficent.com>
|
||||
* Adria Gil <adria.gil@forgeflow.com>
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/12.0/account_move_line_manufacture_info"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-0-account_move_line_manufacture_info"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/13.0/account_move_line_manufacture_info"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-account_move_line_manufacture_info"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds the manufacture information to any account move lines generated by a
|
||||
manufacture operation such as a manufacturing order or an unbuild order.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
@@ -397,7 +397,7 @@ move lines that are related to the UO.</li>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20account_move_line_manufacture_info%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20account_move_line_manufacture_info%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -405,13 +405,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Eficent</li>
|
||||
<li>ForgeFlow</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Adria Gil <<a class="reference external" href="mailto:adria.gil@eficent.com">adria.gil@eficent.com</a>></li>
|
||||
<li>Adria Gil <<a class="reference external" href="mailto:adria.gil@forgeflow.com">adria.gil@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -421,7 +421,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/12.0/account_move_line_manufacture_info">OCA/manufacture</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/13.0/account_move_line_manufacture_info">OCA/manufacture</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# 2018 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
import odoo.tests.common as common
|
||||
@@ -14,11 +14,14 @@ class TestAccountMoveLineManufactureInfo(common.SavepointCase):
|
||||
cls.account_move_line_obj = cls.env["account.move.line"]
|
||||
cls.bom_obj = cls.env["mrp.bom"]
|
||||
cls.bom_line_obj = cls.env["mrp.bom.line"]
|
||||
cls.location_production = cls.env.ref("stock.location_production")
|
||||
cls.production_obj = cls.env["mrp.production"]
|
||||
cls.produce_wiz = cls.env["mrp.product.produce"]
|
||||
cls.unbuild_obj = cls.env["mrp.unbuild"]
|
||||
|
||||
cls.location_production = cls.env["stock.location"].search(
|
||||
[("usage", "=", "production"), ("company_id", "=", cls.env.company.id)]
|
||||
)
|
||||
|
||||
# Create accounts for WIP
|
||||
cls.account_wip = cls.env["account.account"].create(
|
||||
{
|
||||
@@ -124,24 +127,25 @@ class TestAccountMoveLineManufactureInfo(common.SavepointCase):
|
||||
wiz = Form(
|
||||
self.produce_wiz.with_context({"active_id": mo.id, "active_ids": [mo.id]})
|
||||
)
|
||||
wiz.product_qty = qty or mo.product_qty
|
||||
wiz.qty_producing = qty or mo.product_qty
|
||||
produce_wizard = wiz.save()
|
||||
produce_wizard.do_produce()
|
||||
return True
|
||||
|
||||
def _generate_mo(self, product_id, bom_id, qty=5.0):
|
||||
mo_form = Form(self.production_obj)
|
||||
mo_form.product_id = product_id
|
||||
mo_form.bom_id = bom_id
|
||||
mo_form.product_qty = qty
|
||||
mo = mo_form.save()
|
||||
mo.action_confirm()
|
||||
return mo
|
||||
|
||||
def test_01_manufacture_order(self):
|
||||
"""Create Manufacture Order and check account move lines created"""
|
||||
self.product_top.write({"standard_price": 445.0})
|
||||
mo = self.production_obj.create(
|
||||
{
|
||||
"name": "MO-01",
|
||||
"product_id": self.product_top.id,
|
||||
"product_uom_id": self.product_top.uom_id.id,
|
||||
"product_qty": 5.0,
|
||||
"bom_id": self.bom_top.id,
|
||||
}
|
||||
)
|
||||
mo.action_assign()
|
||||
mo = self._generate_mo(self.product_top, self.bom_top)
|
||||
|
||||
self._produce(mo, 5.0)
|
||||
mo.button_mark_done()
|
||||
account_move_lines = self.account_move_line_obj.search(
|
||||
@@ -152,27 +156,18 @@ class TestAccountMoveLineManufactureInfo(common.SavepointCase):
|
||||
def test_02_ubuild_order(self):
|
||||
"""Create Unbuild Order and check account move lines created"""
|
||||
self.product_top.write({"standard_price": 445.0})
|
||||
mo = self.production_obj.create(
|
||||
{
|
||||
"name": "MO-01",
|
||||
"product_id": self.product_top.id,
|
||||
"product_uom_id": self.product_top.uom_id.id,
|
||||
"product_qty": 5.0,
|
||||
"bom_id": self.bom_top.id,
|
||||
}
|
||||
)
|
||||
mo.action_assign()
|
||||
mo = self._generate_mo(self.product_top, self.bom_top)
|
||||
|
||||
self._produce(mo, 3.0)
|
||||
mo.button_mark_done()
|
||||
uo = self.unbuild_obj.create(
|
||||
{
|
||||
"product_id": self.product_top.id,
|
||||
"bom_id": self.bom_top.id,
|
||||
"product_qty": 1.0,
|
||||
"product_uom_id": self.product_top.uom_id.id,
|
||||
}
|
||||
)
|
||||
uo.action_unbuild()
|
||||
|
||||
uo = Form(self.unbuild_obj)
|
||||
uo.product_id = self.product_top
|
||||
uo.bom_id = self.bom_top
|
||||
uo.product_qty = 1
|
||||
uo.product_uom_id = self.product_top.uom_id
|
||||
uo.save().action_unbuild()
|
||||
|
||||
account_move_lines = self.account_move_line_obj.search(
|
||||
[("unbuild_order_id", "=", uo.id)]
|
||||
)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
<field name="name">Account Moves</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.move.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('manufacture_order_id', '=', active_id)]</field>
|
||||
</record>
|
||||
@@ -26,7 +25,6 @@
|
||||
<field name="name">Account Moves</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.move.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('unbuild_order_id', '=', active_id)]</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user