mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX]rma_account test + adding from existing invoice
This commit is contained in:
@@ -91,33 +91,27 @@ class RmaOrder(models.Model):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def action_view_invoice_refund(self):
|
def action_view_invoice_refund(self):
|
||||||
action = self.env.ref("account.action_invoice_tree2")
|
move_ids = self.mapped("rma_line_ids.move_id").ids
|
||||||
result = action.read()[0]
|
form_view_ref = self.env.ref("account.view_move_form", False)
|
||||||
move_ids = self.mapped("rma_line_ids.refund_line_ids.move_id").ids
|
tree_view_ref = self.env.ref("account.view_move_tree", False)
|
||||||
if move_ids:
|
|
||||||
# choose the view_mode accordingly
|
return {
|
||||||
if len(move_ids) > 1:
|
"domain": [("id", "in", move_ids)],
|
||||||
result["domain"] = [("id", "in", move_ids)]
|
"name": "Refunds",
|
||||||
else:
|
"res_model": "account.move",
|
||||||
res = self.env.ref("account.move_supplier_form", False)
|
"type": "ir.actions.act_window",
|
||||||
result["views"] = [(res and res.id or False, "form")]
|
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
|
||||||
result["res_id"] = move_ids[0]
|
}
|
||||||
return result
|
|
||||||
|
|
||||||
def action_view_invoice(self):
|
def action_view_invoice(self):
|
||||||
if self.type == "supplier":
|
|
||||||
action = self.env.ref("account.action_invoice_tree2")
|
|
||||||
res = self.env.ref("account.move_supplier_form", False)
|
|
||||||
else:
|
|
||||||
action = self.env.ref("account.action_invoice_tree")
|
|
||||||
res = self.env.ref("account.view_move_form", False)
|
|
||||||
result = action.read()[0]
|
|
||||||
move_ids = self.mapped("rma_line_ids.move_id").ids
|
move_ids = self.mapped("rma_line_ids.move_id").ids
|
||||||
if move_ids:
|
form_view_ref = self.env.ref("account.view_move_form", False)
|
||||||
# choose the view_mode accordingly
|
tree_view_ref = self.env.ref("account.view_move_tree", False)
|
||||||
if len(move_ids) > 1:
|
|
||||||
result["domain"] = [("id", "in", move_ids)]
|
return {
|
||||||
else:
|
"domain": [("id", "in", move_ids)],
|
||||||
result["views"] = [(res and res.id or False, "form")]
|
"name": "Originating Invoice",
|
||||||
result["res_id"] = move_ids[0]
|
"res_model": "account.move",
|
||||||
return result
|
"type": "ir.actions.act_window",
|
||||||
|
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
|
|
||||||
from odoo.addons import decimal_precision as dp
|
|
||||||
|
|
||||||
|
|
||||||
class RmaOrderLine(models.Model):
|
class RmaOrderLine(models.Model):
|
||||||
_inherit = "rma.order.line"
|
_inherit = "rma.order.line"
|
||||||
@@ -24,7 +22,7 @@ class RmaOrderLine(models.Model):
|
|||||||
for rec in self:
|
for rec in self:
|
||||||
rec.qty_refunded = sum(
|
rec.qty_refunded = sum(
|
||||||
rec.refund_line_ids.filtered(
|
rec.refund_line_ids.filtered(
|
||||||
lambda i: i.move_id.state in ("open", "paid")
|
lambda i: i.move_id.state in ("posted")
|
||||||
).mapped("quantity")
|
).mapped("quantity")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -122,12 +120,16 @@ class RmaOrderLine(models.Model):
|
|||||||
if not res.get("domain"):
|
if not res.get("domain"):
|
||||||
res["domain"] = {}
|
res["domain"] = {}
|
||||||
domain = [
|
domain = [
|
||||||
|
"&",
|
||||||
|
"&",
|
||||||
|
("rma_line_id", "=", False),
|
||||||
|
("exclude_from_invoice_tab", "=", False),
|
||||||
"|",
|
"|",
|
||||||
("move_id.partner_id", "=", self.partner_id.id),
|
("move_id.partner_id", "=", self.partner_id.id),
|
||||||
("move_id.partner_id", "child_of", self.partner_id.id),
|
("move_id.partner_id", "child_of", self.partner_id.id),
|
||||||
]
|
]
|
||||||
if self.product_id:
|
# if self.product_id:
|
||||||
domain.append(("product_id", "=", self.product_id.id))
|
# domain.insert(2, ("product_id", "=", self.product_id.id))
|
||||||
res["domain"]["account_move_line_id"] = domain
|
res["domain"]["account_move_line_id"] = domain
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@@ -247,27 +249,29 @@ class RmaOrderLine(models.Model):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
def action_view_invoice(self):
|
def action_view_invoice(self):
|
||||||
action = self.env.ref("account.action_invoice_tree")
|
form_view_ref = self.env.ref("account.view_move_form", False)
|
||||||
result = action.read()[0]
|
tree_view_ref = self.env.ref("account.view_move_tree", False)
|
||||||
res = self.env.ref("account.view_move_form", False)
|
|
||||||
result["views"] = [(res and res.id or False, "form")]
|
return {
|
||||||
result["view_id"] = res and res.id or False
|
"domain": [("id", "in", [self.account_move_line_id.move_id.id])],
|
||||||
result["res_id"] = self.account_move_line_id.move_id.id
|
"name": "Originating Invoice",
|
||||||
return result
|
"res_model": "account.move",
|
||||||
|
"type": "ir.actions.act_window",
|
||||||
|
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
|
||||||
|
}
|
||||||
|
|
||||||
def action_view_refunds(self):
|
def action_view_refunds(self):
|
||||||
action = self.env.ref("account.action_invoice_tree2")
|
|
||||||
result = action.read()[0]
|
|
||||||
move_ids = self.mapped("refund_line_ids.move_id").ids
|
move_ids = self.mapped("refund_line_ids.move_id").ids
|
||||||
if move_ids:
|
form_view_ref = self.env.ref("account.view_move_form", False)
|
||||||
# choose the view_mode accordingly
|
tree_view_ref = self.env.ref("account.view_move_tree", False)
|
||||||
if len(move_ids) > 1:
|
|
||||||
result["domain"] = [("id", "in", move_ids)]
|
return {
|
||||||
else:
|
"domain": [("id", "in", move_ids)],
|
||||||
res = self.env.ref("account.move_supplier_form", False)
|
"name": "Refunds",
|
||||||
result["views"] = [(res and res.id or False, "form")]
|
"res_model": "account.move",
|
||||||
result["res_id"] = move_ids[0]
|
"type": "ir.actions.act_window",
|
||||||
return result
|
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
|
||||||
|
}
|
||||||
|
|
||||||
def name_get(self):
|
def name_get(self):
|
||||||
res = []
|
res = []
|
||||||
|
|||||||
0
rma_account/security/ir.model.access.csv
Executable file → Normal file
0
rma_account/security/ir.model.access.csv
Executable file → Normal file
@@ -1,6 +1,7 @@
|
|||||||
# Copyright 2017-18 ForgeFlow S.L.
|
# Copyright 2017-18 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/lgpl.html)
|
||||||
|
|
||||||
|
from odoo import fields
|
||||||
from odoo.tests import common
|
from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
@@ -12,22 +13,22 @@ class TestRmaAccount(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_obj = cls.env["rma.operation"]
|
cls.rma_op_obj = 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_refund_wiz = cls.env["rma.refund"]
|
cls.rma_refund_wiz = cls.env["rma.refund"]
|
||||||
cls.acc_obj = cls.env["account.account"]
|
cls.acc_obj = cls.env["account.account"]
|
||||||
cls.inv_obj = cls.env["account.move"]
|
cls.inv_obj = cls.env["account.move"]
|
||||||
cls.invl_obj = cls.env["account.move.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"]
|
customer1_obj = cls.env["res.partner"]
|
||||||
|
|
||||||
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")
|
receivable_type = cls.env.ref("account.data_account_type_receivable")
|
||||||
payable_type = cls.env.ref("account.data_account_type_payable")
|
|
||||||
cls.cust_refund_op = cls.env.ref("rma_account.rma_operation_customer_refund")
|
cls.cust_refund_op = cls.env.ref("rma_account.rma_operation_customer_refund")
|
||||||
|
cls.sup_refund_op = cls.env.ref("rma_account.rma_operation_supplier_refund")
|
||||||
|
cls.company_id = cls.env.user.company_id
|
||||||
# Create partners
|
# Create partners
|
||||||
customer1 = cls.partner_obj.create({"name": "Customer 1"})
|
customer1 = customer1_obj.create({"name": "Customer 1"})
|
||||||
supplier1 = cls.partner_obj.create({"name": "Supplier 1"})
|
supplier1 = customer1_obj.create({"name": "Supplier 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(
|
||||||
@@ -55,6 +56,7 @@ class TestRmaAccount(common.SingleTransactionCase):
|
|||||||
"type": "product",
|
"type": "product",
|
||||||
"list_price": 100.0,
|
"list_price": 100.0,
|
||||||
"rma_customer_operation_id": cls.cust_refund_op.id,
|
"rma_customer_operation_id": cls.cust_refund_op.id,
|
||||||
|
"rma_supplier_operation_id": cls.sup_refund_op.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
cls.product_2 = cls.product_obj.create(
|
cls.product_2 = cls.product_obj.create(
|
||||||
@@ -63,81 +65,78 @@ class TestRmaAccount(common.SingleTransactionCase):
|
|||||||
"type": "product",
|
"type": "product",
|
||||||
"list_price": 150.0,
|
"list_price": 150.0,
|
||||||
"rma_customer_operation_id": cls.operation_1.id,
|
"rma_customer_operation_id": cls.operation_1.id,
|
||||||
|
"rma_supplier_operation_id": cls.sup_refund_op.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
cls.product_3 = cls.product_obj.create(
|
cls.currency_id = cls.company_id.currency_id
|
||||||
{"name": "Test Product 3", "type": "product"}
|
|
||||||
)
|
|
||||||
cls.product_4 = cls.product_obj.create(
|
|
||||||
{"name": "Test Product 4", "type": "product"}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create Invoices:
|
# Create Invoices:
|
||||||
customer_account = cls.acc_obj.search(
|
cls.customer_account = cls.acc_obj.search(
|
||||||
[("user_type_id", "=", receivable_type.id)], limit=1
|
[("user_type_id", "=", receivable_type.id)], limit=1
|
||||||
).id
|
).id
|
||||||
cls.inv_customer = cls.inv_obj.create(
|
|
||||||
{
|
|
||||||
"partner_id": customer1.id,
|
|
||||||
"account_id": customer_account,
|
|
||||||
"type": "out_invoice",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
cls.inv_line_1 = cls.invl_obj.create(
|
|
||||||
{
|
|
||||||
"name": cls.product_1.name,
|
|
||||||
"product_id": cls.product_1.id,
|
|
||||||
"quantity": 12.0,
|
|
||||||
"price_unit": 100.0,
|
|
||||||
"move_id": cls.inv_customer.id,
|
|
||||||
"uom_id": cls.product_1.uom_id.id,
|
|
||||||
"account_id": customer_account,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
cls.inv_line_2 = cls.invl_obj.create(
|
|
||||||
{
|
|
||||||
"name": cls.product_2.name,
|
|
||||||
"product_id": cls.product_2.id,
|
|
||||||
"quantity": 15.0,
|
|
||||||
"price_unit": 150.0,
|
|
||||||
"move_id": cls.inv_customer.id,
|
|
||||||
"uom_id": cls.product_2.uom_id.id,
|
|
||||||
"account_id": customer_account,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
supplier_account = cls.acc_obj.search(
|
cls.invoices = cls.env["account.move"].create(
|
||||||
[("user_type_id", "=", payable_type.id)], limit=1
|
[
|
||||||
).id
|
{
|
||||||
cls.inv_supplier = cls.inv_obj.create(
|
"type": "out_invoice",
|
||||||
{
|
"partner_id": customer1.id,
|
||||||
"partner_id": supplier1.id,
|
"invoice_date": fields.Date.from_string("2016-01-01"),
|
||||||
"account_id": supplier_account,
|
"currency_id": cls.currency_id.id,
|
||||||
"type": "in_invoice",
|
"invoice_line_ids": [
|
||||||
}
|
(
|
||||||
)
|
0,
|
||||||
cls.inv_line_3 = cls.invl_obj.create(
|
None,
|
||||||
{
|
{
|
||||||
"name": cls.product_3.name,
|
"product_id": cls.product_1.id,
|
||||||
"product_id": cls.product_3.id,
|
"product_uom_id": cls.product_1.uom_id.id,
|
||||||
"quantity": 17.0,
|
"quantity": 3,
|
||||||
"price_unit": 250.0,
|
"price_unit": 1000,
|
||||||
"move_id": cls.inv_supplier.id,
|
},
|
||||||
"uom_id": cls.product_3.uom_id.id,
|
),
|
||||||
"account_id": supplier_account,
|
(
|
||||||
}
|
0,
|
||||||
)
|
None,
|
||||||
cls.inv_line_4 = cls.invl_obj.create(
|
{
|
||||||
{
|
"product_id": cls.product_2.id,
|
||||||
"name": cls.product_4.name,
|
"product_uom_id": cls.product_2.uom_id.id,
|
||||||
"product_id": cls.product_4.id,
|
"quantity": 2,
|
||||||
"quantity": 9.0,
|
"price_unit": 3000,
|
||||||
"price_unit": 300.0,
|
},
|
||||||
"move_id": cls.inv_supplier.id,
|
),
|
||||||
"uom_id": cls.product_4.uom_id.id,
|
],
|
||||||
"account_id": supplier_account,
|
},
|
||||||
}
|
{
|
||||||
|
"type": "in_invoice",
|
||||||
|
"partner_id": supplier1.id,
|
||||||
|
"invoice_date": fields.Date.from_string("2016-01-01"),
|
||||||
|
"currency_id": cls.currency_id.id,
|
||||||
|
"invoice_line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
None,
|
||||||
|
{
|
||||||
|
"product_id": cls.product_1.id,
|
||||||
|
"product_uom_id": cls.product_1.uom_id.id,
|
||||||
|
"quantity": 3,
|
||||||
|
"price_unit": 1000,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
None,
|
||||||
|
{
|
||||||
|
"product_id": cls.product_2.id,
|
||||||
|
"product_uom_id": cls.product_2.uom_id.id,
|
||||||
|
"quantity": 2,
|
||||||
|
"price_unit": 3000,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
cls.inv_customer = cls.invoices[0]
|
||||||
|
cls.inv_supplier = cls.invoices[1]
|
||||||
|
|
||||||
def test_01_add_from_invoice_customer(self):
|
def test_01_add_from_invoice_customer(self):
|
||||||
"""Test wizard to create RMA from a customer invoice."""
|
"""Test wizard to create RMA from a customer invoice."""
|
||||||
@@ -147,8 +146,9 @@ class TestRmaAccount(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({"line_ids": [(6, 0, self.inv_customer.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), 2)
|
||||||
for t in self.rma_group_supplier.rma_line_ids.mapped("type"):
|
for t in self.rma_group_supplier.rma_line_ids.mapped("type"):
|
||||||
self.assertEqual(t, "customer")
|
self.assertEqual(t, "customer")
|
||||||
@@ -190,7 +190,7 @@ class TestRmaAccount(common.SingleTransactionCase):
|
|||||||
)
|
)
|
||||||
rma_2._onchange_operation_id()
|
rma_2._onchange_operation_id()
|
||||||
self.assertEqual(rma_2.refund_policy, "ordered")
|
self.assertEqual(rma_2.refund_policy, "ordered")
|
||||||
self.assertEqual(rma_2.qty_to_refund, 15.0)
|
self.assertEqual(rma_2.qty_to_refund, 2.0)
|
||||||
|
|
||||||
def test_04_rma_create_refund(self):
|
def test_04_rma_create_refund(self):
|
||||||
"""Generate a Refund from a customer RMA."""
|
"""Generate a Refund from a customer RMA."""
|
||||||
@@ -200,27 +200,27 @@ class TestRmaAccount(common.SingleTransactionCase):
|
|||||||
rma.action_rma_to_approve()
|
rma.action_rma_to_approve()
|
||||||
rma.action_rma_approve()
|
rma.action_rma_approve()
|
||||||
self.assertEqual(rma.refund_count, 0)
|
self.assertEqual(rma.refund_count, 0)
|
||||||
self.assertEqual(rma.qty_to_refund, 15.0)
|
self.assertEqual(rma.qty_to_refund, 2.0)
|
||||||
self.assertEqual(rma.qty_refunded, 0.0)
|
self.assertEqual(rma.qty_refunded, 0.0)
|
||||||
make_refund = self.rma_refund_wiz.with_context(
|
make_refund = self.rma_refund_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"})
|
).create({"description": "Test refund"})
|
||||||
make_refund.invoice_refund()
|
make_refund.invoice_refund()
|
||||||
rma.refund_line_ids.move_id.action_invoice_open()
|
rma.refund_line_ids.move_id.post()
|
||||||
rma._compute_refund_count()
|
rma._compute_refund_count()
|
||||||
self.assertEqual(rma.refund_count, 1)
|
self.assertEqual(rma.refund_count, 1)
|
||||||
self.assertEqual(rma.qty_to_refund, 0.0)
|
self.assertEqual(rma.qty_to_refund, 0.0)
|
||||||
self.assertEqual(rma.qty_refunded, 15.0)
|
self.assertEqual(rma.qty_refunded, 2.0)
|
||||||
|
|
||||||
def test_05_fill_rma_from_inv_line(self):
|
def test_05_fill_rma_from_inv_line(self):
|
||||||
"""Test filling a RMA (line) from a invoice line."""
|
"""Test filling a RMA (line) from a invoice line."""
|
||||||
rma = self.rma_line_obj.new(
|
rma = self.rma_line_obj.new(
|
||||||
{
|
{
|
||||||
"partner_id": self.inv_customer.partner_id.id,
|
"partner_id": self.inv_customer.partner_id.id,
|
||||||
"account_move_line_id": self.inv_line_1.id,
|
"account_move_line_id": self.inv_supplier.line_ids.ids[0],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertFalse(rma.product_id)
|
self.assertFalse(rma.product_id)
|
||||||
rma._onchange_account_move_line_id()
|
rma._onchange_account_move_line_id()
|
||||||
self.assertEqual(rma.product_id, self.product_1)
|
self.assertEqual(rma.product_id, self.product_1)
|
||||||
self.assertEqual(rma.product_qty, 12.0)
|
self.assertEqual(rma.product_qty, 3.0)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class RmaAddAccountMove(models.TransientModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def default_get(self, fields_list):
|
def default_get(self, fields_list):
|
||||||
res = super(RmaAddInvoice, self).default_get(fields_list)
|
res = super(RmaAddAccountMove, self).default_get(fields_list)
|
||||||
rma_obj = self.env["rma.order"]
|
rma_obj = self.env["rma.order"]
|
||||||
rma_id = self.env.context["active_ids"] or []
|
rma_id = self.env.context["active_ids"] or []
|
||||||
active_model = self.env.context["active_model"]
|
active_model = self.env.context["active_model"]
|
||||||
@@ -118,7 +118,9 @@ class RmaAddAccountMove(models.TransientModel):
|
|||||||
def add_lines(self):
|
def add_lines(self):
|
||||||
rma_line_obj = self.env["rma.order.line"]
|
rma_line_obj = self.env["rma.order.line"]
|
||||||
existing_invoice_lines = self._get_existing_invoice_lines()
|
existing_invoice_lines = self._get_existing_invoice_lines()
|
||||||
for line in self.line_ids:
|
for line in self.line_ids.filtered(
|
||||||
|
lambda aml: aml.exclude_from_invoice_tab is False
|
||||||
|
):
|
||||||
# Load a PO line only once
|
# Load a PO line only once
|
||||||
if line not in existing_invoice_lines:
|
if line not in existing_invoice_lines:
|
||||||
data = self._prepare_rma_line_from_inv_line(line)
|
data = self._prepare_rma_line_from_inv_line(line)
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
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 RmaRefund(models.TransientModel):
|
class RmaRefund(models.TransientModel):
|
||||||
_name = "rma.refund"
|
_name = "rma.refund"
|
||||||
@@ -116,8 +114,6 @@ class RmaRefund(models.TransientModel):
|
|||||||
values = {
|
values = {
|
||||||
"name": item.line_id.name or item.rma_id.name,
|
"name": item.line_id.name or item.rma_id.name,
|
||||||
"account_id": account.id,
|
"account_id": account.id,
|
||||||
"debit": item.line_id.price_unit, # todo fix
|
|
||||||
"credit": item.line_id.price_unit,
|
|
||||||
"price_unit": item.line_id.price_unit,
|
"price_unit": item.line_id.price_unit,
|
||||||
"product_uom_id": item.line_id.uom_id.id,
|
"product_uom_id": item.line_id.uom_id.id,
|
||||||
"product_id": item.product_id.id,
|
"product_id": item.product_id.id,
|
||||||
@@ -144,7 +140,6 @@ class RmaRefund(models.TransientModel):
|
|||||||
"ref": False,
|
"ref": False,
|
||||||
"type": "in_refund" if rma_line.type == "supplier" else "out_refund",
|
"type": "in_refund" if rma_line.type == "supplier" else "out_refund",
|
||||||
"journal_id": journal.id,
|
"journal_id": journal.id,
|
||||||
"currency_id": rma_line.partner_id.company_id.currency_id.id,
|
|
||||||
"fiscal_position_id": rma_line.partner_id.property_account_position_id.id,
|
"fiscal_position_id": rma_line.partner_id.property_account_position_id.id,
|
||||||
"state": "draft",
|
"state": "draft",
|
||||||
"currency_id": rma_line.currency_id.id,
|
"currency_id": rma_line.currency_id.id,
|
||||||
@@ -211,7 +206,7 @@ class RmaRefundItem(models.TransientModel):
|
|||||||
comodel_name="res.partner", string="Invoice Address"
|
comodel_name="res.partner", string="Invoice Address"
|
||||||
)
|
)
|
||||||
qty_to_refund = fields.Float(
|
qty_to_refund = fields.Float(
|
||||||
string="Quantity To Refund", digits=dp.get_precision("Product Unit of Measure")
|
string="Quantity To Refund", digits="Product Unit of Measure"
|
||||||
)
|
)
|
||||||
uom_id = fields.Many2one("uom.uom", string="Unit of Measure", readonly=True)
|
uom_id = fields.Many2one("uom.uom", string="Unit of Measure", readonly=True)
|
||||||
refund_policy = fields.Selection(
|
refund_policy = fields.Selection(
|
||||||
|
|||||||
Reference in New Issue
Block a user