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.

58 lines
2.0 KiB

  1. from odoo import fields, models
  2. class ResConfigSettings(models.TransientModel):
  3. _inherit = "res.config.settings"
  4. group_activity_statement = fields.Boolean(
  5. "Enable OCA Activity Statements",
  6. group="account.group_account_invoice",
  7. implied_group="partner_statement.group_activity_statement",
  8. )
  9. default_aging_type = fields.Selection(
  10. [("days", "Age by Days"), ("months", "Age by Months")],
  11. string="Aging Method",
  12. required=True,
  13. default="days",
  14. default_model="statement.common.wizard",
  15. )
  16. default_show_aging_buckets = fields.Boolean(
  17. string="Show Aging Buckets", default_model="statement.common.wizard"
  18. )
  19. default_filter_partners_non_due = fields.Boolean(
  20. string="Exclude partners with no due entries",
  21. default_model="statement.common.wizard",
  22. )
  23. default_filter_negative_balances = fields.Boolean(
  24. "Exclude Negative Balances", default_model="statement.common.wizard"
  25. )
  26. group_outstanding_statement = fields.Boolean(
  27. "Enable OCA Outstanding Statements",
  28. group="account.group_account_invoice",
  29. implied_group="partner_statement.group_outstanding_statement",
  30. )
  31. def set_values(self):
  32. self = self.with_context(active_test=False)
  33. # default values fields
  34. IrDefault = self.env["ir.default"].sudo()
  35. for name, field in self._fields.items():
  36. if (
  37. name.startswith("default_")
  38. and field.default_model == "statement.common.wizard"
  39. ):
  40. if isinstance(self[name], models.BaseModel):
  41. if self._fields[name].type == "many2one":
  42. value = self[name].id
  43. else:
  44. value = self[name].ids
  45. else:
  46. value = self[name]
  47. IrDefault.set("activity.statement.wizard", name[8:], value)
  48. IrDefault.set("outstanding.statement.wizard", name[8:], value)
  49. return super().set_values()