product.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # # coding=utf-8
  2. #
  3. # from openerp import models, fields, api
  4. #
  5. #
  6. # class ProductTemplate(models.Model):
  7. #
  8. # _inherit = "product.template"
  9. #
  10. # wxpp_category_id = fields.Many2one('wxapp.product.category', string='小程序商城分类', ondelete='set null')
  11. # characteristic = fields.Text('商品特色')
  12. # recommend_status = fields.Boolean('是否推荐')
  13. # wxapp_published = fields.Boolean('是否上架', default=True)
  14. # description_wxapp = fields.Html('小程序描述')
  15. # original_price = fields.Float('原始价格', default=0)
  16. # qty_public_tpl = fields.Integer('库存', default=0)
  17. #
  18. # number_good_reputation = fields.Integer('好评数', default=0)
  19. # number_fav = fields.Integer('收藏数', default=0)
  20. # views = fields.Integer('浏览量', default=0)
  21. #
  22. #
  23. # def get_main_image(self):
  24. # base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
  25. # return '%s/web/image/product.template/%s/image/300x300'%(base_url, self.id)
  26. #
  27. # def get_images(self):
  28. # base_url=self.env['ir.config_parameter'].sudo().get_param('web.base.url')
  29. # _list = []
  30. # if hasattr(self, 'product_image_ids'):
  31. # for obj in self.product_image_ids:
  32. # _dict = {
  33. # "id": obj.id,
  34. # "goodsId": self.id,
  35. # "pic": '%s/web/image/product.image/%s/image/'%(base_url, obj.id)
  36. # }
  37. # _list.append(_dict)
  38. # _list.append({
  39. # 'id': self.id,
  40. # 'goodsId': self.id,
  41. # 'pic': '%s/web/image/product.template/%s/image/'%(base_url, self.id)
  42. # })
  43. # return _list
  44. #
  45. # def get_present_qty(self):
  46. # return self.qty_public_tpl
  47. #
  48. # def change_qty(self, val):
  49. # self.write({'qty_public_tpl': self.qty_public_tpl + val})
  50. #
  51. #
  52. # class ProductProduct(models.Model):
  53. #
  54. # _inherit = "product.product"
  55. #
  56. # present_price = fields.Float('现价', default=0, required=True) #暂未用,目前取Odoo的价格
  57. # qty_public = fields.Integer('库存', default=0, required=True)
  58. # attr_val_str = fields.Char('规格', compute='_compute_attr_val_str', store=True)
  59. #
  60. # @api.multi
  61. # @api.depends('attribute_value_ids')
  62. # def _compute_attr_val_str(self):
  63. # for obj in self:
  64. # obj.attr_val_str = ''
  65. #
  66. #
  67. # def get_property_str(self):
  68. # return ''
  69. #
  70. # def get_present_price(self):
  71. # return self.lst_price or self.product_tmpl_id.list_price
  72. #
  73. # def get_present_qty(self):
  74. # return self.qty_public
  75. #
  76. # def change_qty(self, val):
  77. # self.write({'qty_public': self.qty_public + val})