class product_flavors(models.Model): _inherit = "product.flavors" _description = "Product Flavors Image" _order = "sequence" @api.multi def unlink(self): for rec in self: try: root_bucket = self.env['ir.config_parameter'].get_param('root_bucket','jjuice-django') assert root_bucket, "Sorry the root bucket is not available" access_key_id = self.env['ir.config_parameter'].get_param('aws_access_id') secret_access_key = self.env['ir.config_parameter'].get_param('aws_secret_key') assert access_key_id and secret_access_key, "Invalid Credentials" delete_object_bucket(self._table,self.id,access_key_id,secret_access_key,root_bucket) except AssertionError as e: raise except_orm('Error',e) return super(product_attribute_value,self).unlink() sequence = fields.Integer(string="Sequence") short_description = fields.Text('Short Description') long_description = fields.Text('Long Description') review_ids = fields.One2many('flavor.reviews','flavor_id','Reviews') attribute_image_line = fields.One2many('s3.object','flavor_id','Images') banner_file_name = fields.Char("File Name") banner_datas = BinaryS3Field(string = "Image",key_name = "product_flavor_banner")
class website_banner(models.Model): _name = "website.banner" _description="Website Banners" _rec_name = "file_name" _order = "sequence" @api.multi def unlink(self): for rec in self: try: root_bucket = self.env['ir.config_parameter'].get_param('root_bucket','jjuice-django') assert root_bucket, "Sorry the root bucket is not available" access_key_id = self.env['ir.config_parameter'].get_param('aws_access_id') secret_access_key = self.env['ir.config_parameter'].get_param('aws_secret_key') assert access_key_id and secret_access_key, "Invalid Credentials" delete_object_bucket(self._table,self.id,access_key_id,secret_access_key,root_bucket) except AssertionError as e: raise except_orm('Error',e) return super(website_banner,self).unlink() sequence = fields.Integer('Sequence') datas = BinaryS3Field(string="Image",key_name=False) file_name = fields.Char('File Name',required=True) active = fields.Boolean("Active",default=True) button_title = fields.Char('Text on Button') url_link = fields.Char('URL')
class product_product(models.Model): _inherit = "product.product" _description = "Adding S3 Object" @api.multi def get_product_availability(self): res = {} for i in self: res.update({ i.id:{'virtual_available':i.virtual_available} }) return json.dumps(res) @api.multi def unlink(self): for rec in self: try: root_bucket = self.env['ir.config_parameter'].get_param('root_bucket','jjuice-django') assert root_bucket, "Sorry the root bucket is not available" access_key_id = self.env['ir.config_parameter'].get_param('aws_access_id') secret_access_key = self.env['ir.config_parameter'].get_param('aws_secret_key') assert access_key_id and secret_access_key, "Invalid Credentials" delete_object_bucket(self._table,self.id,access_key_id,secret_access_key,root_bucket) except AssertionError as e: raise except_orm('Error',e) return super(product_product,self).unlink() file_name = fields.Char(string = "File Name") datas = BinaryS3Field(string = "Image",key_name = False)
class product_attribute_value(models.Model): _inherit = "product.attribute.value" _description = "Adding S3 Object" _order = "sequence" @api.multi def unlink(self): for rec in self: try: root_bucket = self.env['ir.config_parameter'].get_param( 'root_bucket', 'jjuice-django') assert root_bucket, "Sorry the root bucket is not available" access_key_id = self.env['ir.config_parameter'].get_param( 'aws_access_id') secret_access_key = self.env['ir.config_parameter'].get_param( 'aws_secret_key') assert access_key_id and secret_access_key, "Invalid Credentials" delete_object_bucket(self._table, self.id, access_key_id, secret_access_key, root_bucket) except AssertionError as e: raise except_orm('Error', e) return super(product_attribute_value, self).unlink() file_name = fields.Char(string="File Name") datas = BinaryS3Field(string="Drop Down Image", key_name=False) file_name_category = fields.Char(string="File Name") category_datas = BinaryS3Field(string="Category Image", key_name="product_attribute_value_category") banner_file_name = fields.Char(string="File Name") banner_datas = BinaryS3Field(string="Image", key_name="product_attribute_value_banner") weight = fields.Float("Weight") msrp = fields.Float('MSRP') wholesale_price = fields.Float('WholeSale Price') ratio = fields.Char('VG/PG') old_price = fields.Float('Old Price')
class s3_object(models.Model): _name = "s3.object" _description = "Single S3 Object" _rec_name = "file_name" @api.multi def unlink(self): for rec in self: try: root_bucket = self.env['ir.config_parameter'].get_param( 'root_bucket', 'jjuice-django') assert root_bucket, "Sorry the root bucket is not available" access_key_id = self.env['ir.config_parameter'].get_param( 'aws_access_id') secret_access_key = self.env['ir.config_parameter'].get_param( 'aws_secret_key') assert access_key_id and secret_access_key, "Invalid Credentials" delete_object_bucket(self._table, self.id, access_key_id, secret_access_key, root_bucket) except AssertionError as e: raise except_orm('Error', e) return super(s3_object, self).unlink() file_name = fields.Char(string="File Name") datas = BinaryS3Field(string="Image", key_name=False) sequence = fields.Integer(string="Sequence") attribute_id = fields.Many2one('product.attribute.value', 'Attribute') flavor_id = fields.Many2one('product.flavors', 'Flavor') is_featured_item = fields.Boolean("Featured Item") aboutus_banner = fields.Boolean('Is About us Banner ?') contactus_banner = fields.Boolean('Is Contact us Banner ?') customerreview_banner = fields.Boolean('Is Customer Review us Banner ?') privacy_policy_banner = fields.Boolean("Is Privacy Policy Banner") terms_conditions_banner = fields.Boolean("Is Terms & Conditions Banner ?") search_banner = fields.Boolean('Is Search Banner?') checkout_banner = fields.Boolean('Is Checkout Banner?') shipping_returns_policy_banner = fields.Boolean( 'Is Shipping & Returns Policy Banner ?') contactus_banner_500340 = fields.Boolean('Is Contact Us Image (500x340) ?') company_logo = fields.Boolean('Is Company Logo ?')
class website_policy(models.Model): _name = "website.policy" _description="Website Policy" _order = "sequence" @api.multi def unlink(self): for rec in self: try: root_bucket = self.env['ir.config_parameter'].get_param('root_bucket','jjuice-django') assert root_bucket, "Sorry the root bucket is not available" access_key_id = self.env['ir.config_parameter'].get_param('aws_access_id') secret_access_key = self.env['ir.config_parameter'].get_param('aws_secret_key') assert access_key_id and secret_access_key, "Invalid Credentials" delete_object_bucket(self._table,self.id,access_key_id,secret_access_key,root_bucket) except AssertionError as e: raise except_orm('Error',e) return super(website_policy,self).unlink() sequence = fields.Integer('Sequence') name = fields.Char('Name',required=True) file_name = fields.Char('File Name') description = fields.Text('Description') datas = BinaryS3Field(string="Image",key_name=False)