mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-24 23:32:05 +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 sale_order_line_rma_wizard
|
||||
from . import sale_order_rma_wizard
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# Copyright 2024 Raumschmiede GmbH
|
||||
# Copyright 2024 BCIM
|
||||
# Copyright 2024 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrderLineRmaWizard(models.TransientModel):
|
||||
|
||||
_inherit = "sale.order.line.rma.wizard"
|
||||
|
||||
reason_id = fields.Many2one(
|
||||
comodel_name="rma.reason",
|
||||
compute="_compute_reason_id",
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
is_rma_reason_required = fields.Boolean(
|
||||
related="order_id.company_id.is_rma_reason_required"
|
||||
)
|
||||
operation_domain = fields.Binary(compute="_compute_operation_domain")
|
||||
|
||||
@api.depends("reason_id")
|
||||
def _compute_operation_domain(self):
|
||||
for rec in self:
|
||||
if rec.reason_id and rec.reason_id.allowed_operation_ids:
|
||||
rec.operation_domain = [
|
||||
("id", "in", rec.reason_id.allowed_operation_ids.ids)
|
||||
]
|
||||
else:
|
||||
rec.operation_domain = []
|
||||
|
||||
@api.depends("wizard_id.reason_id")
|
||||
def _compute_reason_id(self):
|
||||
for rec in self:
|
||||
if rec.wizard_id.reason_id:
|
||||
rec.reason_id = rec.wizard_id.reason_id
|
||||
|
||||
def _prepare_rma_values(self):
|
||||
values = super()._prepare_rma_values()
|
||||
if self.reason_id:
|
||||
values["reason_id"] = self.reason_id.id
|
||||
return values
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Copyright 2024 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrderRmaWizard(models.TransientModel):
|
||||
|
||||
_inherit = "sale.order.rma.wizard"
|
||||
|
||||
reason_id = fields.Many2one(comodel_name="rma.reason")
|
||||
operation_domain = fields.Binary(compute="_compute_operation_domain")
|
||||
|
||||
@api.depends("reason_id")
|
||||
def _compute_operation_domain(self):
|
||||
for rec in self:
|
||||
if rec.reason_id and rec.reason_id.allowed_operation_ids:
|
||||
rec.operation_domain = [
|
||||
("id", "in", rec.reason_id.allowed_operation_ids.ids)
|
||||
]
|
||||
else:
|
||||
rec.operation_domain = []
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2024 Raumschmiede GmbH
|
||||
Copyright 2024 BCIM
|
||||
Copyright 2024 ACSONE SA/NV
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="sale_order_rma_wizard_form_view">
|
||||
<field name="model">sale.order.rma.wizard</field>
|
||||
<field name="inherit_id" ref="rma_sale.sale_order_rma_wizard_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='operation_id']" position="before">
|
||||
<field name="reason_id" />
|
||||
<field name="operation_domain" invisible="1" />
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='operation_id']" position="attributes">
|
||||
<attribute name="domain">operation_domain</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']//field[@name='operation_id']"
|
||||
position="before"
|
||||
>
|
||||
<field name="is_rma_reason_required" invisible="True" />
|
||||
<field name="operation_domain" invisible="1" />
|
||||
<field
|
||||
name="reason_id"
|
||||
attrs="{'required': [('is_rma_reason_required', '=', True), ('quantity', '>', 0)]}"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']//field[@name='operation_id']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="domain">operation_domain</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue