mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX] rma: some fixups
This commit is contained in:
@@ -77,7 +77,10 @@ class RmaOrderLine(models.Model):
|
||||
for move in self.move_ids:
|
||||
first_usage = move._get_first_usage()
|
||||
last_usage = move._get_last_usage()
|
||||
if first_usage in ("internal", "production") and last_usage != "internal":
|
||||
if first_usage in ("internal", "production") and last_usage in (
|
||||
"customer",
|
||||
"supplier",
|
||||
):
|
||||
pickings |= move.picking_id
|
||||
elif last_usage == "customer" and first_usage == "supplier":
|
||||
pickings |= move.picking_id
|
||||
@@ -98,12 +101,24 @@ class RmaOrderLine(models.Model):
|
||||
product_obj = self.env["uom.uom"]
|
||||
qty = 0.0
|
||||
if direction == "in":
|
||||
op = ops["="]
|
||||
else:
|
||||
op = ops["!="]
|
||||
for move in rec.move_ids.filtered(
|
||||
lambda m: m.state in states and op(m.location_id.usage, rec.type)
|
||||
):
|
||||
moves = rec.move_ids.filtered(
|
||||
lambda m: m.state in states
|
||||
and (
|
||||
m.location_id.usage == "supplier"
|
||||
or m.location_id.usage == "customer"
|
||||
)
|
||||
and m.location_dest_id.usage == "internal"
|
||||
)
|
||||
elif direction == "out":
|
||||
moves = rec.move_ids.filtered(
|
||||
lambda m: m.state in states
|
||||
and (
|
||||
m.location_dest_id.usage == "supplier"
|
||||
or m.location_dest_id.usage == "customer"
|
||||
)
|
||||
and m.location_id.usage == "internal"
|
||||
)
|
||||
for move in moves:
|
||||
# If the move is part of a chain don't count it
|
||||
if direction == "out" and move.move_orig_ids:
|
||||
continue
|
||||
|
||||
@@ -387,7 +387,7 @@
|
||||
<field name="lot_id" />
|
||||
<separator />
|
||||
<filter
|
||||
name="assigned_to"
|
||||
name="assigned_to_filter"
|
||||
domain="[('assigned_to','=',uid)]"
|
||||
help="My RMAs"
|
||||
/>
|
||||
@@ -457,7 +457,7 @@
|
||||
<field name="name">Customer RMA</field>
|
||||
<field name="res_model">rma.order.line</field>
|
||||
<field name="domain">[('type','=', 'customer')]</field>
|
||||
<field name="context">{"search_default_assigned_to":uid}</field>
|
||||
<field name="context">{"search_default_assigned_to_filter":1}</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_rma_line_tree" />
|
||||
</record>
|
||||
@@ -468,7 +468,7 @@
|
||||
<field name="domain">[('type','=', 'supplier')]</field>
|
||||
<field
|
||||
name="context"
|
||||
>{"search_default_assigned_to":uid, "supplier":1}</field>
|
||||
>{"search_default_assigned_to_filter":1, "supplier":1}</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_rma_line_supplier_tree" />
|
||||
</record>
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
<field name="inherit_id" ref="stock.stock_location_route_form_view" />
|
||||
<field name="model">stock.route</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='warehouse_selectable']" position="before">
|
||||
<label for="warehouse_selectable" position="before">
|
||||
<field name="rma_selectable" string="RMA Order Lines" />
|
||||
</xpath>
|
||||
</label>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -108,26 +108,26 @@
|
||||
name="%(action_rma_picking_in)d"
|
||||
string="Create Incoming Shipment"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible':['|', '|', ('qty_to_receive', '=', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}"
|
||||
attrs="{'invisible':['|', '|', '|', ('qty_to_receive', '=', 0), ('qty_to_receive', '<', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}"
|
||||
type="action"
|
||||
/>
|
||||
<button
|
||||
name="%(action_rma_picking_in)d"
|
||||
string="Create Incoming Shipment"
|
||||
attrs="{'invisible':['|', '|', ('qty_to_receive', '!=', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}"
|
||||
attrs="{'invisible':['|', '|', ('qty_to_receive', '>', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}"
|
||||
type="action"
|
||||
/>
|
||||
<button
|
||||
name="%(action_rma_picking_out)d"
|
||||
string="Create Delivery"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible':['|', '|', ('qty_to_deliver', '=', 0), ('state', '!=', 'approved'), ('delivery_policy', '=', 'no')]}"
|
||||
attrs="{'invisible':['|', '|', '|', ('qty_to_deliver', '=', 0), ('qty_to_deliver', '<', 0), ('state', '!=', 'approved'), ('delivery_policy', '=', 'no')]}"
|
||||
type="action"
|
||||
/>
|
||||
<button
|
||||
name="%(action_rma_picking_out)d"
|
||||
string="Create Delivery"
|
||||
attrs="{'invisible':['|', '|', ('qty_to_deliver', '!=', 0), ('state', '!=', 'approved'), ('delivery_policy', '=', 'no')]}"
|
||||
attrs="{'invisible':['|', '|', ('qty_to_deliver', '>', 0), ('state', '!=', 'approved'), ('delivery_policy', '=', 'no')]}"
|
||||
type="action"
|
||||
/>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user