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.

29 lines
948B

  1. # Copyright 2021 Tecnativa - Víctor Martínez
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import fields, models
  4. class GithubAnalysisRule(models.Model):
  5. _inherit = "github.analysis.rule"
  6. has_odoo_addons = fields.Boolean(string="Has odoo addons?")
  7. manifest_key_ids = fields.Many2many(
  8. comodel_name="odoo.manifest.key", string="Manifest keys"
  9. )
  10. def _get_matches(self, path):
  11. """
  12. Override according to has_odoo_addons rules
  13. """
  14. if self.has_odoo_addons:
  15. spec = self._set_spec(["*"])
  16. file_paths = []
  17. for path_item in spec.match_tree(path):
  18. # file_paths.append(path + "/" + path_item)
  19. file_paths.append("{}/{}".format(path, path_item))
  20. spec = self._set_spec(self.paths.splitlines())
  21. return spec.match_files(file_paths)
  22. return super()._get_matches(path)
上海开阖软件有限公司 沪ICP备12045867号-1