
from openerp.osv import orm

from . import gp_connector


class project_compassion(orm.Model):
    _inherit = 'compassion.project'

    def write(self, cr, uid, ids, vals, context=None):
        """Update Project in GP."""
        res = super(project_compassion, self).write(cr, uid, ids, vals,
                                                    context)
        gp_connect = gp_connector.GPConnect()
        for project in self.browse(cr, uid, ids, context):
            gp_connect.upsert_project(uid, project)
        return res


from openerp.osv import orm

from . import gp_connector


class project_compassion(orm.Model):
    _inherit = 'compassion.project'

    def write(self, cr, uid, ids, vals, context=None):
        """Update Project in GP."""
        res = super(project_compassion, self).write(cr, uid, ids, vals,
                                                    context)
        if not isinstance(ids, list):
            ids = [ids]
        gp_connect = gp_connector.GPConnect()
        for project in self.browse(cr, uid, ids, context):
            gp_connect.upsert_project(uid, project)
        return res

Fix bug in write project.
Fix bug in write project.

  
  from openerp.osv import orm
  
  from . import gp_connector
  
  
  class project_compassion(orm.Model):
      _inherit = 'compassion.project'
  
      def write(self, cr, uid, ids, vals, context=None):
          """Update Project in GP."""
          res = super(project_compassion, self).write(cr, uid, ids, vals,
                                                      context)
+         if not isinstance(ids, list):
+             ids = [ids]
          gp_connect = gp_connector.GPConnect()
          for project in self.browse(cr, uid, ids, context):
              gp_connect.upsert_project(uid, project)
          return res
  
Fix bug in write project.
## Code Before:

from openerp.osv import orm

from . import gp_connector


class project_compassion(orm.Model):
    _inherit = 'compassion.project'

    def write(self, cr, uid, ids, vals, context=None):
        """Update Project in GP."""
        res = super(project_compassion, self).write(cr, uid, ids, vals,
                                                    context)
        gp_connect = gp_connector.GPConnect()
        for project in self.browse(cr, uid, ids, context):
            gp_connect.upsert_project(uid, project)
        return res

## Instruction:
Fix bug in write project.
## Code After:

from openerp.osv import orm

from . import gp_connector


class project_compassion(orm.Model):
    _inherit = 'compassion.project'

    def write(self, cr, uid, ids, vals, context=None):
        """Update Project in GP."""
        res = super(project_compassion, self).write(cr, uid, ids, vals,
                                                    context)
        if not isinstance(ids, list):
            ids = [ids]
        gp_connect = gp_connector.GPConnect()
        for project in self.browse(cr, uid, ids, context):
            gp_connect.upsert_project(uid, project)
        return res
