mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[MIG] rma_repair: Migration to 14.0
This commit is contained in:
committed by
JasminSForgeFlow
parent
1fd2fb738f
commit
2463db943b
@@ -2,7 +2,7 @@
|
|||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
"name": "RMA Repair",
|
"name": "RMA Repair",
|
||||||
"version": "13.0.1.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"category": "RMA",
|
"category": "RMA",
|
||||||
"summary": "Links RMA with Repairs.",
|
"summary": "Links RMA with Repairs.",
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"website": "https://github.com/OCA/https://github.com/ForgeFlow/stock-rma",
|
"website": "https://github.com/OCA/https://github.com/ForgeFlow/stock-rma",
|
||||||
"depends": ["rma_account", "repair_refurbish"],
|
"depends": ["rma_account", "repair_refurbish"],
|
||||||
"data": [
|
"data": [
|
||||||
|
"security/ir.model.access.csv",
|
||||||
"views/rma_order_view.xml",
|
"views/rma_order_view.xml",
|
||||||
"views/rma_operation_view.xml",
|
"views/rma_operation_view.xml",
|
||||||
"views/repair_view.xml",
|
"views/repair_view.xml",
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ class RmaOrderLine(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
delivery_policy = fields.Selection(
|
delivery_policy = fields.Selection(
|
||||||
selection_add=[("repair", "Based on Repair Quantities")]
|
selection_add=[("repair", "Based on Repair Quantities")],
|
||||||
|
ondelete={"repair": lambda recs: recs.write({"delivery_policy": "no"})},
|
||||||
)
|
)
|
||||||
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")
|
||||||
@@ -100,13 +101,17 @@ class RmaOrderLine(models.Model):
|
|||||||
"repair_ids.invoice_status",
|
"repair_ids.invoice_status",
|
||||||
)
|
)
|
||||||
def _compute_qty_to_pay(self):
|
def _compute_qty_to_pay(self):
|
||||||
for rec in self.filtered(lambda l: l.delivery_policy == "repair"):
|
for rec in self:
|
||||||
|
if rec.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 != "posted"
|
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
|
||||||
|
else:
|
||||||
|
rec.qty_to_pay = 0.0
|
||||||
|
|
||||||
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")
|
||||||
|
|||||||
5
rma_repair/security/ir.model.access.csv
Normal file
5
rma_repair/security/ir.model.access.csv
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_rma_order_line_make_repair_customer_user_item,rma.order.line.make.repair.customer.user,model_rma_order_line_make_repair,rma.group_rma_customer_user,1,1,1,1
|
||||||
|
access_rma_order_line_make_supplier_user_item,rma.order.line.make.repair.supplier.user,model_rma_order_line_make_repair,rma.group_rma_supplier_user,1,1,1,1
|
||||||
|
access_rma_order_line_make_repair_item_customer_user_item,rma.order.line.make.repair.item.customer.user,model_rma_order_line_make_repair_item,rma.group_rma_customer_user,1,1,1,1
|
||||||
|
access_rma_order_line_make_repair_item_supplier_user_item,rma.order.line.make.repair.item.supplier.user,model_rma_order_line_make_repair_item,rma.group_rma_supplier_user,1,1,1,1
|
||||||
|
@@ -98,7 +98,7 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
cls.inv_customer = cls.env["account.move"].create(
|
cls.inv_customer = cls.env["account.move"].create(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"type": "out_invoice",
|
"move_type": "out_invoice",
|
||||||
"partner_id": cls.customer1.id,
|
"partner_id": cls.customer1.id,
|
||||||
"invoice_date": fields.Date.from_string("2016-01-01"),
|
"invoice_date": fields.Date.from_string("2016-01-01"),
|
||||||
"currency_id": cls.currency_id.id,
|
"currency_id": cls.currency_id.id,
|
||||||
@@ -263,7 +263,7 @@ class TestRmaRepair(common.SingleTransactionCase):
|
|||||||
self.assertEqual(rma.qty_repaired, 1.0)
|
self.assertEqual(rma.qty_repaired, 1.0)
|
||||||
self.assertEqual(rma.qty_to_deliver, 1.0)
|
self.assertEqual(rma.qty_to_deliver, 1.0)
|
||||||
repair.invoice_id.post()
|
repair.invoice_id.post()
|
||||||
repair.invoice_id.action_invoice_register_payment()
|
repair.invoice_id.action_register_payment()
|
||||||
self.assertEqual(repair.invoice_status, "posted")
|
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_repaired, 1.0)
|
self.assertEqual(rma.qty_repaired, 1.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user