[FIX] move the purchase_ids, purchase_count fields defined in purchase.py from the model product.template to product.product to make them work correctly (addon purchase)

bzr revid: ged@openerp.com-20140415135411-428kxcysuy73soeu
This commit is contained in:
Gery Debongnie 2014-04-15 15:54:11 +02:00
parent d1eb2547bb
commit 569d9dc75a
1 changed files with 12 additions and 4 deletions

View File

@ -1271,6 +1271,17 @@ class product_template(osv.Model):
_name = 'product.template'
_inherit = 'product.template'
_columns = {
'purchase_ok': fields.boolean('Can be Purchased', help="Specify if the product can be selected in a purchase order line."),
}
_defaults = {
'purchase_ok': 1,
}
class product_product(osv.Model):
_name = 'product.product'
_inherit = 'product.product'
def _purchase_count(self, cr, uid, ids, field_name, arg, context=None):
res = dict(map(lambda x: (x,0), ids))
try:
@ -1280,13 +1291,10 @@ class product_template(osv.Model):
pass
return res
_columns = {
'purchase_ok': fields.boolean('Can be Purchased', help="Specify if the product can be selected in a purchase order line."),
'purchase_ids': fields.one2many('purchase.order', 'product_id', 'Purchases'),
'purchase_count': fields.function(_purchase_count, string='# Purchases', type='integer'),
}
_defaults = {
'purchase_ok': 1,
}
class mail_compose_message(osv.Model):