models.py 628 B

123456789101112131415161718
  1. # -*- coding: utf-8 -*-
  2. from odoo import api, models, fields, Command
  3. class PageProductMapping(models.Model):
  4. _name = 'product_page_access.page_product_mapping'
  5. _description = 'Page Product Mapping'
  6. # for each page there is one list of products that grant access to it
  7. page = fields.Many2one('website.page', ondelete = 'cascade', string='Page')
  8. # the product directly associated with the page
  9. link_out_product = fields.Many2one('product.product', string='Product')
  10. # products that grant access to the page
  11. products = fields.Many2many('product.product', string='Alternative Products')