mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[MIG]rma_repair to v13
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
from . import wizards
|
from . import wizards
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "RMA Repair",
|
"name": "RMA Repair",
|
||||||
"version": "12.0.1.2.0",
|
"version": "13.0.1.0.0",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"category": "RMA",
|
"category": "RMA",
|
||||||
"summary": "Links RMA with Repairs.",
|
"summary": "Links RMA with Repairs.",
|
||||||
"author": "Eficent, Odoo Community Association (OCA)",
|
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/Eficent/stock-rma",
|
"website": "https://github.com/Eficent/stock-rma",
|
||||||
"depends": ["rma_account", "repair_refurbish"],
|
"depends": ["rma_account", "repair_refurbish"],
|
||||||
"data": [
|
"data": [
|
||||||
@@ -19,5 +18,4 @@
|
|||||||
"data/repair_sequence.xml",
|
"data/repair_sequence.xml",
|
||||||
],
|
],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"auto_install": True,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
@@ -13,4 +13,6 @@ class RepairOrder(models.Model):
|
|||||||
under_warranty = fields.Boolean(
|
under_warranty = fields.Boolean(
|
||||||
related="rma_line_id.under_warranty", readonly=False
|
related="rma_line_id.under_warranty", readonly=False
|
||||||
)
|
)
|
||||||
invoice_status = fields.Selection(related="invoice_id.state")
|
invoice_status = fields.Selection(
|
||||||
|
related="invoice_id.state", string="Invoice Status"
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class RmaOrder(models.Model):
|
class RmaOrder(models.Model):
|
||||||
_inherit = "rma.order"
|
_inherit = "rma.order"
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_repair_count(self):
|
def _compute_repair_count(self):
|
||||||
for rma in self:
|
for rma in self:
|
||||||
repairs = rma.mapped("rma_line_ids.repair_ids")
|
repairs = rma.mapped("rma_line_ids.repair_ids")
|
||||||
@@ -17,7 +16,6 @@ class RmaOrder(models.Model):
|
|||||||
compute="_compute_repair_count", string="# of Repairs"
|
compute="_compute_repair_count", string="# of Repairs"
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def action_view_repair_order(self):
|
def action_view_repair_order(self):
|
||||||
action = self.env.ref("repair.action_repair_order_tree")
|
action = self.env.ref("repair.action_repair_order_tree")
|
||||||
result = action.read()[0]
|
result = action.read()[0]
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
from odoo.addons import decimal_precision as dp
|
|
||||||
|
|
||||||
|
|
||||||
class RmaOrderLine(models.Model):
|
class RmaOrderLine(models.Model):
|
||||||
_inherit = "rma.order.line"
|
_inherit = "rma.order.line"
|
||||||
@@ -49,7 +47,7 @@ class RmaOrderLine(models.Model):
|
|||||||
qty_to_repair = fields.Float(
|
qty_to_repair = fields.Float(
|
||||||
string="Qty To Repair",
|
string="Qty To Repair",
|
||||||
copy=False,
|
copy=False,
|
||||||
digits=dp.get_precision("Product Unit of Measure"),
|
digits="Product Unit of Measure",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
compute="_compute_qty_to_repair",
|
compute="_compute_qty_to_repair",
|
||||||
store=True,
|
store=True,
|
||||||
@@ -57,7 +55,7 @@ class RmaOrderLine(models.Model):
|
|||||||
qty_under_repair = fields.Float(
|
qty_under_repair = fields.Float(
|
||||||
string="Qty Under Repair",
|
string="Qty Under Repair",
|
||||||
copy=False,
|
copy=False,
|
||||||
digits=dp.get_precision("Product Unit of Measure"),
|
digits="Product Unit of Measure",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
compute="_compute_qty_under_repair",
|
compute="_compute_qty_under_repair",
|
||||||
store=True,
|
store=True,
|
||||||
@@ -65,7 +63,7 @@ class RmaOrderLine(models.Model):
|
|||||||
qty_repaired = fields.Float(
|
qty_repaired = fields.Float(
|
||||||
string="Qty Repaired",
|
string="Qty Repaired",
|
||||||
copy=False,
|
copy=False,
|
||||||
digits=dp.get_precision("Product Unit of Measure"),
|
digits="Product Unit of Measure",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
compute="_compute_qty_repaired",
|
compute="_compute_qty_repaired",
|
||||||
store=True,
|
store=True,
|
||||||
@@ -91,7 +89,6 @@ class RmaOrderLine(models.Model):
|
|||||||
qty_to_pay = fields.Float(compute="_compute_qty_to_pay")
|
qty_to_pay = fields.Float(compute="_compute_qty_to_pay")
|
||||||
qty_to_deliver = fields.Float(compute="_compute_qty_to_deliver")
|
qty_to_deliver = fields.Float(compute="_compute_qty_to_deliver")
|
||||||
|
|
||||||
@api.multi
|
|
||||||
@api.depends(
|
@api.depends(
|
||||||
"delivery_policy",
|
"delivery_policy",
|
||||||
"product_qty",
|
"product_qty",
|
||||||
@@ -106,12 +103,11 @@ class RmaOrderLine(models.Model):
|
|||||||
for rec in self.filtered(lambda l: l.delivery_policy == "repair"):
|
for rec in self.filtered(lambda l: l.delivery_policy == "repair"):
|
||||||
qty_to_pay = 0.0
|
qty_to_pay = 0.0
|
||||||
for repair in rec.repair_ids.filtered(
|
for repair in rec.repair_ids.filtered(
|
||||||
lambda r: r.invoice_method != "none" and r.invoice_status != "paid"
|
lambda r: r.invoice_method != "none" and r.invoice_status != "posted"
|
||||||
):
|
):
|
||||||
qty_to_pay += repair.product_qty
|
qty_to_pay += repair.product_qty
|
||||||
rec.qty_to_pay = qty_to_pay
|
rec.qty_to_pay = qty_to_pay
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def action_view_repair_order(self):
|
def action_view_repair_order(self):
|
||||||
action = self.env.ref("repair.action_repair_order_tree")
|
action = self.env.ref("repair.action_repair_order_tree")
|
||||||
result = action.read()[0]
|
result = action.read()[0]
|
||||||
@@ -124,7 +120,6 @@ class RmaOrderLine(models.Model):
|
|||||||
result["res_id"] = repair_ids[0]
|
result["res_id"] = repair_ids[0]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _get_rma_repaired_qty(self):
|
def _get_rma_repaired_qty(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
qty = 0.0
|
qty = 0.0
|
||||||
@@ -135,7 +130,6 @@ class RmaOrderLine(models.Model):
|
|||||||
qty += repair_qty
|
qty += repair_qty
|
||||||
return qty
|
return qty
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _get_rma_under_repair_qty(self):
|
def _get_rma_under_repair_qty(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
qty = 0.0
|
qty = 0.0
|
||||||
@@ -155,7 +149,6 @@ class RmaOrderLine(models.Model):
|
|||||||
self.repair_type = self.operation_id.repair_type or "no"
|
self.repair_type = self.operation_id.repair_type or "no"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@api.multi
|
|
||||||
@api.depends(
|
@api.depends(
|
||||||
"move_ids",
|
"move_ids",
|
||||||
"move_ids.state",
|
"move_ids.state",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
from odoo import fields
|
||||||
from odoo.tests import common
|
from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
@@ -12,24 +13,23 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
cls.rma_obj = cls.env["rma.order"]
|
cls.rma_obj = cls.env["rma.order"]
|
||||||
cls.rma_line_obj = cls.env["rma.order.line"]
|
cls.rma_line_obj = cls.env["rma.order.line"]
|
||||||
cls.rma_op = cls.env["rma.operation"]
|
cls.rma_op = cls.env["rma.operation"]
|
||||||
cls.rma_add_invoice_wiz = cls.env["rma_add_invoice"]
|
cls.rma_add_invoice_wiz = cls.env["rma_add_account_move"]
|
||||||
cls.rma_make_repair_wiz = cls.env["rma.order.line.make.repair"]
|
cls.rma_make_repair_wiz = cls.env["rma.order.line.make.repair"]
|
||||||
cls.repair_line_obj = cls.env["repair.line"]
|
cls.repair_line_obj = cls.env["repair.line"]
|
||||||
cls.acc_obj = cls.env["account.account"]
|
cls.acc_obj = cls.env["account.account"]
|
||||||
cls.inv_obj = cls.env["account.invoice"]
|
cls.inv_obj = cls.env["account.move"]
|
||||||
cls.invl_obj = cls.env["account.invoice.line"]
|
cls.invl_obj = cls.env["account.move.line"]
|
||||||
cls.product_obj = cls.env["product.product"]
|
cls.product_obj = cls.env["product.product"]
|
||||||
cls.partner_obj = cls.env["res.partner"]
|
cls.partner_obj = cls.env["res.partner"]
|
||||||
|
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
||||||
cls.rma_route_cust = cls.env.ref("rma.route_rma_customer")
|
cls.rma_route_cust = cls.env.ref("rma.route_rma_customer")
|
||||||
receivable_type = cls.env.ref("account.data_account_type_receivable")
|
|
||||||
|
|
||||||
# Create partners
|
# Create partners
|
||||||
customer1 = cls.partner_obj.create({"name": "Customer 1"})
|
cls.customer1 = cls.partner_obj.create({"name": "Customer 1"})
|
||||||
|
|
||||||
# Create RMA group and operation:
|
# Create RMA group and operation:
|
||||||
cls.rma_group_customer = cls.rma_obj.create(
|
cls.rma_group_customer = cls.rma_obj.create(
|
||||||
{"partner_id": customer1.id, "type": "customer"}
|
{"partner_id": cls.customer1.id, "type": "customer"}
|
||||||
)
|
)
|
||||||
cls.operation_1 = cls.rma_op.create(
|
cls.operation_1 = cls.rma_op.create(
|
||||||
{
|
{
|
||||||
@@ -91,58 +91,59 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
# Create Invoices:
|
# Create Invoices:
|
||||||
customer_account = cls.acc_obj.search(
|
|
||||||
[("user_type_id", "=", receivable_type.id)], limit=1
|
cls.company_id = cls.env.user.company_id
|
||||||
).id
|
cls.currency_id = cls.company_id.currency_id
|
||||||
cls.inv_customer = cls.inv_obj.create(
|
|
||||||
|
cls.inv_customer = cls.env["account.move"].create(
|
||||||
|
[
|
||||||
{
|
{
|
||||||
"partner_id": customer1.id,
|
|
||||||
"account_id": customer_account,
|
|
||||||
"type": "out_invoice",
|
"type": "out_invoice",
|
||||||
}
|
"partner_id": cls.customer1.id,
|
||||||
)
|
"invoice_date": fields.Date.from_string("2016-01-01"),
|
||||||
cls.inv_line_1 = cls.invl_obj.create(
|
"currency_id": cls.currency_id.id,
|
||||||
|
"invoice_line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
None,
|
||||||
{
|
{
|
||||||
"name": cls.product_1.name,
|
|
||||||
"product_id": cls.product_1.id,
|
"product_id": cls.product_1.id,
|
||||||
"quantity": 12.0,
|
"product_uom_id": cls.product_1.uom_id.id,
|
||||||
"price_unit": 100.0,
|
"quantity": 12,
|
||||||
"invoice_id": cls.inv_customer.id,
|
"price_unit": 1000,
|
||||||
"uom_id": cls.product_1.uom_id.id,
|
},
|
||||||
"account_id": customer_account,
|
),
|
||||||
}
|
(
|
||||||
)
|
0,
|
||||||
cls.inv_line_2 = cls.invl_obj.create(
|
None,
|
||||||
{
|
{
|
||||||
"name": cls.product_2.name,
|
|
||||||
"product_id": cls.product_2.id,
|
"product_id": cls.product_2.id,
|
||||||
|
"product_uom_id": cls.product_2.uom_id.id,
|
||||||
"quantity": 15.0,
|
"quantity": 15.0,
|
||||||
"price_unit": 150.0,
|
"price_unit": 150.0,
|
||||||
"invoice_id": cls.inv_customer.id,
|
},
|
||||||
"uom_id": cls.product_2.uom_id.id,
|
),
|
||||||
"account_id": customer_account,
|
(
|
||||||
}
|
0,
|
||||||
)
|
None,
|
||||||
cls.inv_customer2 = cls.inv_obj.create(
|
|
||||||
{
|
{
|
||||||
"partner_id": customer1.id,
|
|
||||||
"account_id": customer_account,
|
|
||||||
"type": "out_invoice",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
cls.inv_line_3 = cls.invl_obj.create(
|
|
||||||
{
|
|
||||||
"name": cls.product_3.name,
|
|
||||||
"product_id": cls.product_3.id,
|
"product_id": cls.product_3.id,
|
||||||
"quantity": 1.0,
|
"product_uom_id": cls.product_3.uom_id.id,
|
||||||
"price_unit": 1000.0,
|
"quantity": 1,
|
||||||
"invoice_id": cls.inv_customer2.id,
|
"price_unit": 1000,
|
||||||
"uom_id": cls.product_3.uom_id.id,
|
},
|
||||||
"account_id": customer_account,
|
),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cls.inv_line_1 = cls.inv_customer.invoice_line_ids[0]
|
||||||
|
cls.inv_line_2 = cls.inv_customer.invoice_line_ids[1]
|
||||||
|
cls.inv_line_3 = cls.inv_customer.invoice_line_ids[2]
|
||||||
|
|
||||||
cls.rma_group_customer_2 = cls.rma_obj.create(
|
cls.rma_group_customer_2 = cls.rma_obj.create(
|
||||||
{"partner_id": customer1.id, "type": "customer"}
|
{"partner_id": cls.customer1.id, "type": "customer"}
|
||||||
)
|
)
|
||||||
cls.bank_journal = cls.env["account.journal"].search(
|
cls.bank_journal = cls.env["account.journal"].search(
|
||||||
[("type", "=", "bank")], limit=1
|
[("type", "=", "bank")], limit=1
|
||||||
@@ -160,9 +161,9 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
"active_ids": self.rma_group_customer.id,
|
"active_ids": self.rma_group_customer.id,
|
||||||
"active_model": "rma.order",
|
"active_model": "rma.order",
|
||||||
}
|
}
|
||||||
).create({"invoice_line_ids": [(6, 0, self.inv_customer.invoice_line_ids.ids)]})
|
).create({"line_ids": [(6, 0, self.inv_customer.invoice_line_ids.ids)]})
|
||||||
add_inv.add_lines()
|
add_inv.add_lines()
|
||||||
self.assertEqual(len(self.rma_group_customer.rma_line_ids), 2)
|
self.assertEqual(len(self.rma_group_customer.rma_line_ids), 3)
|
||||||
rma_1 = self.rma_group_customer.rma_line_ids.filtered(
|
rma_1 = self.rma_group_customer.rma_line_ids.filtered(
|
||||||
lambda r: r.product_id == self.product_1
|
lambda r: r.product_id == self.product_1
|
||||||
)
|
)
|
||||||
@@ -209,7 +210,7 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
self.assertEqual(rma.qty_repaired, 0.0)
|
self.assertEqual(rma.qty_repaired, 0.0)
|
||||||
make_repair = self.rma_make_repair_wiz.with_context(
|
make_repair = self.rma_make_repair_wiz.with_context(
|
||||||
{"customer": True, "active_ids": rma.ids, "active_model": "rma.order.line"}
|
{"customer": True, "active_ids": rma.ids, "active_model": "rma.order.line"}
|
||||||
).create({"description": "Test refund"})
|
).new()
|
||||||
make_repair.make_repair_order()
|
make_repair.make_repair_order()
|
||||||
rma.repair_ids.action_repair_confirm()
|
rma.repair_ids.action_repair_confirm()
|
||||||
self.assertEqual(rma.repair_count, 1)
|
self.assertEqual(rma.repair_count, 1)
|
||||||
@@ -225,9 +226,7 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
"active_ids": self.rma_group_customer_2.id,
|
"active_ids": self.rma_group_customer_2.id,
|
||||||
"active_model": "rma.order",
|
"active_model": "rma.order",
|
||||||
}
|
}
|
||||||
).create(
|
).create({"line_ids": [(6, 0, self.inv_customer.invoice_line_ids.ids)]})
|
||||||
{"invoice_line_ids": [(6, 0, self.inv_customer2.invoice_line_ids.ids)]}
|
|
||||||
)
|
|
||||||
add_inv.add_lines()
|
add_inv.add_lines()
|
||||||
rma = self.rma_group_customer_2.rma_line_ids.filtered(
|
rma = self.rma_group_customer_2.rma_line_ids.filtered(
|
||||||
lambda r: r.product_id == self.product_3
|
lambda r: r.product_id == self.product_3
|
||||||
@@ -239,7 +238,7 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
self.assertEqual(rma.qty_to_deliver, 0.0)
|
self.assertEqual(rma.qty_to_deliver, 0.0)
|
||||||
make_repair = self.rma_make_repair_wiz.with_context(
|
make_repair = self.rma_make_repair_wiz.with_context(
|
||||||
{"customer": True, "active_ids": rma.ids, "active_model": "rma.order.line"}
|
{"customer": True, "active_ids": rma.ids, "active_model": "rma.order.line"}
|
||||||
).create({"description": "Test deliver"})
|
).new()
|
||||||
make_repair.make_repair_order()
|
make_repair.make_repair_order()
|
||||||
repair = rma.repair_ids
|
repair = rma.repair_ids
|
||||||
line = self.repair_line_obj.create(
|
line = self.repair_line_obj.create(
|
||||||
@@ -262,9 +261,12 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
repair.action_repair_end()
|
repair.action_repair_end()
|
||||||
repair.action_repair_invoice_create()
|
repair.action_repair_invoice_create()
|
||||||
self.assertEqual(rma.qty_repaired, 1.0)
|
self.assertEqual(rma.qty_repaired, 1.0)
|
||||||
repair.invoice_id.action_invoice_open()
|
|
||||||
self.assertEqual(rma.qty_to_deliver, 0.0)
|
self.assertEqual(rma.qty_to_deliver, 0.0)
|
||||||
repair.invoice_id.pay_and_reconcile(self.bank_journal, 200.0)
|
repair.invoice_id.post()
|
||||||
self.assertEqual(repair.invoice_status, "paid")
|
|
||||||
|
repair.invoice_id.action_invoice_register_payment()
|
||||||
|
self.assertEqual(repair.invoice_status, "posted")
|
||||||
self.assertEqual(rma.qty_to_pay, 0.0)
|
self.assertEqual(rma.qty_to_pay, 0.0)
|
||||||
self.assertEqual(rma.qty_to_deliver, 1.0)
|
self.assertEqual(rma.qty_repaired, 1.0)
|
||||||
|
self.assertEqual(rma.delivery_policy, "repair")
|
||||||
|
self.assertEqual(rma.qty_delivered, 0.0)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from . import rma_order_line_make_repair
|
from . import rma_order_line_make_repair
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2020 ForgeFlow S.L.
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
import odoo.addons.decimal_precision as dp
|
|
||||||
|
|
||||||
|
|
||||||
class RmaLineMakeRepair(models.TransientModel):
|
class RmaLineMakeRepair(models.TransientModel):
|
||||||
_name = "rma.order.line.make.repair"
|
_name = "rma.order.line.make.repair"
|
||||||
@@ -56,7 +54,6 @@ class RmaLineMakeRepair(models.TransientModel):
|
|||||||
res["item_ids"] = items
|
res["item_ids"] = items
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def make_repair_order(self):
|
def make_repair_order(self):
|
||||||
res = []
|
res = []
|
||||||
repair_obj = self.env["repair.order"]
|
repair_obj = self.env["repair.order"]
|
||||||
@@ -68,7 +65,6 @@ class RmaLineMakeRepair(models.TransientModel):
|
|||||||
return {
|
return {
|
||||||
"domain": [("id", "in", res)],
|
"domain": [("id", "in", res)],
|
||||||
"name": _("Repairs"),
|
"name": _("Repairs"),
|
||||||
"view_type": "form",
|
|
||||||
"view_mode": "tree,form",
|
"view_mode": "tree,form",
|
||||||
"res_model": "repair.order",
|
"res_model": "repair.order",
|
||||||
"view_id": False,
|
"view_id": False,
|
||||||
@@ -106,9 +102,7 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
|||||||
product_id = fields.Many2one(
|
product_id = fields.Many2one(
|
||||||
comodel_name="product.product", string="Product", readonly=True
|
comodel_name="product.product", string="Product", readonly=True
|
||||||
)
|
)
|
||||||
product_qty = fields.Float(
|
product_qty = fields.Float(string="Quantity to repair", digits="Product UoS")
|
||||||
string="Quantity to repair", digits=dp.get_precision("Product UoS")
|
|
||||||
)
|
|
||||||
product_uom_id = fields.Many2one(
|
product_uom_id = fields.Many2one(
|
||||||
comodel_name="uom.uom", string="UoM", readonly=True
|
comodel_name="uom.uom", string="UoM", readonly=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="view_rma_order_line_make_repair" model="ir.ui.view">
|
<record id="view_rma_order_line_make_repair" model="ir.ui.view">
|
||||||
@@ -43,7 +41,6 @@
|
|||||||
<field name="name">Create Repair</field>
|
<field name="name">Create Repair</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">rma.order.line.make.repair</field>
|
<field name="res_model">rma.order.line.make.repair</field>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">form</field>
|
<field name="view_mode">form</field>
|
||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
<field name="binding_model_id" ref="rma_repair.model_rma_order_line"/>
|
<field name="binding_model_id" ref="rma_repair.model_rma_order_line"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user