from odoo.tests.common import TransactionCase


class TestResPartner(TransactionCase):

    def setUp(self):
        self.template_id = self.env['base.comment.template'].create({
            'name': 'Comment before lines',
            'position': 'before_lines',
            'text': 'Text before lines',
        })

    def test_commercial_partner_fields(self):
        # Azure Interior
        partner_id = self.env.ref('base.res_partner_12')
        partner_id.property_comment_template_id = self.template_id.id
        # Test childs propagation of commercial partner field
        for child_id in partner_id.child_ids:
            self.assertEqual(
                child_id.property_comment_template_id == self.template_id)

from odoo.tests.common import TransactionCase


class TestResPartner(TransactionCase):

    def setUp(self):
        super(TestResPartner, self).setUp()
        self.template_id = self.env['base.comment.template'].create({
            'name': 'Comment before lines',
            'position': 'before_lines',
            'text': 'Text before lines',
        })

    def test_commercial_partner_fields(self):
        # Azure Interior
        partner_id = self.env.ref('base.res_partner_12')
        partner_id.property_comment_template_id = self.template_id.id
        # Test childs propagation of commercial partner field
        for child_id in partner_id.child_ids:
            self.assertEqual(
                child_id.property_comment_template_id, self.template_id)

Move comment_template_id field to the Invoicing tab
[IMP] account_invoice_comment_template: Move comment_template_id field to the Invoicing tab

[IMP] account_invoice_comment_template: rename partner field name from comment_template_id to invoice_comment_template_id

[IMP] account_invoice_comment_template: Make partner field company_dependant and move domain definition of invoice fields from the view to the model

[MOV] account_invoice_comment_template: comment_template_id to base_comment_template

[IMP] account_invoice_comment_template: Translate templates when partner changes

  from odoo.tests.common import TransactionCase
  
  
  class TestResPartner(TransactionCase):
  
      def setUp(self):
+         super(TestResPartner, self).setUp()
          self.template_id = self.env['base.comment.template'].create({
              'name': 'Comment before lines',
              'position': 'before_lines',
              'text': 'Text before lines',
          })
  
      def test_commercial_partner_fields(self):
          # Azure Interior
          partner_id = self.env.ref('base.res_partner_12')
          partner_id.property_comment_template_id = self.template_id.id
          # Test childs propagation of commercial partner field
          for child_id in partner_id.child_ids:
              self.assertEqual(
-                 child_id.property_comment_template_id == self.template_id)
+                 child_id.property_comment_template_id, self.template_id)
  
Move comment_template_id field to the Invoicing tab
## Code Before:
from odoo.tests.common import TransactionCase


class TestResPartner(TransactionCase):

    def setUp(self):
        self.template_id = self.env['base.comment.template'].create({
            'name': 'Comment before lines',
            'position': 'before_lines',
            'text': 'Text before lines',
        })

    def test_commercial_partner_fields(self):
        # Azure Interior
        partner_id = self.env.ref('base.res_partner_12')
        partner_id.property_comment_template_id = self.template_id.id
        # Test childs propagation of commercial partner field
        for child_id in partner_id.child_ids:
            self.assertEqual(
                child_id.property_comment_template_id == self.template_id)

## Instruction:
Move comment_template_id field to the Invoicing tab
## Code After:
from odoo.tests.common import TransactionCase


class TestResPartner(TransactionCase):

    def setUp(self):
        super(TestResPartner, self).setUp()
        self.template_id = self.env['base.comment.template'].create({
            'name': 'Comment before lines',
            'position': 'before_lines',
            'text': 'Text before lines',
        })

    def test_commercial_partner_fields(self):
        # Azure Interior
        partner_id = self.env.ref('base.res_partner_12')
        partner_id.property_comment_template_id = self.template_id.id
        # Test childs propagation of commercial partner field
        for child_id in partner_id.child_ids:
            self.assertEqual(
                child_id.property_comment_template_id, self.template_id)
