[MIG] rma_account: Migration to 18.0

This commit is contained in:
JasminSForgeFlow
2024-11-27 16:48:06 +05:30
parent 88d09a067f
commit 21d35e3ff4
14 changed files with 45 additions and 50 deletions

View File

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

View File

@@ -97,23 +97,23 @@ class RmaOrder(models.Model):
def action_view_invoice_refund(self):
move_ids = self.mapped("rma_line_ids.move_id").ids
form_view_ref = self.env.ref("account.view_move_form", False)
tree_view_ref = self.env.ref("account.view_move_tree", False)
list_view_ref = self.env.ref("account.view_move_tree", False)
return {
"domain": [("id", "in", move_ids)],
"name": "Refunds",
"res_model": "account.move",
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
"views": [(list_view_ref.id, "list"), (form_view_ref.id, "form")],
}
def action_view_invoice(self):
move_ids = self.mapped("rma_line_ids.move_id").ids
form_view_ref = self.env.ref("account.view_move_form", False)
tree_view_ref = self.env.ref("account.view_move_tree", False)
list_view_ref = self.env.ref("account.view_move_tree", False)
return {
"domain": [("id", "in", move_ids)],
"name": "Originating Invoice",
"res_model": "account.move",
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
"views": [(list_view_ref.id, "list"), (form_view_ref.id, "form")],
}

View File

@@ -281,27 +281,27 @@ class RmaOrderLine(models.Model):
def action_view_invoice(self):
form_view_ref = self.env.ref("account.view_move_form", False)
tree_view_ref = self.env.ref("account.view_move_tree", False)
list_view_ref = self.env.ref("account.view_move_tree", False)
return {
"domain": [("id", "in", [self.account_move_line_id.move_id.id])],
"name": "Originating Invoice",
"res_model": "account.move",
"type": "ir.actions.act_window",
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
"views": [(list_view_ref.id, "list"), (form_view_ref.id, "form")],
}
def action_view_refunds(self):
moves = self.mapped("refund_line_ids.move_id")
form_view_ref = self.env.ref("account.view_move_form", False)
tree_view_ref = self.env.ref("account.view_move_tree", False)
list_view_ref = self.env.ref("account.view_move_tree", False)
return {
"domain": [("id", "in", moves.ids)],
"name": "Refunds",
"res_model": "account.move",
"type": "ir.actions.act_window",
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
"views": [(list_view_ref.id, "list"), (form_view_ref.id, "form")],
}
def _compute_display_name(self):

View File

@@ -87,7 +87,7 @@ class TestAccountMoveLineRmaOrderLine(common.TransactionCase):
"name": name,
"code": code,
"account_type": acc_type,
"company_id": company.id,
"company_ids": [(4, company.id)],
"reconcile": reconcile,
}
)
@@ -110,7 +110,7 @@ class TestAccountMoveLineRmaOrderLine(common.TransactionCase):
{
"name": "test_product",
"categ_id": product_ctg.id,
"type": "product",
"is_storable": True,
"standard_price": 1.0,
"list_price": 1.0,
}

View File

@@ -3,8 +3,7 @@
from odoo import fields
from odoo.fields import Date
from odoo.tests import common
from odoo.tests.common import Form
from odoo.tests import Form, common
class TestRmaAccount(common.SingleTransactionCase):
@@ -68,7 +67,7 @@ class TestRmaAccount(common.SingleTransactionCase):
cls.product_1 = cls.product_obj.create(
{
"name": "Test Product 1",
"type": "product",
"is_storable": True,
"list_price": 100.0,
"rma_customer_operation_id": cls.cust_refund_op.id,
"rma_supplier_operation_id": cls.sup_refund_op.id,
@@ -77,7 +76,7 @@ class TestRmaAccount(common.SingleTransactionCase):
cls.product_2 = cls.product_obj.create(
{
"name": "Test Product 2",
"type": "product",
"is_storable": True,
"list_price": 150.0,
"rma_customer_operation_id": cls.operation_1.id,
"rma_supplier_operation_id": cls.sup_refund_op.id,

View File

@@ -1,7 +1,7 @@
# Copyright 2017-22 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo.tests.common import Form
from odoo.tests import Form
# pylint: disable=odoo-addons-relative-import
from odoo.addons.rma.tests.test_rma import TestRma
@@ -71,7 +71,7 @@ class TestRmaStockAccount(TestRma):
"name": name,
"code": code,
"account_type": acc_type,
"company_id": company.id,
"company_ids": [(4, company.id)],
"reconcile": reconcile,
}
)

View File

@@ -29,13 +29,13 @@
</div>
<!-- Add link to rma_line_id to account.move.line -->
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='company_id']"
expr="//field[@name='invoice_line_ids']/list/field[@name='company_id']"
position="after"
>
<field name="rma_line_id" invisible="1" />
</xpath>
<xpath
expr="//field[@name='line_ids']/tree/field[@name='company_id']"
expr="//field[@name='line_ids']/list/field[@name='company_id']"
position="after"
>
<field name="rma_line_id" invisible="1" />
@@ -60,7 +60,7 @@
<field name="rma_line_id" />
</group>
<group name="rma_line" string="RMA Lines">
<field name="rma_line_ids" colspan="4" nolabel="1" />
<field name="rma_line_ids" colspan="4" nolabel="1" />
</group>
</page>
</xpath>
@@ -74,7 +74,7 @@
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<field name="invoice_vendor_bill_id" position="after">
<field
<field
name="add_rma_line_id"
context="{'rma': True}"
domain="[('type', '=', 'supplier'),('partner_id', '=', partner_id)]"

View File

@@ -8,7 +8,7 @@
<field name="res_model">rma.order.line</field>
<field name="domain">[('type','=', 'customer')]</field>
<field name="context">{"search_default_to_refund":1}</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
</record>
<record id="action_rma_supplier_lines" model="ir.actions.act_window">
@@ -16,7 +16,7 @@
<field name="res_model">rma.order.line</field>
<field name="domain">[('type','=', 'supplier')]</field>
<field name="context">{"search_default_to_refund":1, "supplier":1}</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="rma.view_rma_line_supplier_tree" />
</record>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<odoo>
<record id="rma_operation_tree" model="ir.ui.view">
<field name="name">rma.operation.tree</field>
<field name="name">rma.operation.list</field>
<field name="model">rma.operation</field>
<field name="inherit_id" ref="rma.rma_operation_tree" />
<field name="arch" type="xml">

View File

@@ -34,7 +34,7 @@
string="Origin Inv"
>
</button>
<button
<button
type="object"
name="action_view_refunds"
class="oe_stat_button"
@@ -42,8 +42,8 @@
invisible="refund_count == 0"
groups="account.group_account_invoice"
>
<field name="refund_count" widget="statinfo" string="Refunds" />
</button>
<field name="refund_count" widget="statinfo" string="Refunds" />
</button>
</button>
<group name="main_info" position="inside">
<field name="commercial_partner_id" invisible="1" />

View File

@@ -29,7 +29,7 @@
<field name="invoice_count" widget="statinfo" string="Origin Inv" />
</button>
</button>
<xpath expr="//field[@name='rma_line_ids']/tree" position="inside">
<xpath expr="//field[@name='rma_line_ids']/list" position="inside">
<field name="refund_policy" invisible="True" />
</xpath>
</field>

View File

@@ -14,7 +14,7 @@
name="line_ids"
domain="[('move_id.partner_id', '=', partner_id)]"
>
<tree name="Invoice Lines">
<list name="Invoice Lines">
<field name="move_id" />
<field name="name" />
<field
@@ -28,7 +28,7 @@
<field name="discount" groups="base.group_no_one" />
<field name="price_subtotal" />
<field name="currency_id" invisible="1" />
</tree>
</list>
</field>
<footer>
<button
@@ -36,9 +36,7 @@
name="add_lines"
type="object"
class="oe_highlight"
/>
or
<button
/> or <button
name="action_cancel"
string="Cancel"
class="oe_link"
@@ -62,7 +60,7 @@
name="line_ids"
domain="[('move_id.partner_id', '=', partner_id)]"
>
<tree name="Invoice Lines">
<list name="Invoice Lines">
<field name="move_id" />
<field name="name" />
<field
@@ -76,7 +74,7 @@
<field name="discount" groups="base.group_no_one" />
<field name="price_subtotal" />
<field name="currency_id" invisible="1" />
</tree>
</list>
</field>
<footer>
<button
@@ -84,9 +82,7 @@
name="add_lines"
type="object"
class="oe_highlight"
/>
or
<button
/> or <button
name="action_cancel"
string="Cancel"
class="oe_link"

View File

@@ -100,7 +100,7 @@ class RmaRefund(models.TransientModel):
if (new_invoice.move_type in ["out_refund", "out_invoice"])
else "action_move_in_refund_type"
)
result = self.env.ref("account.%s" % action).sudo().read()[0]
result = self.env.ref(f"account.{action}").sudo().read()[0]
form_view = self.env.ref("account.move_supplier_form", False)
result["views"] = [(form_view and form_view.id or False, "form")]
result["res_id"] = new_invoice.id

View File

@@ -6,16 +6,16 @@
<field name="arch" type="xml">
<form string="Credit Note">
<group>
<group>
<field name="description" />
</group>
<group>
<field name="date_invoice" />
<field name="date" />
</group>
<group>
<field name="description" />
</group>
<group>
<field name="date_invoice" />
<field name="date" />
</group>
</group>
<field name="item_ids">
<tree name="RMA Lines" editable="bottom">
<list name="RMA Lines" editable="bottom">
<field name="rma_id" invisible="1" readonly="1" />
<field name="product_id" invisible="1" readonly="1" />
<field name="product" />
@@ -24,7 +24,7 @@
<field name="product_qty" readonly="1" />
<field name="uom_id" groups="uom.group_uom" readonly="1" />
<field name="qty_to_refund" readonly="0" />
</tree>
</list>
</field>
<footer>
<button
@@ -35,14 +35,14 @@
/>
<button string="Cancel" class="btn-default" special="cancel" />
</footer>
</form>
</form>
</field>
</record>
<record id="action_rma_refund" model="ir.actions.act_window">
<field name="name">Create Refund</field>
<field name="res_model">rma.refund</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="view_rma_refund" />
<field name="binding_model_id" ref="rma.model_rma_order_line" />
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]" />