跳至内容
菜单
此问题已终结
1 回复
6423 查看

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!

形象
丢弃

Jose, have you checked it?

最佳答案

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')

形象
丢弃
相关帖文 回复 查看 活动
2
5月 25
10038
5
12月 21
12552
3
11月 20
9590
1
5月 16
98
0
2月 16
3290