[IMP] website_sale_delivery compatible with Multi-Website

This commit is contained in:
Kaushal Prajapati 2018-01-01 15:54:49 +05:30 committed by Siddharth Bhalgami
parent aba211d99b
commit d0f4d38c2d
3 changed files with 7 additions and 1 deletions

View File

@ -10,3 +10,5 @@ class DeliveryCarrier(models.Model):
website_description = fields.Text(related='product_id.description_sale', string='Description for Online Quotations')
website_published = fields.Boolean(default=False)
website_ids = fields.Many2many('website', 'website_del_carrier_pub_rel', 'website_id', 'del_carrier_id', string='Websites', copy=False,
help='List of websites in which Product is published.')

View File

@ -73,7 +73,8 @@ class SaleOrder(models.Model):
def _get_delivery_methods(self):
address = self.partner_shipping_id
return self.env['delivery.carrier'].sudo().search([('website_published', '=', True)]).available_carriers(address)
domain = self.env['website'].get_current_website()
return self.env['delivery.carrier'].sudo().search([('website_published', '=', True), '|', ('website_ids', '=', False), ('website_ids', 'in', domain.id)]).available_carriers(address)
@api.multi
def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):

View File

@ -16,6 +16,9 @@
<field name="website_published" widget="website_button"/>
</button>
</xpath>
<xpath expr="//field[@name='product_id']" position="after">
<field name="website_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>