Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6433 Zobrazení

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
Zrušit

Jose, have you checked it?

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
kvě 25
10040
5
pro 21
12560
3
lis 20
9597
1
kvě 16
98
0
úno 16
3290