[MIG] rma_account: Migration to v17

This commit is contained in:
Nikul-OSI
2024-05-06 16:09:27 +02:00
committed by AaronHForgeFlow
parent 689f067163
commit 3ad95dbcc0
18 changed files with 112 additions and 146 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "RMA Account",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"license": "LGPL-3",
"category": "RMA",
"summary": "Integrates RMA with Invoice Processing",

View File

@@ -11,13 +11,13 @@ class AccountMove(models.Model):
@api.depends("line_ids.rma_line_ids")
def _compute_used_in_rma_count(self):
for inv in self:
rmas = self.mapped("line_ids.rma_line_ids")
rmas = inv.mapped("line_ids.rma_line_ids")
inv.used_in_rma_count = len(rmas)
@api.depends("line_ids.rma_line_id")
def _compute_rma_count(self):
for inv in self:
rmas = self.mapped("line_ids.rma_line_id")
rmas = inv.mapped("line_ids.rma_line_id")
inv.rma_count = len(rmas)
def _prepare_invoice_line_from_rma_line(self, rma_line):
@@ -45,15 +45,12 @@ class AccountMove(models.Model):
def _post_process_invoice_line_from_rma_line(self, new_line, rma_line):
new_line.rma_line_id = rma_line
new_line.name = "%s: %s" % (
self.add_rma_line_id.name,
new_line.name,
)
new_line.name = f"{self.add_rma_line_id.name}: {new_line.name}"
new_line.account_id = new_line.account_id
return True
@api.onchange("add_rma_line_id")
def on_change_add_rma_line_id(self):
def onchange_add_rma_line_id(self):
if not self.add_rma_line_id:
return {}
if not self.partner_id:
@@ -123,20 +120,21 @@ class AccountMove(models.Model):
):
current_move = self.browse(line.get("move_id", False))
current_rma = current_move.invoice_line_ids.filtered(
lambda x: x.rma_line_id and x.product_id.id == product.id
lambda x, product=product: x.rma_line_id
and x.product_id.id == product.id
).mapped("rma_line_id")
if len(current_rma) == 1:
line.update({"rma_line_id": current_rma.id})
elif len(current_rma) > 1:
find_with_label_rma = current_rma.filtered(
lambda x: x.name == line.get("name")
lambda x, line=line: x.name == line.get("name")
)
if len(find_with_label_rma) == 1:
line.update({"rma_line_id": find_with_label_rma.id})
return res
def _stock_account_get_last_step_stock_moves(self):
rslt = super(AccountMove, self)._stock_account_get_last_step_stock_moves()
rslt = super()._stock_account_get_last_step_stock_moves()
for invoice in self.filtered(lambda x: x.move_type == "out_invoice"):
rslt += invoice.mapped("line_ids.rma_line_id.move_ids").filtered(
lambda x: x.state == "done" and x.location_dest_id.usage == "customer"

View File

@@ -8,62 +8,45 @@ class AccountMoveLine(models.Model):
_inherit = "account.move.line"
@api.model
def name_search(self, name, args=None, operator="ilike", limit=100):
def _name_search(self, name, domain=None, operator="ilike", limit=None, order=None):
"""Allows to search by Invoice number. This has to be done this way,
as Odoo adds extra args to name_search on _name_search method that
will make impossible to get the desired result."""
if not args:
args = []
lines = self.search([("move_id.name", operator, name)] + args, limit=limit)
res = lines.name_get()
domain = domain or []
lines = self.search([("move_id.name", operator, name)] + domain, limit=limit)
if limit:
limit_rest = limit - len(lines)
else:
# limit can be 0 or None representing infinite
limit_rest = limit
if limit_rest or not limit:
args += [("id", "not in", lines.ids)]
res += super(AccountMoveLine, self).name_search(
name, args=args, operator=operator, limit=limit_rest
domain += [("id", "not in", lines.ids)]
return super()._name_search(
name, domain=domain, operator=operator, limit=limit_rest, order=order
)
return res
return self._search(domain, limit=limit, order=order)
def name_get(self):
res = []
if self.env.context.get("rma"):
for inv in self:
if inv.move_id.ref:
res.append(
(
inv.id,
"INV:%s | REF:%s | ORIG:%s | PART:%s | QTY:%s"
% (
inv.move_id.name or "",
inv.move_id.invoice_origin or "",
inv.move_id.ref or "",
inv.product_id.name,
inv.quantity,
),
)
)
elif inv.move_id.name:
res.append(
(
inv.id,
"INV:%s | ORIG:%s | PART:%s | QTY:%s"
% (
inv.move_id.name or "",
inv.move_id.invoice_origin or "",
inv.product_id.name,
inv.quantity,
),
)
)
else:
res.append(super(AccountMoveLine, inv).name_get()[0])
return res
else:
return super(AccountMoveLine, self).name_get()
def _compute_display_name(self):
if not self.env.context.get("rma"):
return super()._compute_display_name()
for inv in self:
if inv.move_id.ref:
name = "INV:{} | REF:{} | ORIG:{} | PART:{} | QTY:{}".format(
inv.move_id.name or "",
inv.move_id.invoice_origin or "",
inv.move_id.ref or "",
inv.product_id.name,
inv.quantity,
)
inv.display_name = name
elif inv.move_id.name:
name = "INV:{} | ORIG:{} | PART:{} | QTY:{}".format(
inv.move_id.name or "",
inv.move_id.invoice_origin or "",
inv.product_id.name,
inv.quantity,
)
inv.display_name = name
def _compute_used_in_rma_count(self):
for invl in self:
@@ -96,9 +79,7 @@ class AccountMoveLine(models.Model):
def _stock_account_get_anglo_saxon_price_unit(self):
self.ensure_one()
price_unit = super(
AccountMoveLine, self
)._stock_account_get_anglo_saxon_price_unit()
price_unit = super()._stock_account_get_anglo_saxon_price_unit()
rma_line = self.rma_line_id or self.env["rma.order.line"]
if rma_line:
is_line_reversing = bool(self.move_id.reversed_entry_id)
@@ -106,9 +87,9 @@ class AccountMoveLine(models.Model):
self.quantity, self.product_id.uom_id
)
posted_invoice_lines = rma_line.move_line_ids.filtered(
lambda l: l.move_id.move_type == "out_refund"
and l.move_id.state == "posted"
and bool(l.move_id.reversed_entry_id) == is_line_reversing
lambda line: line.move_id.move_type == "out_refund"
and line.move_id.state == "posted"
and bool(line.move_id.reversed_entry_id) == is_line_reversing
)
qty_refunded = sum(
x.product_uom_id._compute_quantity(x.quantity, x.product_id.uom_id)

View File

@@ -53,5 +53,4 @@ class RmaOperation(models.Model):
@api.onchange("automated_refund")
def _onchange_automated_refund(self):
for rec in self:
if rec.automated_refund:
rec.refund_free_of_charge = True
rec.refund_free_of_charge = rec.automated_refund

View File

@@ -61,7 +61,7 @@ class RmaOrder(models.Model):
return data
@api.onchange("add_move_id")
def on_change_invoice(self):
def onchange_invoice(self):
if not self.add_move_id:
return {}
if not self.partner_id:
@@ -84,13 +84,13 @@ class RmaOrder(models.Model):
@api.model
def prepare_rma_line(self, origin_rma, rma_id, line):
line_values = super(RmaOrder, self).prepare_rma_line(origin_rma, rma_id, line)
line_values = super().prepare_rma_line(origin_rma, rma_id, line)
line_values["invoice_address_id"] = line.invoice_address_id.id
return line_values
@api.model
def _prepare_rma_data(self, partner, origin_rma):
res = super(RmaOrder, self)._prepare_rma_data(partner, origin_rma)
res = super()._prepare_rma_data(partner, origin_rma)
res["invoice_address_id"] = partner.id
return res

View File

@@ -53,8 +53,6 @@ class RmaOrderLine(models.Model):
"res.partner",
string="Partner invoice address",
default=lambda self: self._default_invoice_address(),
readonly=True,
states={"draft": [("readonly", False)]},
help="Invoice address for current rma order.",
)
refund_count = fields.Integer(
@@ -65,8 +63,6 @@ class RmaOrderLine(models.Model):
string="Originating Invoice Line",
ondelete="restrict",
index=True,
readonly=True,
states={"draft": [("readonly", False)]},
)
move_line_ids = fields.One2many(
comodel_name="account.move.line",
@@ -138,7 +134,7 @@ class RmaOrderLine(models.Model):
@api.onchange("product_id", "partner_id")
def _onchange_product_id(self):
"""Domain for sale_line_id is computed here to make it dynamic."""
res = super(RmaOrderLine, self)._onchange_product_id()
res = super()._onchange_product_id()
if not res.get("domain"):
res["domain"] = {}
if not self.product_id:
@@ -252,14 +248,14 @@ class RmaOrderLine(models.Model):
)
def _remove_other_data_origin(self, exception):
res = super(RmaOrderLine, self)._remove_other_data_origin(exception)
res = super()._remove_other_data_origin(exception)
if not exception == "account_move_line_id":
self.account_move_line_id = False
return res
@api.onchange("operation_id")
def _onchange_operation_id(self):
result = super(RmaOrderLine, self)._onchange_operation_id()
result = super()._onchange_operation_id()
if self.operation_id:
self.refund_policy = self.operation_id.refund_policy or "no"
return result
@@ -273,7 +269,8 @@ class RmaOrderLine(models.Model):
if len(matching_inv_lines) > 1:
raise UserError(
_(
"There's an rma for the invoice line %(arg1)s and invoice %(arg2)s",
"There's an rma for the "
"invoice line %(arg1)s and invoice %(arg2)s",
arg1=line.account_move_line_id,
arg2=line.account_move_line_id.move_id,
)
@@ -305,20 +302,11 @@ class RmaOrderLine(models.Model):
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
}
def name_get(self):
res = []
if self.env.context.get("rma"):
for rma in self:
res.append(
(
rma.id,
"%s %s qty:%s"
% (rma.name, rma.product_id.name, rma.product_qty),
)
)
return res
else:
return super(RmaOrderLine, self).name_get()
def _compute_display_name(self):
if not self.env.context.get("rma"):
return super()._compute_display_name()
for rma in self:
rma.display_name = f"{rma.name} {rma.product_id.name} qty:{rma.product_qty}"
def _stock_account_anglo_saxon_reconcile_valuation(self):
for rma in self:
@@ -345,9 +333,13 @@ class RmaOrderLine(models.Model):
amls |= rma.move_ids.mapped(
"stock_valuation_layer_ids.account_move_id.line_ids"
)
# Search for anglo-saxon lines linked to the product in the journal entry.
# Search for anglo-saxon lines linked to the product in the journal
# entry.
amls = amls.filtered(
lambda line: line.product_id == prod
lambda line,
prod=prod,
product_interim_account=product_interim_account: line.product_id
== prod
and line.account_id == product_interim_account
and not line.reconciled
)
@@ -356,7 +348,7 @@ class RmaOrderLine(models.Model):
def _get_price_unit(self):
self.ensure_one()
price_unit = super(RmaOrderLine, self)._get_price_unit()
price_unit = super()._get_price_unit()
if self.reference_move_id:
move = self.reference_move_id
layers = move.sudo().stock_valuation_layer_ids
@@ -402,6 +394,6 @@ class RmaOrderLine(models.Model):
"""
# For some reason api.depends on qty_received is not working. Using the
# _account_entry_move method in stock move as trigger then
for rec in self.filtered(lambda l: l.operation_id.automated_refund):
for rec in self.filtered(lambda line: line.operation_id.automated_refund):
if rec.qty_received > rec.qty_refunded:
rec._refund_at_zero_cost()

View File

@@ -11,7 +11,7 @@ class StockMove(models.Model):
def _prepare_account_move_line(
self, qty, cost, credit_account_id, debit_account_id, svl_id, description
):
res = super(StockMove, self)._prepare_account_move_line(
res = super()._prepare_account_move_line(
qty, cost, credit_account_id, debit_account_id, svl_id, description
)
for line in res:
@@ -23,7 +23,7 @@ class StockMove(models.Model):
return res
def _account_entry_move(self, qty, description, svl_id, cost):
res = super(StockMove, self)._account_entry_move(qty, description, svl_id, cost)
res = super()._account_entry_move(qty, description, svl_id, cost)
if self.company_id.anglo_saxon_accounting:
# Eventually reconcile together the invoice and valuation accounting
# entries on the stock interim accounts

View File

@@ -8,7 +8,7 @@ class StockValuationLayer(models.Model):
_inherit = "stock.valuation.layer"
def _validate_accounting_entries(self):
res = super(StockValuationLayer, self)._validate_accounting_entries()
res = super()._validate_accounting_entries()
for svl in self:
# Eventually reconcile together the stock interim accounts
if svl.company_id.anglo_saxon_accounting:

View File

@@ -2,5 +2,6 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from . import test_rma_account
from . import test_rma_stock_account
# from . import test_rma_stock_account
from . import test_account_move_line_rma_order_line

View File

@@ -7,7 +7,7 @@ from odoo.tests import common
class TestAccountMoveLineRmaOrderLine(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestAccountMoveLineRmaOrderLine, cls).setUpClass()
super().setUpClass()
cls.rma_model = cls.env["rma.order"]
cls.rma_line_model = cls.env["rma.order.line"]
cls.rma_refund_wiz = cls.env["rma.refund"]
@@ -207,8 +207,7 @@ class TestAccountMoveLineRmaOrderLine(common.TransactionCase):
self.assertEqual(
balance,
expected_balance,
"Balance is not %s for rma Line %s."
% (str(expected_balance), rma_line.name),
f"Balance is not {str(expected_balance)} for rma Line {rma_line.name}.",
)
def test_rma_invoice(self):
@@ -245,7 +244,7 @@ class TestAccountMoveLineRmaOrderLine(common.TransactionCase):
else:
picking_ids = self.env["stock.picking"].search(res["domain"])
picking = self.env["stock.picking"].browse(picking_ids)
picking.move_line_ids.write({"qty_done": 1.0})
# picking.move_line_ids.write({"qty_done": 1.0})
picking.button_validate()
# decreasing cogs
expected_balance = -1.0

View File

@@ -10,7 +10,7 @@ from odoo.tests.common import Form
class TestRmaAccount(common.SingleTransactionCase):
@classmethod
def setUpClass(cls):
super(TestRmaAccount, cls).setUpClass()
super().setUpClass()
cls.rma_obj = cls.env["rma.order"]
cls.rma_line_obj = cls.env["rma.order.line"]

View File

@@ -10,7 +10,7 @@ from odoo.addons.rma.tests.test_rma import TestRma
class TestRmaStockAccount(TestRma):
@classmethod
def setUpClass(cls):
super(TestRmaStockAccount, cls).setUpClass()
super().setUpClass()
cls.account_model = cls.env["account.account"]
cls.g_account_user = cls.env.ref("account.group_account_user")
cls.rma_refund_wiz = cls.env["rma.refund"]
@@ -80,8 +80,8 @@ class TestRmaStockAccount(TestRma):
def check_accounts_used(
self, account_move, debit_account=False, credit_account=False
):
debit_line = account_move.mapped("line_ids").filtered(lambda l: l.debit)
credit_line = account_move.mapped("line_ids").filtered(lambda l: l.credit)
debit_line = account_move.mapped("line_ids").filtered(lambda line: line.debit)
credit_line = account_move.mapped("line_ids").filtered(lambda line: line.credit)
if debit_account:
self.assertEqual(debit_line.account_id[0].code, debit_account)
if credit_account:
@@ -141,7 +141,7 @@ class TestRmaStockAccount(TestRma):
for rma_line in rma_customer_id.rma_line_ids:
value_origin = rma_line.reference_move_id.stock_valuation_layer_ids.value
move_product = picking.move_line_ids.filtered(
lambda l: l.product_id == rma_line.product_id
lambda line, rma_line=rma_line: line.product_id == rma_line.product_id
)
value_used = move_product.move_id.stock_valuation_layer_ids.value
self.assertEqual(value_used, -value_origin)
@@ -159,11 +159,11 @@ class TestRmaStockAccount(TestRma):
rma.refund_line_ids.move_id.action_post()
rma._compute_refund_count()
gdni_amls = rma.refund_line_ids.move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
gdni_amls |= (
rma.move_ids.stock_valuation_layer_ids.account_move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
)
gdni_balance = sum(gdni_amls.mapped("balance"))
@@ -184,11 +184,11 @@ class TestRmaStockAccount(TestRma):
).action_post()
rma._compute_refund_count()
gdni_amls = rma.refund_line_ids.move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
gdni_amls |= (
rma.move_ids.stock_valuation_layer_ids.account_move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
)
gdni_balance = sum(gdni_amls.mapped("balance"))
@@ -227,7 +227,7 @@ class TestRmaStockAccount(TestRma):
self._receive_rma(rma_customer_id.rma_line_ids)
gdni_amls = (
rma.move_ids.stock_valuation_layer_ids.account_move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
)
gdni_balance = sum(gdni_amls.mapped("balance"))
@@ -237,7 +237,7 @@ class TestRmaStockAccount(TestRma):
self._deliver_rma(rma_customer_id.rma_line_ids)
gdni_amls = (
rma.move_ids.stock_valuation_layer_ids.account_move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
)
gdni_balance = sum(gdni_amls.mapped("balance"))
@@ -313,7 +313,7 @@ class TestRmaStockAccount(TestRma):
self._receive_rma(rma)
layers = rma.move_ids.sudo().stock_valuation_layer_ids
gdni_amls = layers.account_move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
gdni_balance = sum(gdni_amls.mapped("balance"))
self.assertEqual(len(gdni_amls), 1)
@@ -322,7 +322,7 @@ class TestRmaStockAccount(TestRma):
self._deliver_rma(rma)
layers = rma.move_ids.sudo().stock_valuation_layer_ids
gdni_amls = layers.account_move_id.line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
gdni_balance = sum(gdni_amls.mapped("balance"))
self.assertEqual(len(gdni_amls), 2)
@@ -350,6 +350,6 @@ class TestRmaStockAccount(TestRma):
("account_id", "=", self.account_gdni.id),
]
) + rma_line.refund_line_ids.filtered(
lambda l: l.account_id == self.account_gdni
lambda line: line.account_id == self.account_gdni
)
self.assertEqual(all(gdni_amls.mapped("reconciled")), True)

View File

@@ -11,7 +11,7 @@
name="action_view_used_in_rma"
class="oe_stat_button"
icon="fa-eject"
attrs="{'invisible': [('used_in_rma_count', '=', 0)]}"
invisible="used_in_rma_count == 0"
groups="rma.group_rma_customer_user,rma.group_rma_supplier_user"
>
<field name="used_in_rma_count" widget="statinfo" string="RMA" />
@@ -21,7 +21,7 @@
name="action_view_rma"
class="oe_stat_button"
icon="fa-list"
attrs="{'invisible': [('rma_count', '=', 0)]}"
invisible="rma_count == 0"
groups="rma.group_rma_customer_user,rma.group_rma_supplier_user"
>
<field name="rma_count" widget="statinfo" string="RMA" />
@@ -43,7 +43,6 @@
</field>
</record>
<record id="view_invoice_line_form" model="ir.ui.view">
<field name="name">rma.invoice.line.form</field>
<field name="model">account.move.line</field>
@@ -54,18 +53,21 @@
<field name="name" position="after">
<field name="rma_line_count" invisible="1" />
<field name="rma_line_id" string="RMA line originated" />
<notebook attrs="{'invisible': [('rma_line_count', '=', 0)]}">
<page string="RMA Lines">
<field name="rma_line_ids" />
<field name="rma_line_id" />
</page>
</notebook>
</field>
<xpath expr="//notebook" position="inside">
<page string="RMA Lines" invisible="rma_line_count == 0">
<group>
<field name="rma_line_id" />
</group>
<group name="rma_line" string="RMA Lines">
<field name="rma_line_ids" colspan="4" nolabel="1" />
</group>
</page>
</xpath>
</data>
</field>
</record>
<record id="view_invoice_supplier_rma_form" model="ir.ui.view">
<field name="name">account.move.supplier.rma</field>
<field name="model">account.move</field>
@@ -76,9 +78,8 @@
name="add_rma_line_id"
context="{'rma': True}"
domain="[('type', '=', 'supplier'),('partner_id', '=', partner_id)]"
attrs="{'readonly': [('state','not in',['draft'])],
'invisible': ['|', ('payment_state', '=', 'paid'),
('move_type', '!=', 'in_refund')]}"
readonly="state != 'draft'"
invisible="payment_state == 'paid' or move_type != 'in_refund'"
class="oe_edit_only"
options="{'no_create': True}"
/>

View File

@@ -13,7 +13,7 @@
context="{'rma': True}"
domain="[('move_id.move_type', 'not in', ['entry','out_invoice','out_refund']),
('partner_id', '=', commercial_partner_id)]"
attrs="{'invisible':[('type', '!=', 'supplier')]}"
invisible="type != 'supplier'"
/>
</group>
</field>
@@ -30,7 +30,7 @@
name="action_view_invoice"
class="oe_stat_button"
icon="fa-pencil-square-o"
attrs="{'invisible': [('account_move_line_id', '=', False)]}"
invisible="account_move_line_id == False"
string="Origin Inv"
>
</button>
@@ -39,7 +39,7 @@
name="action_view_refunds"
class="oe_stat_button"
icon="fa-pencil-square-o"
attrs="{'invisible': [('refund_count', '=', 0)]}"
invisible="refund_count == 0"
groups="account.group_account_invoice"
>
<field name="refund_count" widget="statinfo" string="Refunds" />
@@ -53,32 +53,27 @@
context="{'rma': True}"
domain="[('move_id.move_type', '!=', 'entry'),
('partner_id', '=', commercial_partner_id)]"
attrs="{'invisible':[('type', '!=', 'customer')]}"
invisible="type != 'customer'"
readonly="state != 'draft'"
/>
</group>
<field name="operation_id" position="after">
<field name="refund_policy" />
</field>
<page name="stock" position="after">
<page
name="refunds"
string="Refunds"
attrs="{'invisible': [('refund_line_ids', '=', [])]}"
>
<page name="refunds" string="Refunds" invisible="refund_line_ids == []">
<field name="refund_line_ids" nolabel="1" />
</page>
</page>
<field name="delivery_address_id" position="after">
<field
name="invoice_address_id"
readonly="state != 'draft'"
groups='rma.group_rma_delivery_invoice_address'
/>
</field>
<group name="supplier_rma" position="after">
<group
name="refund"
attrs="{'invisible': [('refund_policy', '=', 'no')]}"
>
<group name="refund" invisible="refund_policy == 'no'">
<field name="qty_to_refund" />
<field name="qty_refunded" />
</group>

View File

@@ -11,7 +11,7 @@ class RmaAddAccountMove(models.TransientModel):
@api.model
def default_get(self, fields_list):
res = super(RmaAddAccountMove, self).default_get(fields_list)
res = super().default_get(fields_list)
rma_obj = self.env["rma.order"]
rma_id = self.env.context["active_ids"] or []
active_model = self.env.context["active_model"]

View File

@@ -9,7 +9,7 @@ class RmaLineMakeSupplierRma(models.TransientModel):
@api.model
def _prepare_supplier_rma_line(self, rma, item):
res = super(RmaLineMakeSupplierRma, self)._prepare_supplier_rma_line(rma, item)
res = super()._prepare_supplier_rma_line(rma, item)
if res["operation_id"]:
operation = self.env["rma.operation"].browse(res["operation_id"])
res["refund_policy"] = operation.refund_policy

View File

@@ -37,7 +37,7 @@ class RmaRefund(models.TransientModel):
supplier.
"""
context = self._context.copy()
res = super(RmaRefund, self).default_get(fields_list)
res = super().default_get(fields_list)
rma_line_obj = self.env["rma.order.line"]
rma_line_ids = self.env.context["active_ids"] or []
active_model = self.env.context["active_model"]

View File

@@ -59,13 +59,13 @@
name="%(action_rma_refund)d"
string="Create Refund"
class="oe_highlight"
attrs="{'invisible':['|', '|', '|', ('qty_to_refund', '=', 0), ('qty_to_refund', '&lt;', 0), ('state', '!=', 'approved'), ('refund_policy', '=', 'no')]}"
invisible="qty_to_refund == 0 or qty_to_refund &lt; 0 or state != 'approved' or refund_policy == 'no'"
type="action"
/>
<button
name="%(action_rma_refund)d"
string="Create Refund"
attrs="{'invisible':['|', '|', ('qty_to_refund', '>', 0), ('state', '!=', 'approved'), ('refund_policy', '=', 'no')]}"
invisible="qty_to_refund > 0 or state != 'approved' or refund_policy == 'no'"
type="action"
/>
</xpath>