mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[ADD] rma_repair_refurbish: split refurbish dependency from rma_repair
This commit is contained in:
committed by
JasminSForgeFlow
parent
7b24de7d68
commit
d85540c96c
@@ -2,13 +2,13 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "RMA Repair",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "15.0.2.0.0",
|
||||
"license": "AGPL-3",
|
||||
"category": "RMA",
|
||||
"summary": "Links RMA with Repairs.",
|
||||
"author": "ForgeFlow",
|
||||
"website": "https://github.com/ForgeFlow/stock-rma",
|
||||
"depends": ["rma_account", "repair_refurbish"],
|
||||
"depends": ["rma_account", "repair"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/rma_order_view.xml",
|
||||
|
||||
@@ -24,11 +24,6 @@ class RmaOperation(models.Model):
|
||||
comodel_name="stock.location",
|
||||
help="Indicate here the source location of the product to be repaired",
|
||||
)
|
||||
repair_location_dest_id = fields.Many2one(
|
||||
string="Repair Destination Location",
|
||||
comodel_name="stock.location",
|
||||
help="Indicate here the destination location of the repair",
|
||||
)
|
||||
repair_invoice_method = fields.Selection(
|
||||
selection=[
|
||||
("none", "No Invoice"),
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<group name="outbound" position="after">
|
||||
<group name="repair" string="Repair">
|
||||
<field name="repair_location_id" />
|
||||
<field name="repair_location_dest_id" />
|
||||
<field name="repair_invoice_method" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -17,11 +17,6 @@ class RmaLineMakeRepair(models.TransientModel):
|
||||
|
||||
@api.model
|
||||
def _prepare_item(self, line):
|
||||
if line.product_id.refurbish_product_id:
|
||||
to_refurbish = True
|
||||
refurbish_product_id = line.product_id.refurbish_product_id.id
|
||||
else:
|
||||
to_refurbish = refurbish_product_id = False
|
||||
return {
|
||||
"line_id": line.id,
|
||||
"product_id": line.product_id.id,
|
||||
@@ -30,12 +25,8 @@ class RmaLineMakeRepair(models.TransientModel):
|
||||
"out_route_id": line.out_route_id.id,
|
||||
"product_uom_id": line.uom_id.id,
|
||||
"partner_id": line.partner_id.id,
|
||||
"to_refurbish": to_refurbish,
|
||||
"refurbish_product_id": refurbish_product_id,
|
||||
"location_id": line.operation_id.repair_location_id.id
|
||||
or line.location_id.id,
|
||||
"location_dest_id": line.operation_id.repair_location_dest_id.id
|
||||
or line.location_id.id,
|
||||
"invoice_method": line.operation_id.repair_invoice_method or "after_repair",
|
||||
}
|
||||
|
||||
@@ -86,13 +77,6 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
||||
if rec.product_qty <= 0.0:
|
||||
raise ValidationError(_("Quantity must be positive."))
|
||||
|
||||
@api.onchange("to_refurbish")
|
||||
def _onchange_to_refurbish(self):
|
||||
if self.to_refurbish:
|
||||
self.refurbish_product_id = self.product_id.refurbish_product_id
|
||||
else:
|
||||
self.refurbish_product_id = False
|
||||
|
||||
wiz_id = fields.Many2one(
|
||||
comodel_name="rma.order.line.make.repair", string="Wizard", ondelete="cascade"
|
||||
)
|
||||
@@ -124,13 +108,6 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
||||
location_id = fields.Many2one(
|
||||
comodel_name="stock.location", string="Location", required=True
|
||||
)
|
||||
location_dest_id = fields.Many2one(
|
||||
comodel_name="stock.location", string="Destination location", required=True
|
||||
)
|
||||
to_refurbish = fields.Boolean(string="To Refurbish?")
|
||||
refurbish_product_id = fields.Many2one(
|
||||
comodel_name="product.product", string="Refurbished Product"
|
||||
)
|
||||
invoice_method = fields.Selection(
|
||||
selection=[
|
||||
("none", "No Invoice"),
|
||||
@@ -146,14 +123,6 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
||||
|
||||
def _prepare_repair_order(self, rma_line):
|
||||
self.ensure_one()
|
||||
location_dest = (
|
||||
self.location_dest_id
|
||||
if not self.to_refurbish
|
||||
else rma_line.product_id.property_stock_refurbish
|
||||
)
|
||||
refurbish_location_dest_id = (
|
||||
self.location_dest_id.id if self.to_refurbish else False
|
||||
)
|
||||
addr = rma_line.partner_id.address_get(["delivery", "invoice"])
|
||||
return {
|
||||
"product_id": rma_line.product_id.id,
|
||||
@@ -164,10 +133,6 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
||||
"product_uom": rma_line.product_id.uom_po_id.id,
|
||||
"company_id": rma_line.company_id.id,
|
||||
"location_id": self.location_id.id,
|
||||
"location_dest_id": location_dest.id,
|
||||
"refurbish_location_dest_id": refurbish_location_dest_id,
|
||||
"refurbish_product_id": self.refurbish_product_id.id,
|
||||
"to_refurbish": self.to_refurbish,
|
||||
"invoice_method": self.invoice_method,
|
||||
"address_id": addr["delivery"],
|
||||
"partner_invoice_id": addr["invoice"],
|
||||
|
||||
@@ -17,18 +17,9 @@
|
||||
<field name="product_qty" />
|
||||
<field name="product_uom_id" groups="uom.group_uom" />
|
||||
<field name="partner_id" />
|
||||
<field name="to_refurbish" />
|
||||
<field
|
||||
name="refurbish_product_id"
|
||||
attrs="{'required': [('to_refurbish', '=', True)]}"
|
||||
/>
|
||||
<field
|
||||
name="location_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
<field
|
||||
name="location_dest_id"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
/>
|
||||
<field name="invoice_method" />
|
||||
</tree>
|
||||
|
||||
Reference in New Issue
Block a user