You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
747 B

5 years ago
  1. # © 2019 Le Filament (<http://www.le-filament.com>)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import fields, models, api
  4. class VracoopWebsite(models.Model):
  5. _inherit = 'website'
  6. type_livraison = fields.Boolean(
  7. "Est de type livraison",
  8. compute='_compute_type_livraison')
  9. @api.model
  10. def _compute_type_livraison(self):
  11. for website in self:
  12. delivery_carriers = self.env['delivery.carrier'].sudo().search([
  13. ('website_published', '=', True),
  14. ('type_carrier', '=', 'livraison')])
  15. if delivery_carriers:
  16. website.type_livraison = True
  17. else:
  18. website.type_livraison = False