Skip to content

Commit

Permalink
[MIG] repair_reinvoice: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PauBForgeFlow committed Aug 25, 2023
1 parent 89077cc commit f8a329e
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 9 deletions.
Empty file added repair_reinvoice/README.rst
Empty file.
4 changes: 2 additions & 2 deletions repair_reinvoice/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

{
"name": "Repair Reinvoice",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"development_status": "Alpha",
"license": "LGPL-3",
"category": "Repair",
"summary": "Repair Reinvoice in odoo",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"website": "https://github.com/OCA/repair",
"depends": ["repair"],
"data": ["views/repair_views.xml"],
"maintainer": "mariadforgeflow",
Expand Down
8 changes: 4 additions & 4 deletions repair_reinvoice/hooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (C) 2023 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from odoo import SUPERUSER_ID, api
from odoo import SUPERUSER_ID
from odoo.api import Environment


def fill_invoice_ids(env):
Expand All @@ -22,6 +23,5 @@ def fill_invoice_ids(env):


def post_init_hook(cr, registry):
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
fill_invoice_ids(env)
env = Environment(cr, SUPERUSER_ID, {})
fill_invoice_ids(env)
1 change: 1 addition & 0 deletions repair_reinvoice/models/repair_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def _create_invoices(self, group=False):
for repair_id in repair_dict:
repair = self.env["repair.order"].browse(repair_id)
repair.invoice_ids += repair.invoice_id
return

def action_created_invoices(self):
self.ensure_one()
Expand Down
2 changes: 1 addition & 1 deletion repair_reinvoice/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Follow the Odoo standard repair module flow. When an invoice related to a MO is reversed,
Follow the Odoo standard repair module flow. When an invoice related to a RO is reversed,
the button to Create an Invoice will reappear.
16 changes: 14 additions & 2 deletions repair_reinvoice/tests/test_repair_reinvoice.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from odoo.fields import Date
from odoo.tests import common
from odoo.tests import common, tagged


class TestMrpRepairReinvoice(common.SavepointCase):
@tagged("post_install", "-at_install")
class TestMrpRepairReinvoice(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestMrpRepairReinvoice, cls).setUpClass()
Expand Down Expand Up @@ -45,6 +46,16 @@ def setUpClass(cls):
}
)

cls.journal = cls.env["account.journal"].create(
{
"name": "Test Journal",
"code": "test",
"type": "sale",
"invoice_reference_type": "invoice",
"invoice_reference_model": "odoo",
}
)

def test_reinvoice(self):
self.repair.action_validate()
self.repair.action_repair_start()
Expand All @@ -62,6 +73,7 @@ def test_reinvoice(self):
.create(
{
"reason": "Please reverse",
"journal_id": self.journal.id,
"refund_method": "cancel",
"date": today,
}
Expand Down
1 change: 1 addition & 0 deletions setup/repair_reinvoice/odoo/addons/repair_reinvoice
6 changes: 6 additions & 0 deletions setup/repair_reinvoice/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit f8a329e

Please sign in to comment.