Skip to content
Snippets Groups Projects
Commit c62dea6a authored by Ujas Dubal's avatar Ujas Dubal
Browse files

[FIX] stock_account: Added default type for 'account.move' line.


This commit will fixed the error when product has some stock quants
and product category with 'Automated' valuation method, is set to that product.

==============================

Steps to product the above mentioned error:
1. Create product with any category which has 'Manual' valuation method.
2. Update 'On Hand' quantity for the same product.
3. Create product category with valuation method set to 'Automated'.
4. Now set the above product category to the same product which you created in step 1.
5. And Click on the save button.

==============================

Also edit the test case.

closes odoo/odoo#43721

Task: 2155804
Signed-off-by: default avatarSimon Lejeune (sle) <sle@openerp.com>
parent 8a34a6a6
No related branches found
No related tags found
No related merge requests found
......@@ -470,6 +470,7 @@ class ProductProduct(models.Model):
'credit': abs(value),
'product_id': product.id,
})],
'type': 'entry',
}
move_vals_list.append(move_vals)
return move_vals_list
......@@ -505,6 +506,7 @@ class ProductProduct(models.Model):
'credit': abs(value),
'product_id': product.id,
})],
'type': 'entry',
}
move_vals_list.append(move_vals)
return move_vals_list
......
......@@ -779,7 +779,10 @@ class TestStockValuationChangeValuation(TestStockValuationCommon):
'property_stock_journal': self.stock_journal.id,
})
self.product1.categ_id = cat2
# Try to change the product category with a `default_type` key in the context and
# check it doesn't break the account move generation.
self.product1.with_context(default_type='product').categ_id = cat2
self.assertEqual(self.product1.categ_id, cat2)
self.assertEqual(self.product1.value_svl, 100)
self.assertEqual(self.product1.quantity_svl, 10)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment