mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[IMP] rma_sale: introduce new config settings.
- auto_confirm_rma_sale - free_of_charge_rma_sale
This commit is contained in:
committed by
JasminSForgeFlow
parent
cd5e20e584
commit
52360af3e2
@@ -14,3 +14,13 @@ class RmaOperation(models.Model):
|
|||||||
],
|
],
|
||||||
default="no",
|
default="no",
|
||||||
)
|
)
|
||||||
|
auto_confirm_rma_sale = fields.Boolean(
|
||||||
|
string="Auto confirm Sales Order upon creation from RMA",
|
||||||
|
help="When a sales is created from an RMA, automatically confirm it",
|
||||||
|
readonly=False,
|
||||||
|
)
|
||||||
|
free_of_charge_rma_sale = fields.Boolean(
|
||||||
|
string="Free of charge RMA Sales Order",
|
||||||
|
help="Sales orders created from RMA are free of charge by default",
|
||||||
|
readonly=False,
|
||||||
|
)
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
<field name="delivery_policy" position="after">
|
<field name="delivery_policy" position="after">
|
||||||
<field name="sale_policy" />
|
<field name="sale_policy" />
|
||||||
</field>
|
</field>
|
||||||
|
<field name="company_id" position="after">
|
||||||
|
<field name="auto_confirm_rma_sale" />
|
||||||
|
<field name="free_of_charge_rma_sale" />
|
||||||
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class RmaLineMakeSaleOrder(models.TransientModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _prepare_item(self, line):
|
def _prepare_item(self, line):
|
||||||
|
free_of_charge_rma_sale = line.operation_id.free_of_charge_rma_sale
|
||||||
return {
|
return {
|
||||||
"line_id": line.id,
|
"line_id": line.id,
|
||||||
"product_id": line.product_id.id,
|
"product_id": line.product_id.id,
|
||||||
@@ -37,6 +38,7 @@ class RmaLineMakeSaleOrder(models.TransientModel):
|
|||||||
"rma_id": line.rma_id.id,
|
"rma_id": line.rma_id.id,
|
||||||
"out_warehouse_id": line.out_warehouse_id.id,
|
"out_warehouse_id": line.out_warehouse_id.id,
|
||||||
"product_uom_id": line.uom_id.id,
|
"product_uom_id": line.uom_id.id,
|
||||||
|
"free_of_charge": free_of_charge_rma_sale,
|
||||||
}
|
}
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -126,6 +128,8 @@ class RmaLineMakeSaleOrder(models.TransientModel):
|
|||||||
|
|
||||||
so_line_data = self._prepare_sale_order_line(sale, item)
|
so_line_data = self._prepare_sale_order_line(sale, item)
|
||||||
so_line_obj.create(so_line_data)
|
so_line_obj.create(so_line_data)
|
||||||
|
if line.operation_id.auto_confirm_rma_sale:
|
||||||
|
sale.action_confirm()
|
||||||
res.append(sale.id)
|
res.append(sale.id)
|
||||||
|
|
||||||
action = self.env.ref("sale.action_orders")
|
action = self.env.ref("sale.action_orders")
|
||||||
|
|||||||
Reference in New Issue
Block a user