
from odoo import _, models
from odoo.exceptions import UserError


class AccountMove(models.Model):
    _inherit = "account.move"

    def action_post(self):
        for move in self:
            for line in move.line_ids:
                if line.product_id and line.product_id.must_have_dates:
                    if not line.start_date or not line.end_date:
                        raise UserError(
                            _(
                                "Missing Start Date and End Date for invoice "
                                "line with Product '%s' which has the "
                                "property 'Must Have Start and End Dates'."
                            )
                            % (line.product_id.display_name)
                        )
        return super(AccountMove, self).action_post()


from odoo import _, models
from odoo.exceptions import UserError


class AccountMove(models.Model):
    _inherit = "account.move"

    def action_post(self):
        for move in self:
            for line in move.line_ids:
                if line.product_id and line.product_id.must_have_dates:
                    if not line.start_date or not line.end_date:
                        raise UserError(
                            _(
                                "Missing Start Date and End Date for invoice "
                                "line with Product '%s' which has the "
                                "property 'Must Have Start and End Dates'."
                            )
                            % (line.product_id.display_name)
                        )
        return super().action_post()

Use super() instead of super(classname, self)
Use super() instead of super(classname, self)

  
  from odoo import _, models
  from odoo.exceptions import UserError
  
  
  class AccountMove(models.Model):
      _inherit = "account.move"
  
      def action_post(self):
          for move in self:
              for line in move.line_ids:
                  if line.product_id and line.product_id.must_have_dates:
                      if not line.start_date or not line.end_date:
                          raise UserError(
                              _(
                                  "Missing Start Date and End Date for invoice "
                                  "line with Product '%s' which has the "
                                  "property 'Must Have Start and End Dates'."
                              )
                              % (line.product_id.display_name)
                          )
-         return super(AccountMove, self).action_post()
+         return super().action_post()
  
Use super() instead of super(classname, self)
## Code Before:

from odoo import _, models
from odoo.exceptions import UserError


class AccountMove(models.Model):
    _inherit = "account.move"

    def action_post(self):
        for move in self:
            for line in move.line_ids:
                if line.product_id and line.product_id.must_have_dates:
                    if not line.start_date or not line.end_date:
                        raise UserError(
                            _(
                                "Missing Start Date and End Date for invoice "
                                "line with Product '%s' which has the "
                                "property 'Must Have Start and End Dates'."
                            )
                            % (line.product_id.display_name)
                        )
        return super(AccountMove, self).action_post()

## Instruction:
Use super() instead of super(classname, self)
## Code After:

from odoo import _, models
from odoo.exceptions import UserError


class AccountMove(models.Model):
    _inherit = "account.move"

    def action_post(self):
        for move in self:
            for line in move.line_ids:
                if line.product_id and line.product_id.must_have_dates:
                    if not line.start_date or not line.end_date:
                        raise UserError(
                            _(
                                "Missing Start Date and End Date for invoice "
                                "line with Product '%s' which has the "
                                "property 'Must Have Start and End Dates'."
                            )
                            % (line.product_id.display_name)
                        )
        return super().action_post()
