mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-21 02:12:08 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import stock_return_picking
|
||||
from . import stock_return_picking_line
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright 2024 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockReturnPicking(models.TransientModel):
|
||||
|
||||
_inherit = "stock.return.picking"
|
||||
|
||||
rma_reason_id = fields.Many2one(
|
||||
comodel_name="rma.reason", readonly=False, string="RMA Reason"
|
||||
)
|
||||
rma_operation_domain = fields.Binary(compute="_compute_rma_operation_domain")
|
||||
|
||||
@api.depends("rma_reason_id")
|
||||
def _compute_rma_operation_domain(self):
|
||||
for rec in self:
|
||||
if rec.rma_reason_id and rec.rma_reason_id.allowed_operation_ids:
|
||||
rec.rma_operation_domain = [
|
||||
("id", "in", rec.rma_reason_id.allowed_operation_ids.ids)
|
||||
]
|
||||
else:
|
||||
rec.rma_operation_domain = []
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?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//field[@name='rma_operation_id']"
|
||||
position="before"
|
||||
>
|
||||
<field
|
||||
name="rma_reason_id"
|
||||
attrs="{'column_invisible': [('parent.create_rma', '=', False)], 'required': [('is_rma_reason_required', '=', True), ('parent.create_rma', '=', True), ('quantity', '>', 0)]}"
|
||||
/>
|
||||
<field name="is_rma_reason_required" invisible="1" />
|
||||
<field name="rma_operation_domain" invisible="1" />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='product_return_moves']//tree//field[@name='rma_operation_id']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="domain">rma_operation_domain</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//group[@name='group_rma']//field[@name='rma_operation_id']"
|
||||
position="before"
|
||||
>
|
||||
<field
|
||||
name="rma_reason_id"
|
||||
attrs="{'invisible': [('create_rma', '=', False)]}"
|
||||
/>
|
||||
<field name="rma_operation_domain" invisible="1" />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//group[@name='group_rma']//field[@name='rma_operation_id']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="domain">rma_operation_domain</attribute>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# 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,
|
||||
string="RMA Reason",
|
||||
)
|
||||
is_rma_reason_required = fields.Boolean(
|
||||
related="wizard_id.company_id.is_rma_reason_required"
|
||||
)
|
||||
rma_operation_domain = fields.Binary(compute="_compute_rma_operation_domain")
|
||||
|
||||
@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
|
||||
|
||||
@api.depends("rma_reason_id")
|
||||
def _compute_rma_operation_domain(self):
|
||||
for rec in self:
|
||||
if rec.rma_reason_id and rec.rma_reason_id.allowed_operation_ids:
|
||||
rec.rma_operation_domain = [
|
||||
("id", "in", rec.rma_reason_id.allowed_operation_ids.ids)
|
||||
]
|
||||
else:
|
||||
rec.rma_operation_domain = []
|
||||
Loading…
Add table
Add a link
Reference in a new issue