[MIG] rma_purchase: Migration to 16.0

This commit is contained in:
DavidJForgeFlow
2023-02-23 11:20:09 +01:00
committed by JasminSForgeFlow
parent 550c245ece
commit 51f302dac3
4 changed files with 11 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
{ {
"name": "RMA Purchase", "name": "RMA Purchase",
"version": "15.0.1.0.1", "version": "16.0.1.0.0",
"category": "RMA", "category": "RMA",
"summary": "RMA from PO", "summary": "RMA from PO",
"license": "LGPL-3", "license": "LGPL-3",

View File

@@ -24,6 +24,7 @@ class RmaOrderLine(models.Model):
purchase_list.append(line.id) purchase_list.append(line.id)
rec.purchase_order_line_ids = [(6, 0, purchase_list)] rec.purchase_order_line_ids = [(6, 0, purchase_list)]
@api.depends("operation_id", "purchase_policy")
def _compute_qty_purchase(self): def _compute_qty_purchase(self):
for rec in self: for rec in self:
rec.qty_purchased = rec._get_rma_purchased_qty() rec.qty_purchased = rec._get_rma_purchased_qty()

View File

@@ -57,13 +57,15 @@ class TestRmaStockAccountPurchase(TestRmaStockAccount):
picking = self._deliver_rma(rma_line) picking = self._deliver_rma(rma_line)
# The price is not the standard price, is the value of the incoming layer # The price is not the standard price, is the value of the incoming layer
# of the PO # of the PO
rma_move_value = picking.move_lines.stock_valuation_layer_ids.value rma_move_value = picking.move_line_ids.move_id.stock_valuation_layer_ids.value
po_move_value = po.picking_ids.mapped("move_lines.stock_valuation_layer_ids")[ po_move_value = po.picking_ids.mapped(
-1 "move_line_ids.move_id.stock_valuation_layer_ids"
].value )[-1].value
self.assertEqual(-rma_move_value, po_move_value) self.assertEqual(-rma_move_value, po_move_value)
# Test the accounts used # Test the accounts used
account_move = picking.move_lines.stock_valuation_layer_ids.account_move_id account_move = (
picking.move_line_ids.move_id.stock_valuation_layer_ids.account_move_id
)
self.check_accounts_used(account_move, "grni", "inventory") self.check_accounts_used(account_move, "grni", "inventory")
# Now forcing a refund to check the stock journals # Now forcing a refund to check the stock journals
rma_line.refund_policy = "ordered" rma_line.refund_policy = "ordered"

View File

@@ -37,6 +37,7 @@
class="oe_stat_button" class="oe_stat_button"
icon="fa-shopping-cart" icon="fa-shopping-cart"
groups="purchase.group_purchase_user" groups="purchase.group_purchase_user"
attrs="{'invisible':[('purchase_count','=',0)]}"
> >
<field <field
name="purchase_count" name="purchase_count"
@@ -56,7 +57,7 @@
/> />
</group> </group>
<group name="quantities" position="inside"> <group name="quantities" position="inside">
<group> <group attrs="{'invisible': [('purchase_policy', '=', 'no')]}">
<field name="qty_to_purchase" /> <field name="qty_to_purchase" />
<field name="qty_purchased" /> <field name="qty_purchased" />
</group> </group>