Beispiel #1
0
 def write(self, vals):
     tools.image_resize_images(vals)
     res = super(ProductTemplate, self).write(vals)
     if 'attribute_line_ids' in vals or vals.get('active'):
         self.create_variant_ids()
     if 'active' in vals and not vals.get('active'):
         self.with_context(active_test=False).mapped('product_variant_ids').write({'active': vals.get('active')})
     return res
Beispiel #2
0
 def write(self, vals):
     if 'address_home_id' in vals:
         account_id = vals.get('bank_account_id') or self.bank_account_id.id
         if account_id:
             self.env['res.partner.bank'].browse(
                 account_id).partner_id = vals['address_home_id']
     tools.image_resize_images(vals)
     return super(Employee, self).write(vals)
Beispiel #3
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
Beispiel #4
0
    def create(self, vals):
        ''' Store the initial standard price in order to be able to retrieve the cost of a product template for a given date'''
        # TDE FIXME: context brol
        tools.image_resize_images(vals)
        template = super(ProductTemplate, self).create(vals)
        if "create_product_product" not in self._context:
            template.with_context(create_from_tmpl=True).create_variant_ids()

        # This is needed to set given values to first variant after creation
        related_vals = {}
        if vals.get('barcode'):
            related_vals['barcode'] = vals['barcode']
        if vals.get('default_code'):
            related_vals['default_code'] = vals['default_code']
        if vals.get('standard_price'):
            related_vals['standard_price'] = vals['standard_price']
        if vals.get('volume'):
            related_vals['volume'] = vals['volume']
        if vals.get('weight'):
            related_vals['weight'] = vals['weight']
        if related_vals:
            template.write(related_vals)
        return template
Beispiel #5
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(ProductPublicCategory, self).write(vals)
Beispiel #6
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(PosCategory, self).write(vals)
Beispiel #7
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
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(ImLivechatChannel, self).write(vals)
Beispiel #9
0
 def create(self, vals):
     if vals.get('user_id'):
         vals.update(
             self._sync_user(self.env['res.users'].browse(vals['user_id'])))
     tools.image_resize_images(vals)
     return super(Employee, self).create(vals)
Beispiel #10
0
 def write(self, vals):
     tools.image_resize_images(vals)
     return super(FleetVehicleModelBrand, self).write(vals)
 def write(self, vals):
     image_resize_images(vals)
     return super(PaymentAcquirer, self).write(vals)