This question has been flagged
1 Reply
4850 Views

Hello, I have Odoo 8. I want to set the default cost method of the product in "average".

This is the definition of the field in stock.account:

'cost_method': fields.property(type='selection', selection=[('standard', 'Standard Price'), ('average', 'Average Price'), ('real', 'Real Price')],
            help="""Standard Price: The cost price is manually updated at the end of a specific period (usually every year).
                    Average Price: The cost price is recomputed at each incoming shipment and used for the product valuation.
                    Real Price: The cost price displayed is the price of the last outgoing product (will be use in case of inventory loss for example).""",
            string="Costing Method", required=True, copy=True),

And I try this:

class product_template(models.Model):
    _inherit = 'product.template'

    cost_method = fields.selection(default='average')

But not works, and also try this:

class product_template(osv.osv):
    _inherit = 'product.template'

    _defaults = {
     'cost_method':'average'
}

But not works. The installation of my module is correct and I don't see any error, but the default cost method in the form of the product is "standard". How can I set it to "average"? Thanks!

Avatar
Discard

Jose, have you checked it?

Best Answer

Hi Jose,

Try Like this:

class product_template(models.Model):
    _inherit = 'product.template'

    cost_method = fields.Selection( [('standard', 'Standard Price'),

                                                     ('average', 'Average Price'),

                                                       ('real', 'Real Price')], default='average')

Avatar
Discard