how I can change product quantity on hand by code?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
2
الردود
3186
أدوات العرض
how I can change product quantity on hand by code?
you can try ths way:
from odoo import api, models
class ProductQuantityUpdate(models.Model):
_inherit = 'product.product'
def change_quantity(self, new_quantity):
for product in self:
product.write({'qty_available': new_quantity})
I try it and it's not work
Hi,
Easy method for the same from the code and ui is to make an inventory adjustment on particular location with needed value.
Thanks
is the method is action_update_quantity_on_hand ?
I try it but I had error
can you write the code to implement the method
feel free to update the question with the tried code and error you received
product = self.enve['product.product'].search([('id','=',product_id.id)])
product.qty_available = 100
product.action_update_quantity_on_hand ()
I have no change in this try and no error
as i suggested in answer, try simulating the same code execution of inventory adjustment with stock.quant model
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
2
أغسطس 25
|
2839 | ||
|
3
يوليو 24
|
2278 | ||
|
3
فبراير 25
|
4050 | ||
|
0
مايو 24
|
46 | ||
|
1
أبريل 24
|
3635 |
Hi,
Refer to this Url
https://www.odoo.com/forum/help-1/how-update-product-quanty-on-hand-by-code-v15-197965
Hope this helps you!