-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] rma_reason: add rma reason to stock return wizard
- Loading branch information
Showing
8 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import models | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import stock_return_picking | ||
from . import stock_return_picking_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockReturnPicking(models.TransientModel): | ||
|
||
_inherit = "stock.return.picking" | ||
|
||
rma_reason_id = fields.Many2one(comodel_name="rma.reason", readonly=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 ACSONE SA/NV | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="stock_return_picking_form_view"> | ||
<field name="model">stock.return.picking</field> | ||
<field name="inherit_id" ref="stock.view_stock_return_picking_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='product_return_moves']//tree" position="inside"> | ||
<field | ||
name="rma_reason_id" | ||
attrs="{'column_invisible': [('parent.create_rma', '=', False)], 'required': [('is_rma_reason_required', '=', True)]}" | ||
/> | ||
<field name="is_rma_reason_required" invisible="1" /> | ||
</xpath> | ||
<xpath | ||
expr="//group[@name='group_rma']//field[@name='rma_operation_id']" | ||
position="before" | ||
> | ||
<field | ||
name="rma_reason_id" | ||
attrs="{'invisible': [('create_rma', '=', False)]}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
|
||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockReturnPickingLine(models.TransientModel): | ||
|
||
_inherit = "stock.return.picking.line" | ||
|
||
rma_reason_id = fields.Many2one( | ||
comodel_name="rma.reason", | ||
compute="_compute_rma_reason_id", | ||
store=True, | ||
readonly=False, | ||
) | ||
is_rma_reason_required = fields.Boolean( | ||
related="wizard_id.company_id.is_rma_reason_required" | ||
) | ||
|
||
@api.depends("wizard_id.rma_reason_id") | ||
def _compute_rma_reason_id(self): | ||
for rec in self: | ||
if rec.wizard_id.rma_reason_id: | ||
rec.rma_reason_id = rec.wizard_id.rma_reason_id | ||
|
||
def _prepare_rma_vals(self): | ||
self.ensure_one() | ||
vals = super()._prepare_rma_vals() | ||
vals["reason_id"] = self.rma_reason_id.id | ||
return vals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters