mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[14.0][IMP]rma_put_away: allows to do stock moves from rma
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
from . import wizards
|
||||
from . import models
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ class RmaOrderLine(models.Model):
|
||||
|
||||
qty_put_away = fields.Float(
|
||||
string="Qty Put Away",
|
||||
copy=False,
|
||||
digits="Product Unit of Measure",
|
||||
readonly=True,
|
||||
compute="_compute_qty_put_away",
|
||||
@@ -32,17 +31,19 @@ class RmaOrderLine(models.Model):
|
||||
required=True,
|
||||
)
|
||||
|
||||
@api.depends("qty_to_receive", "qty_put_away")
|
||||
def _compute_qty_to_put_away(self):
|
||||
for rec in self:
|
||||
rec.qty_to_put_away = 0.0
|
||||
if rec.put_away_policy == "ordered":
|
||||
rec.qty_to_put_away = rec.product_qty - rec.qty_put_away
|
||||
rec.qty_to_put_away = max(rec.product_qty - rec.qty_put_away, 0)
|
||||
elif rec.put_away_policy == "received":
|
||||
rec.qty_to_put_away = rec.qty_received - rec.qty_put_away
|
||||
rec.qty_to_put_away = max(rec.qty_received - rec.qty_put_away, 0)
|
||||
|
||||
@api.depends("qty_to_receive")
|
||||
def _compute_qty_put_away(self):
|
||||
for rec in self:
|
||||
rec.qty_put_away = 0.0
|
||||
rec.qty_put_away = 0
|
||||
|
||||
@api.onchange("operation_id")
|
||||
def _onchange_operation_id(self):
|
||||
@@ -50,3 +51,4 @@ class RmaOrderLine(models.Model):
|
||||
if self.operation_id:
|
||||
self.put_away_policy = self.operation_id.put_away_policy or "no"
|
||||
return result
|
||||
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
<field name="delivery_policy" position="after">
|
||||
<field name="put_away_policy" />
|
||||
</field>
|
||||
<group name="quantities" position="inside">
|
||||
<group>
|
||||
<field name="qty_to_put_away" />
|
||||
<field name="qty_put_away" />
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user