예제 #1
0
    def write(self, vals):
        # res.partner must only allow to set the company_id of a partner if it
        # is the same as the company of all users that inherit from this partner
        # (this is to allow the code from res_users to write to the partner!) or
        # if setting the company_id to False (this is compatible with any user
        # company)
        if vals.get('website'):
            vals['website'] = self._clean_website(vals['website'])
        if vals.get('company_id'):
            company = self.env['res.company'].browse(vals['company_id'])
            for partner in self:
                if partner.user_ids:
                    companies = set(user.company_id for user in partner.user_ids)
                    if len(companies) > 1 or company not in companies:
                        raise UserError(_("You can not change the company as the partner/user has multiple user linked with different companies."))
        # function field implemented by hand -> remove my when migrating
        c_type = vals.get('company_type')
        is_company = vals.get('is_company')
        if c_type:
            vals['is_company'] = c_type == 'company'
        elif 'is_company' in vals:
            vals['company_type'] = is_company and 'company' or 'person'
        tools.image_resize_images(vals)

        result = super(res_partner, self).write(vals)
        for partner in self:
            if any(u.has_group('base.group_user') for u in partner.user_ids if u != self.env.user):
                self.env['res.users'].check_access_rights('write')
            self._fields_sync(partner, vals)
        return result
예제 #2
0
    def create(self, vals):
        tools.image_resize_images(vals)
        # Create channel and alias
        channel = super(Channel, self.with_context(
            alias_model_name=self._name, alias_parent_model_name=self._name, mail_create_nolog=True, mail_create_nosubscribe=True)
        ).create(vals)
        channel.alias_id.write({"alias_force_thread_id": channel.id, 'alias_parent_thread_id': channel.id})

        if vals.get('group_ids'):
            channel._subscribe_users()

        # make channel listen itself: posting on a channel notifies the channel
        if not self._context.get('mail_channel_noautofollow'):
            channel.message_subscribe(channel_ids=[channel.id])

        return channel
예제 #3
0
 def create(self, vals):
     if vals.get('type') in ['delivery', 'invoice'] and not vals.get('image'):
         # force no colorize for images with no transparency
         vals['image'] = self.with_context(partner_type=vals['type'])._get_default_image(False, False)
     if vals.get('website'):
         vals['website'] = self._clean_website(vals['website'])
     # function field not correctly triggered at create -> remove me when
     # migrating to the new API
     c_type = vals.get('company_type', self._context.get('default_company_type'))
     is_company = vals.get('is_company', self._context.get('default_is_company'))
     if c_type:
         vals['is_company'] = c_type == 'company'
     else:
         vals['company_type'] = is_company and 'company' or 'person'
     tools.image_resize_images(vals)
     partner = super(res_partner, self).create(vals)
     self._fields_sync(partner, vals)
     self._handle_first_contact_creation(partner)
     return partner
예제 #4
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(product_public_category, self).write(vals)
예제 #5
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(ImLivechatChannel, self).write(vals)
예제 #6
0
파일: product.py 프로젝트: vak0160/odoo-1
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(product_public_category, self).write(vals)
예제 #7
0
 def create(self, vals):
     tools.image_resize_images(vals)
     return super(Task, self).create(vals)
예제 #8
0
 def write(self, vals):
     image_resize_images(vals)
     return super(PaymentAcquirer, self).write(vals)
예제 #9
0
 def write(self, vals):
     image_resize_images(vals)
     return super(PaymentAcquirer, self).write(vals)
예제 #10
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(WebsiteGallery, self).write(vals)
예제 #11
0
 def create(self, vals):
     tools.image_resize_images(vals)
     return super(WebsiteImage, self).create(vals)
예제 #12
0
 def write(self, vals):
     tools.image_resize_images(vals)
     result = super(Channel, self).write(vals)
     if vals.get('group_ids'):
         self._subscribe_users()
     return result
예제 #13
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(loewie_download, self).write(vals)
예제 #14
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(AssetCategory, self).write(vals)
예제 #15
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(Event, self).write(vals)
예제 #16
0
 def write(self, vals):
     tools.image_resize_images(vals)
     result = super(Channel, self).write(vals)
     if vals.get('group_ids'):
         self._subscribe_users()
     return result
예제 #17
0
 def create(self, vals):
     tools.image_resize_images(vals)
     return super(hr_employee, self).create(vals)
예제 #18
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(fleet_vehicle_model_brand, self).write(vals)
예제 #19
0
파일: hr.py 프로젝트: GarridoM/odoo
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(hr_employee, self).write(vals)
예제 #20
0
파일: fleet.py 프로젝트: vak0160/odoo-1
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(fleet_vehicle_model_brand, self).write(vals)