Skip to content

Commit

Permalink
Merge PR #17 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by andhit-r
  • Loading branch information
ssi-bot committed Apr 25, 2024
2 parents eb56cba + e020b6b commit 0254701
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ssi_rma/models/rma_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ class RMAMixin(models.AbstractModel):
readonly=True,
states={"draft": [("readonly", False)]},
)
stock_move_ids = fields.Many2many(
string="Stock Moves",
comodel_name="stock.move",
compute="_compute_stock_document_ids",
store=False,
)
stock_picking_ids = fields.Many2many(
string="Stock Pickings",
comodel_name="stock.picking",
compute="_compute_stock_document_ids",
store=False,
)
uom_quantity = fields.Float(
string="UoM Quantity",
compute="_compute_uom_quantity",
Expand Down Expand Up @@ -183,6 +195,17 @@ class RMAMixin(models.AbstractModel):
store=True,
)

@api.depends(
"line_ids",
"line_ids.stock_move_ids",
)
def _compute_stock_document_ids(self):
for record in self:
record.stock_move_ids = record.mapped("line_ids.stock_move_ids")
record.stock_picking_ids = record.mapped(
"line_ids.stock_move_ids.picking_id"
)

@api.depends(
"line_ids",
"line_ids.delivery_complete",
Expand Down
4 changes: 4 additions & 0 deletions ssi_rma/views/rma_mixin_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@
/>
<field name="group_id" />
</group>
<separator name="stock_picking" string="Stock Pickings" />
<field name="stock_picking_ids" nolabel="1" />
<separator name="stock_move" string="Stock Moves" />
<field name="stock_move_ids" nolabel="1" />
<group
name="procurement_2"
colspan="4"
Expand Down
16 changes: 16 additions & 0 deletions ssi_rma_account/models/rma_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ class RMAMixin(models.AbstractModel):
compute="_compute_resolve_ok",
store=True,
)
stock_valuation_layer_ids = fields.Many2many(
string="Stock Valuation Layers",
comodel_name="stock.valuation.layer",
compute="_compute_stock_valuation_layer_ids",
store=False,
)

@api.depends(
"line_ids",
"line_ids.stock_move_ids",
)
def _compute_stock_valuation_layer_ids(self):
for record in self:
record.stock_valuation_layer_ids = record.mapped(
"line_ids.stock_move_ids.stock_valuation_layer_ids"
)

@api.depends(
"line_ids",
Expand Down
10 changes: 10 additions & 0 deletions ssi_rma_account/views/rma_customer_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@
<xpath expr="//group[@name='quantity_1_2']" position="inside">
<field name="qty_refund" />
</xpath>
<xpath expr="//group[@name='quantity_1_2']" position="inside">
<field name="qty_refund" />
</xpath>
<xpath
expr="//page[@name='procurement']//field[@name='stock_move_ids']"
position="after"
>
<separator name="svl" string="Stock Valuation Layers" />
<field name="stock_valuation_layer_ids" nolabel="1" />
</xpath>
<xpath expr="//notebook/page[@name='procurement']" position="after">
<page name="accounting" string="Accounting">
<button
Expand Down
7 changes: 7 additions & 0 deletions ssi_rma_account/views/rma_supplier_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
<xpath expr="//group[@name='quantity_1_2']" position="inside">
<field name="qty_refund" />
</xpath>
<xpath
expr="//page[@name='procurement']//field[@name='stock_move_ids']"
position="after"
>
<separator name="svl" string="Stock Valuation Layers" />
<field name="stock_valuation_layer_ids" nolabel="1" />
</xpath>
<xpath expr="//notebook/page[@name='procurement']" position="after">
<page name="accounting" string="Accounting">
<button
Expand Down

0 comments on commit 0254701

Please sign in to comment.