Skip to content
Snippets Groups Projects
Commit de526317 authored by Xavier Morel's avatar Xavier Morel
Browse files

[REM] website_sale: dynamic domain


closes odoo/odoo#40962

Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
parent 29cb9428
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ class ProductPricelist(models.Model):
domain = [('company_id', '=', company_id)]
return self.env['website'].search(domain, limit=1)
website_id = fields.Many2one('website', string="Website", ondelete='restrict', default=_default_website)
website_id = fields.Many2one('website', string="Website", ondelete='restrict', default=_default_website, domain="[('company_id', '=?', company_id)]")
code = fields.Char(string='E-commerce Promotional Code', groups="base.group_user")
selectable = fields.Boolean(help="Allow the end user to choose this price list")
......@@ -119,12 +119,6 @@ class ProductPricelist(models.Model):
company_id = website.company_id.id
return super(ProductPricelist, self)._get_partner_pricelist_multi(partner_ids, company_id)
@api.onchange('company_id')
def _onchange_company_id(self):
''' Show only the company's website '''
domain = self.company_id and [('company_id', '=', self.company_id.id)] or []
return {'domain': {'website_id': domain}}
@api.constrains('company_id', 'website_id')
def _check_websites_in_company(self):
'''Prevent misconfiguration multi-website/multi-companies.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment