2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-01-16 06:58:15 +01:00
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, fields, models
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Partner(models.Model):
|
|
|
|
|
|
|
|
_inherit = 'res.partner'
|
|
|
|
|
|
|
|
website_tag_ids = fields.Many2many('res.partner.tag', 'res_partner_res_partner_tag_rel', 'partner_id', 'tag_id', string='Website tags')
|
|
|
|
|
|
|
|
|
|
|
|
class Tags(models.Model):
|
|
|
|
|
|
|
|
_name = 'res.partner.tag'
|
|
|
|
_description = 'Partner Tags - These tags can be used on website to find customers by sector, or ... '
|
|
|
|
_inherit = 'website.published.mixin'
|
|
|
|
|
|
|
|
@api.model
|
|
|
|
def get_selection_class(self):
|
|
|
|
classname = ['default', 'primary', 'success', 'warning', 'danger']
|
|
|
|
return [(x, str.title(x)) for x in classname]
|
|
|
|
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
def _default_website(self):
|
|
|
|
default_website_id = self.env.ref('website.default_website')
|
|
|
|
return [default_website_id.id] if default_website_id else None
|
|
|
|
|
2018-01-16 06:58:15 +01:00
|
|
|
name = fields.Char('Category Name', required=True, translate=True)
|
|
|
|
partner_ids = fields.Many2many('res.partner', 'res_partner_res_partner_tag_rel', 'tag_id', 'partner_id', string='Partners')
|
|
|
|
classname = fields.Selection(get_selection_class, 'Class', default='default', help="Bootstrap class to customize the color", required=True)
|
|
|
|
active = fields.Boolean('Active', default=True)
|
|
|
|
website_published = fields.Boolean(default=True)
|
2017-12-25 07:01:04 +01:00
|
|
|
website_ids = fields.Many2many('website', 'website_partner_tag_pub_rel',
|
|
|
|
'website_id', 'partner_tag_id',
|
|
|
|
string='Websites', copy=False,
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
default=_default_website,
|
2017-12-25 07:01:04 +01:00
|
|
|
help='List of websites in which '
|
[IMP] Improve Multi-Website Functionalities:-
- Affected Modules:
website_sale, website_blog, website_partner, website_crm_partner_assign,
website_customer, website_slides, website_links, website_membership,
website_hr, website_hr_recruitment, website_payment, website_sale_delivery,
website_forum, website_event
- Remove unnecessary model `website.product.pricelist` from website_sale,
All its mechanism already transferd to existing model `product.pricelist`
- Change in `product.pricelist` model, make website_id(o2m) to website_ids(m2m),
As user can choose that same pricelist can be used in multiple websites
- Added `default_website` as default values in `website_ids(m2m)` & `website_id(m2o)` field in
almost all affected modules (mentioned above!!)
- To use/publish things(like... product, pricelist, blog, forum, events, etc...) in website,
User have to set `website_published` mechanism `on` (if it's available for that model/object),
Also have to set/assign different websites in `website_ids` field as per needs
2018-02-06 10:43:31 +01:00
|
|
|
'Partner Tag will published.')
|