Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
6426 Vues

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
Ignorer

Jose, have you checked it?

Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
2
mai 25
10038
5
déc. 21
12552
3
nov. 20
9592
1
mai 16
98
0
févr. 16
3290