Hi , This is a technical question I need to get the product value in stock by a search method in python.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
product_value = 0
pickings = self.env['stock.picking'].search([],limit=1)
for picking in pickings:
for valuation in picking.move_lines.stock_valuation_layer_ids:
product_value = product_value + valuation.value
If i understood you .. you are trying to get the inventory valuation layers for a specific product there is a method provided by odoo in every stock move that can help you get all the valuation layers keep in mind that you have to get the right stock pickings for your products if you want to get the accurate valuations.
Here is an example from Odoo that is using the same method in stock_account module
class StockPicking(models.Model):
_inherit = 'stock.picking'
country_code = fields.Char(related="company_id.account_fiscal_country_id.code")
def action_view_stock_valuation_layers(self):
self.ensure_one()
scraps = self.env['stock.scrap'].search([('picking_id', '=', self.id)])
domain = [('id', 'in', (self.move_lines + scraps.move_id).stock_valuation_layer_ids.ids)]
action = self.env["ir.actions.actions"]._for_xml_id("stock_account.stock_valuation_layer_action")
context = literal_eval(action['context'])
context.update(self.env.context)
context['no_at_date'] = True
return dict(action, domain=domain, context=context)
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
lip 25
|
1381 | ||
|
1
sie 25
|
2967 | ||
stock Valuation for any product
Rozwiązane
|
|
1
mar 23
|
1964 | |
|
1
maj 17
|
3484 | ||
|
0
gru 24
|
4028 |
What do you mean by product value ? Inventory Valuation or Quantity of Product ?