Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store company_dependent field in odoo?

Tags:

odoo-11

I want to store standard_price field of prodct.product table to use this field value in sql query.

Code is here:

# -*- coding: utf-8 -*-
from odoo import fields, models
from odoo.addons import decimal_precision as dp

    class Product(models.Model):
        _inherit = "product.product"

        standard_price = fields.Float(
            'Cost', company_dependent=True,
            digits=dp.get_precision('Product Price'),
            groups="base.group_user",store=True,
            help = "Cost used for stock valuation in standard price and as a first price to set in average/fifo. "
                   "Also used as a base price for pricelists. "
                   "Expressed in the default unit of measure of the product.")
like image 400
Ketan Chauhan Avatar asked Oct 23 '25 16:10

Ketan Chauhan


1 Answers

You can not store company_dependent field in a database. Because when the company is change then company_depedent field value is also changed.

This field data is stored in ir.property object in odoo which name is Company Properties in odoo.

enter image description here

like image 170
Ketan Chauhan Avatar answered Oct 27 '25 04:10

Ketan Chauhan