Esempio n. 1
0
class stock_location(osv.osv):
    _inherit = "stock.location"

    _columns = \
        { 'blueprint' : fields.binary  ('Blueprint')
        , 'image'     : fields.binary  ('Image')
        }
Esempio n. 2
0
class buildbot_test_step(osv.osv):
    _name = "buildbot.test.step"
    _columns = {
        'name':
        fields.char('Name of Step', size=128, help="Name of the Test step"),
        'test_id':
        fields.many2one('buildbot.test',
                        'Test',
                        ondelete='cascade',
                        help="Name of the Test"),
        'blame_log':
        fields.text("Summary",
                    help="Quick blame info of thing(s) that failed"),
        'log':
        fields.binary('General Log', help="Log File"),
        'quality_log':
        fields.binary("Module's Quality Log",
                      help="Module's Quality Log File"),
        # 'warning_log': fields.text('Warning Log',help="Warning Log"),
        #'error_log': fields.text('Error Log',help="Error Log"),
        #'critical_log': fields.text('Critical Log',help="Critical Log"),
        #'info_log': fields.text('Info Log',help="Information Log"),
        #'yml_log': fields.text('YML-Test Log',help="YML Log"),
        #'traceback_detail': fields.text('Traceback',help="Traceback Detail"),
        'state':
        fields.selection([('unknown', 'Unknown'), ('fail', 'Failed'),
                          ('pass', 'Passed'), ('skip', 'Skipped'),
                          ('debug', 'Debug')],
                         "Test Result",
                         readonly=True,
                         required=True,
                         help="Final State of the Test Step"),
    }
    _defaults = {'state': 'unknown'}
    _order = 'id'
Esempio n. 3
0
class product_images(osv.osv):
    _inherit = "product.images"
    def get_image(self, cr, uid, id):
      print"get_image"
      img = ''
      each = self.read(cr, uid, id, ['link', 'filename', 'image','full_url','chk_ebay_link'])
      if each['link'] == True:
          if each['link']:
           (filename, header) = urllib.urlretrieve(each['filename'])
           f = open(filename , 'rb')
           img = base64.encodestring(f.read())
           f.close()
      if each['full_url']:
          if each['full_url']:
               (filename, header) = urllib.urlretrieve(each['full_url'])
               f = open(filename , 'rb')
               img_ebay = base64.encodestring(f.read())
               f.close()
               if img_ebay:
                       cr.execute("UPDATE product_images SET preview_ebay='%s' where id=%d"%(img_ebay,id,))
               f.close()
      else:
          img = each['image']
      return img
    def write(self,cr,uid,ids,vals,context={}):
       if ids:
           filename = vals.get('filename_ebay',False)
           filename_database = self.browse(cr,uid,ids[0]).filename_ebay
           if filename == filename_database:
                vals.update({'change_or_no_change': 'no_change'})
           else:
               vals.update({'change_or_no_change': 'change','last_updated_changes':time.strftime('%Y-%m-%d %H:%M:%S')})
           id =  super(product_images, self).write(cr, uid, ids,vals, context)
           return id
    
    
    def create(self,cr,uid,vals,context={}):
       id =  super(product_images, self).create(cr, uid, vals, context)
       filename = vals.get('filename_ebay',False)
       vals.update({'change_or_no_change': 'change','last_updated_changes':time.strftime('%Y-%m-%d %H:%M:%S')})
       return id
    _columns = {
        'chk_ebay_link' : fields.boolean('Ebay'),
        'chk_mag' : fields.boolean('Magento'),
        'link':fields.boolean('Magento Link?', help="Images can be linked from files on your file system or remote (Preferred)"),
        'filename_ebay':fields.binary('Main Image', filters='*.png,*.jpg,*.gif'),
        'filename':fields.char('Magento File Location', size=250),
        'change_or_no_change':fields.selection([('change', 'Change'),('no_change', 'No Change')],'Changes'),
        'last_updated_changes': fields.datetime('Last Updated'),
        'full_url':fields.char('Full URL', size=256),
        'preview_ebay':fields.binary('Preview of Ebay Image'),
    }
    _defaults = {
        'link': lambda *a: False,
        'change_or_no_change': 'change',
        }
Esempio n. 4
0
class congreso_noticiasgen(osv.osv):
    _name = 'congreso.noticiasgen'
    _description = 'Noticias generadas'
    _columns = {
        'fecha': fields.date('Fecha'),
        'medio': fields.many2one('congreso.medios', 'Medio'),
        'enlace': fields.char('Enlace', size=200, required=False),
        'image1': fields.binary("Imagen", help="Seleccionar imagen aqui"),
        'image2': fields.binary("Imagen", help="Seleccionar imagen aqui"),
        'image3': fields.binary("Imagen", help="Seleccionar imagen aqui"),
        'informacion': fields.text('Información', required=False),
    }
Esempio n. 5
0
class congreso_publicidad(osv.osv):
    _name = 'congreso.publicidad'
    _description = 'Publicidad'
    _columns = {
        'fecha': fields.date('Fecha'),
        'medio': fields.many2one('congreso.medios', 'Medio'),
        'enlace': fields.char('Enlace', size=200, required=False),
        'image1': fields.binary("Imagen", help="Seleccionar imagen aqui"),
        'image2': fields.binary("Imagen", help="Seleccionar imagen aqui"),
        'image3': fields.binary("Imagen", help="Seleccionar imagen aqui"),
        'presupuesto': fields.text('Presupuesto', required=False),
        'informacion': fields.text('Información', required=False),
    }
Esempio n. 6
0
class res_company (osv.osv):
    
    _inherit = 'res.company'
    
    _columns = {
                'tire_stock': fields.many2one ('stock.location','Tire Stock'),
                'retread': fields.many2one ('stock.location','Retread'),
                'scratch': fields.many2one ('stock.location','Scratch'),
                'waste': fields.many2one ('stock.location','Waste'),
                'flatire': fields.many2one ('stock.location','Flat Tire'),
                'schema4' : fields.binary('4 Tire Schema'),
                'schema6' : fields.binary('6 Tire Schema'),
                'schema8' : fields.binary('8 Tire Schema')
                }
Esempio n. 7
0
class photo_security(osv.osv):
    _name = "photo.security"
    _description = "Photo"
    _columns = {
        'name':
        fields.char('Photo Description', size=128, required=True, select=True),
        'date':
        fields.datetime("Date of Photo"),
        'photo':
        fields.binary('Photo'),
        'photo_card':
        fields.binary('Photo card'),
        'photo_car':
        fields.binary('Photo car'),
    }
Esempio n. 8
0
class report_xml_file(osv.osv):
    _name = 'ir.actions.report.xml.file'
    _columns = {
        'file':
        fields.binary('File',
                      required=True,
                      filters="*.jrxml,*.properties,*.ttf",
                      help=''),
        'filename':
        fields.char('File Name', size=256, required=False, help=''),
        'report_id':
        fields.many2one('ir.actions.report.xml',
                        'Report',
                        required=True,
                        ondelete='cascade',
                        help=''),
        'default':
        fields.boolean('Default', help=''),
    }

    def create(self, cr, uid, vals, context=None):
        result = super(report_xml_file, self).create(cr, uid, vals, context)
        self.pool.get('ir.actions.report.xml').update(cr, uid,
                                                      [vals['report_id']],
                                                      context)
        return result

    def write(self, cr, uid, ids, vals, context=None):
        result = super(report_xml_file, self).write(cr, uid, ids, vals,
                                                    context)
        for attachment in self.browse(cr, uid, ids, context):
            self.pool.get('ir.actions.report.xml').update(
                cr, uid, [attachment.report_id.id], context)
        return result
Esempio n. 9
0
class account_report_print_indicators_with_pdf(osv.osv_memory):
    _name = "account.report.print.indicators.with.pdf"
    _description = "Print Indicators"
    _columns = {
        'file': fields.binary('Select a PDF File',
                              filters='*.pdf',
                              required=True),
    }

    def check_report(self, cr, uid, ids, context=None):
        datas = {}
        if context is None:
            context = {}
        data = self.read(cr, uid, ids)[0]
        datas = {
            'ids': context.get('active_ids', []),
            'model': 'account.report.report',
            'form': data
        }

        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'print.indicator.pdf',
            'datas': datas,
        }
Esempio n. 10
0
class res_user(osv.osv):
    _name = 'res.users'
    _inherit = 'res.users'

    _columns = {
        'photo_signature': fields.binary('Signature'),
    }
Esempio n. 11
0
class FileFormatLoader(osv.osv_memory):
    _name = 'cnab.wizard.file_format_loader'

    def load(self, cr, uid, ids, context=None):
        pool = self.pool.get('cnab.file_format')
        parser = Parser()
        wizard, = self.browse(cr, uid, ids)
        xml = base64.b64decode(wizard.file)
        data = parser.parse_schema(xml)
        data['type'] = wizard.type
        if wizard.replace:
            old_ids = pool.search(cr, uid, [('name', '=', data['name'])])
            pool.unlink(cr, uid, old_ids)
        new_id = pool.create(cr, uid, data)
        return {
            'type': 'ir.actions.act_window',
            'res_model': 'cnab.file_format',
            'view_mode': 'form',
            'view_type': 'form',
            'res_id': new_id
        }

    _columns = {
        'file':
        fields.binary('File', required=True),
        'type':
        fields.selection([('remessa', 'Arquivo de Remessa Bancária'),
                          ('retorno', 'Arquivo de Retorno Bancário'),
                          ('extrato', 'Arquivo de Extrato Bancário')],
                         'File Type',
                         required=True),
        'replace':
        fields.boolean('Replace any entries with the same name')
    }
class quality_save_report(osv.osv_memory):

    _name = "save.report"
    _description = "Save Report of Quality"

    def default_get(self, cr, uid, fields, context=None):
        res = super(quality_save_report, self).default_get(cr,
                                                           uid,
                                                           fields,
                                                           context=context)
        active_ids = context.get('active_ids')
        data = self.pool.get('module.quality.detail').browse(
            cr, uid, active_ids, context=context)[0]
        if not data.detail:
            raise osv.except_osv(_('Warning'), _('No report to save!'))
        buf = cStringIO.StringIO(data.detail)
        out = base64.encodestring(buf.getvalue())
        buf.close()
        return {'module_file': out, 'name': data.name + '.html'}

    _columns = {
        'name':
        fields.char('File Name',
                    required=True,
                    size=32,
                    help="Save report as .html format"),
        'module_file':
        fields.binary('Save report', required=True),
    }
Esempio n. 13
0
class vit_master_type(osv.osv):
    _name = "vit.master.type"
    _description = 'Master Type'
    _rec_name = 'model_product'

    _columns = {
        'model_product':
        fields.char(
            'Model/Type',
            required=True,
        ),
        'product_id':
        fields.many2one(
            'product.product',
            'Sample Product',
            domain=
            "['|',('categ_id.name','=','Mutif'),('categ_id.name','=','Little Mutif')]"
        ),
        'main_qty':
        fields.integer('Body'),
        'variation_qty':
        fields.integer('Variation'),
        'categ_id':
        fields.char('Category'),
        'cost_model':
        fields.float('Makloon Price'),
        'cost_model_cut':
        fields.float('Cutting Price'),
        'image':
        fields.binary('image', type="binary"),
    }

    _sql_constraints = [
        ('model_product_uniq', 'unique(model_product)',
         'Model Ini Sudah Tersedia, Silahkan Buat Model lain dengan Product Sample Lain!'
         ),
    ]

    def on_change_categ_id(self, cr, uid, ids, categ_id, context=None):
        categ_id_obj = self.pool.get('product.category')
        categ_id = categ_id_obj.browse(cr, uid, categ_id, context=context)

    def on_change_product_id(self, cr, uid, ids, product_id, context=None):
        product_obj = self.pool.get('product.product')
        product = product_obj.browse(cr, uid, product_id, context=context)

        if product_id != False:
            return {
                'value': {
                    'model_product': product.type_model,
                    'categ_id': product.categ_id.name,
                }
            }
        else:
            return {
                'value': {
                    'model_product': '',
                    'categ_id': '',
                }
            }
Esempio n. 14
0
class certificate(osv.Model):
    _inherit = "crypto.certificate"

    def _get_cert_selection(self, cursor, user_id, context=None):
        return (('fina_demo', 'Fina Demo Certifiacte'),
                ('fina_prod', 'Fina Production Certificate'),
                ('personal', 'Personal Certificate'), ('other', 'Other types'))

    _columns = {
        'company_id':
        fields.many2one('res.company',
                        'Tvrtka',
                        help='Cerificate is used for this company only.'),
        'group_id':
        fields.many2one('res.groups',
                        'User group',
                        select=True,
                        help='Users who use the certificate.'),
        'cert_type':
        fields.selection(_get_cert_selection, 'Certificate Use'),
        'pfx_certificate':
        fields.binary('Certificate', help='Original Pfx File.')
    }
    _defaults = {
        'state':
        'draft',
        'company_id':
        lambda self, cr, uid, c: self.pool.get('res.company').
        _company_default_get(cr, uid, 'crypto.certificate', context=c),
    }
Esempio n. 15
0
class account_pay(osv.osv):
    _name = "account.pay"
    _description = "Payment Export History"
    _rec_name = 'payment_order_id'
    _columns = {
        'payment_order_id':
        fields.many2one('payment.order',
                        'Payment Order Reference',
                        readonly=True),
        'state':
        fields.selection([('failed', 'Failed'), ('succeeded', 'Succeeded')],
                         'Status',
                         readonly=True),
        'file':
        fields.binary('Saved File', readonly=True),
        'note':
        fields.text('Creation Log', readonly=True),
        'create_date':
        fields.datetime('Creation Date', required=True, readonly=True),
        'create_uid':
        fields.many2one('res.users',
                        'Creation User',
                        required=True,
                        readonly=True),
    }
Esempio n. 16
0
class upoflix_user(osv.Model):
    _name = 'upoflix.user'
    _description = 'This is an UPOFLIX user'

    _columns = {
        'name':
        fields.char('Name', size=64, required=False, readonly=False),
        'surname':
        fields.char('Surname', size=64, required=True),
        'mail':
        fields.char('Email', size=120, required=True),
        'password':
        fields.char('Password', size=64, required=True),
        'registration_date':
        fields.date("Registration Date", readonly=True),
        'image':
        fields.binary("Image"),
        'user_film_favs':
        fields.many2many('film', 'user_film_fav', 'user_id', 'film_id',
                         'Favorite Films'),
        'user_serie_favs':
        fields.many2many('serie', 'user_serie_fav', 'user_id', 'serie_id',
                         'Favorite Series'),
    }
    _defaults = {
        'registration_date': datetime.now().strftime('%Y-%m-%d'),
    }
    _sql_constraints = [
        ('name_uniq', 'unique (name)',
         'The Name of the User must be unique !'),
        ('mail_uniq', 'unique (mail)',
         'The Mail of the User must be unique !'),
    ]
Esempio n. 17
0
class partaker(osv.osv):

    _name = 'partaker'
    _description = 'this is a partaker from a resource.'

    _columns = {
        'name':
        fields.char('Name', size=64, required=True, readonly=False),
        'country':
        fields.many2one("res.country", "Country", required=True),
        'birth':
        fields.date('Birth'),
        'image':
        fields.binary("Image"),
        'series_actor':
        fields.many2many('serie', 'serie_partaker_rel', 'partaker_id',
                         'serie_id', 'Series'),
        'films_actor':
        fields.many2many('film', 'film_partaker_rel', 'partaker_id', 'film_id',
                         'Films'),
        'series_director':
        fields.one2many("serie", "director", "Series Director"),
        'films_director':
        fields.one2many("film", "director", "Films Director"),
    }
    _sql_constraints = [
        ('name_uniq', 'unique (name)',
         'The Name of the Partaker must be unique !'),
    ]
Esempio n. 18
0
class universidad(osv.Model):
    _name = 'gid.cursos.universidad'

    _columns = {
        'name':
        fields.char('Nombre', required=True, size=200),
        'codigo_entidad':
        fields.char(u'Código', required=True),
        'direccion':
        fields.char('Dirección', required=True, size=100),
        'telefono':
        fields.char('Teléfono', required=True, size=100),
        'ciudad':
        fields.selection([('tulua', 'Tuluá'), ('cali', 'Cali'),
                          ('buga', 'Buga'), ('sevilla', 'Sevilla')],
                         string="Ciudad"),
        'email':
        fields.char('E-mail', required=True, size=100),
        'logo':
        fields.binary(string='Logo', filters='*.png, *.jpeg'),
        'active':
        fields.boolean('Active'),
    }
    _defaults = {
        'active': True,
    }
Esempio n. 19
0
class act_client(osv.osv):
    _name = 'ir.actions.client'
    _inherit = 'ir.actions.actions'
    _table = 'ir_act_client'
    _sequence = 'ir_actions_id_seq'
    _order = 'name'

    def _get_params(self, cr, uid, ids, field_name, arg, context):
        return dict([
            ((record.id, ast.literal_eval(record.params_store))
             if record.params_store else (record.id, False))
            for record in self.browse(cr, uid, ids, context=context)
        ])

    def _set_params(self, cr, uid, id, field_name, field_value, arg, context):
        assert isinstance(field_value, dict), "params can only be dictionaries"
        self.write(cr, uid, id, {'params_store': repr(field_value)}, context=context)

    _columns = {
        'tag': fields.char('Client action tag', size=64, required=True,
                           help="An arbitrary string, interpreted by the client"
                                " according to its own needs and wishes. There "
                                "is no central tag repository across clients."),
        'params': fields.function(_get_params, fnct_inv=_set_params,
                                  type='binary', 
                                  string="Supplementary arguments",
                                  help="Arguments sent to the client along with"
                                       "the view tag"),
        'params_store': fields.binary("Params storage", readonly=True)
    }
    _defaults = {
        'type': 'ir.actions.client',

    }
Esempio n. 20
0
class MutasiStock(osv.osv_memory):
    _name = "mutasi.stock"
    _columns = {
                'date_from' : fields.date('From'),
                'date_to' : fields.date('To'),
                'data_eksport': fields.binary('File', readonly=True),
                'name': fields.char('File Name', 16),
                'report': fields.selection((('del','Delivery Order'), ('inc','Incoming Shipment'), (('int','Internal Move'))), 'Report'),
    }   
    
    _defaults = {
                'report': 'del',
                'date_from': time.strftime('%Y-%m-%d'),
                'date_to': time.strftime('%Y-%m-%d'),
    }   

    def eksport_excel(self,cr,uid,ids,context=None):
        searchConf = self.pool.get('ir.config_parameter').search(cr, uid, [('key', '=', 'base.print')], context=context)
        browseConf = self.pool.get('ir.config_parameter').browse(cr,uid,searchConf,context=context)[0]
        
        val = self.browse(cr, uid, ids)[0] 
        # print '=====================================',val.report
        urlTo = str(browseConf.value)+"report-accounting/stock-move&jenis="+val.report+"&from="+val.date_from+"&to="+val.date_to
        
        
        return {
            'type'  : 'ir.actions.client',
            'target': 'new',
            'tag'   : 'print.out.stockmove',
            'params': {
                # 'id'  : ids[0],
                'redir' : urlTo,
                'uid':uid
            },
        }
Esempio n. 21
0
class resource(osv.osv):

    _name = 'resource'
    _description = 'This is a resource, can be a Film or a serie'

    def _media(self, cr, uid, ids, field, args, context=None):
        res = {}
        for r in self.browse(cr, uid, ids):
            if len(r.scores) != 0:
                suma = sum(s.score for s in r.scores)
                res[r.id] = suma / float(len(r.scores))
            else:
                res[r.id] = 0.0
        return res

    _columns = {
        'name':
        fields.char('Name', size=64, required=True, readonly=False),
        'year':
        fields.date('Year', required=True),
        'image':
        fields.binary("Image"),
        'osd':
        fields.many2one("osd", "OSD", required=True),
        'director':
        fields.many2one('partaker', 'Director', required=True),
        'total_score':
        fields.function(_media,
                        type="float",
                        string="Score Average",
                        store=True)
    }
Esempio n. 22
0
class download_carrier_file_wizard(osv.osv_memory):
    _name = 'download.carrier.file.wizard'

    _columns = {
        'format_id': fields.many2one('file.format', 'Carrier File Format', required=True),
        'carrier_file': fields.binary('Carrier File', readonly=True),
        'carrier_file_name': fields.char('Carrier File Name', size=255),
        'state': fields.selection((('init','Init'),('download','Download')), 'State')
    }

    _defaults = {
        'state': 'init'
    }

    def download_file(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        for obj in self.browse(cr, uid, ids, context=context):
            file_name = obj.format_id.file_name
            file_path = obj.format_id.path + "/" + file_name
            if not os.path.isfile(file_path):
                raise osv.except_osv(_("Error"), _("File %s does not exist" % (file_path)))

            carrier_file = open( file_path, 'rb' )
            carrier_file_b64 = base64.b64encode(carrier_file.read())
            carrier_file.close()

            carrier_file = open(file_path, 'w')
            carrier_file.write('')
            carrier_file.close()

        return self.write(cr, uid, ids, {
            'carrier_file': carrier_file_b64, 
            'state': 'download',
            'carrier_file_name': file_name})
Esempio n. 23
0
class stock_picking(osv.Model):
    _inherit = 'stock.picking'

    _columns = {
        'filename': fields.char('File Name', size=255, readonly=True),
        'data': fields.binary('File', readonly=True),
    }
Esempio n. 24
0
class create_data_template(osv.osv_memory):
    _name = 'jasper.create.data.template'
    _description = 'Create data template'

    def action_create_xml(self, cr, uid, ids, context=None):
        for data in self.read(cr, uid, ids, context=context):
            model = self.pool.get('ir.model').browse(cr,
                                                     uid,
                                                     data['model'][0],
                                                     context=context)
            xml = self.pool.get('ir.actions.report.xml').create_xml(
                cr, uid, model.model, data['depth'], context)
            self.write(cr, uid, ids, {
                'data': base64.encodestring(xml),
                'filename': 'template.xml'
            })
        return {
            'view_type': 'form,tree',
            'view_mode': 'form',
            'res_model': 'jasper.create.data.template',
            'res_id': ids[0],
            'targer': 'new',
            'type': 'ir.actions.act_window',
        }

    _columns = {
        'model': fields.many2one('ir.model', 'Model', required=True),
        'depth': fields.integer("Depth", required=True),
        'filename': fields.char('File Name', size=32),
        'data': fields.binary('XML')
    }

    _defaults = {'depth': 1}
Esempio n. 25
0
class res_company(osv.osv):
    _inherit = "res.company"
    _columns = {
        'signature': fields.binary('Signature'),
        'accredetion': fields.text('Accredetion'),
        'approval_authority': fields.text('Approval Authority'),
    }
Esempio n. 26
0
class ea_import_chain_result(osv.osv):
    _name = 'ea_import.chain.result'
    _order = 'import_time desc'
    _columns = {
        'name': fields.char('Model', size=256, required=True),
        'chain_id': fields.many2one('ea_import.chain',),  # to be removed
        'log_id': fields.many2one('ea_import.log',),
        'result_ids_file': fields.binary('Result Ids',),
        'import_time': fields.datetime('Import Time',),
        'scheduler_log_id': fields.many2one('ea_import.scheduler.log', 'Scheduler Log'),
        }

    _defaults = {
    }

    def show_result(self, cr, uid, ids, context={}):
        for result in self.browse(cr, uid, ids, context=context):
            result_ids = eval(base64.b64decode(result.result_ids_file))
            return {
                'name': 'Result',
                'view_mode': 'tree,form',
                'view_type': 'form',
                'view_id': False,
                'res_model': result.name,
                'domain': [('id', 'in', result_ids)],
                'type': 'ir.actions.act_window',
                'nodestroy': True,
                'target': 'current',
            }
class wizard_import(osv.osv_memory):
    _name = 'wizard.import'
    _columns = {
        'name': fields.binary('File'),
        'msg': fields.text('Messages', readonly=True),
        'validate': fields.boolean('Validate?')
    }

    def send_lines(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        form = self.read(cr, uid, ids, [])
        order_id = context.get('res_id', False)
        fdata = form and base64.decodestring(form[0]['name']) or False
        fvalidate = form and form[0]['validate'] or False
        msg = self.pool.get('sale.order').import_data_line(cr,
                                                           uid,
                                                           order_id,
                                                           fdata,
                                                           fvalidate,
                                                           context=context)
        if msg:
            self.write(cr, uid, ids, {'msg': msg})
            return True
        return {}
Esempio n. 28
0
class material(osv.Model):

    _name = 'material'
    _description = 'UPOKid material'

    _columns = {
        'name':
        fields.char('Name', size=64, required=True, readonly=False),
        'units':
        fields.integer('Units', required=True),
        'description':
        fields.text('Description', required=False),
        'photo':
        fields.binary('Photo', required=False),
        'upokidsclass_ids':
        fields.many2many('upokidsclass', 'material_class_rel', 'material_id',
                         'class_id', 'Classes'),
        'tournament_ids':
        fields.many2many('tournament', 'tournament_material_rel',
                         'material_id', 'tournament_id', 'Tournaments'),
    }

    def _check_stock(self, cr, uid, ids):
        return self.browse(cr, uid, ids)[0].units >= 0

    _constraints = [
        (_check_stock, 'Wrong Stock', ['units']),
    ]
Esempio n. 29
0
class import_wizard(osv.osv_memory):

    _name = 'import_wizard'
    _description = 'Simple import wizard'

    _columns = {
        'chain_id': fields.many2one('ea_import.chain', 'Import Chain', ),
        'import_file': fields.binary('Importing file', ),
        'type': fields.selection([
                            ('csv', 'CSV Import'),
                            ('ftp', 'Import from ftp server'),
                            ('mysql', 'MySql Import'),
                            ], 'Import Type',
                            required=True,
                            readonly=True,
                            help="Type of connection import will be done from"),
    }

    _defaults = {
         'chain_id': lambda cr, uid, ids, context: context.get('import_chain_id'),
         'type': lambda self, cr, uid, ctx={}: ctx.get('import_chain_id') and self.pool.get('ea_import.chain').browse(cr, uid, ctx['import_chain_id'], context=ctx).type,
    }

    def do_import(self, cr, uid, ids, context={}):
        for wizard in self.browse(cr, uid, ids, context=context):
            wizard.chain_id.write({'input_file': wizard.import_file})
            cr.commit()
            wizard.chain_id.import_to_db()
        return {'type': 'ir.actions.act_window_close'}
Esempio n. 30
0
class company(osv.osv):
    _inherit = 'res.company'
    _columns = {
        'logo_web':
        fields.binary(
            'Logo Header',
            filters='*.png,*.gif,*.jpg,*.jpeg',
            help=
            "Image file for company logo at header of web client. Ideally, a 200x55 png with transparent background."
        ),
        'color_set':
        fields.many2one('res.company.color',
                        string='Color schema',
                        help="Set of colors to display on Web client"),
        'color_top':
        fields.related('color_set', 'color_top', readonly=True, type='char'),
        'color_mid':
        fields.related('color_set', 'color_mid', readonly=True, type='char'),
        'color_low':
        fields.related('color_set', 'color_low', readonly=True, type='char'),
        'button_top':
        fields.related('color_set', 'button_top', readonly=True, type='char'),
        'button_mid':
        fields.related('color_set', 'button_mid', readonly=True, type='char'),
        'link_top':
        fields.related('color_set', 'link_top', readonly=True, type='char'),
    }
Esempio n. 31
0
            #
            statement_facade.write(cr, uid, [statement_id], {
                                    'date': st_data['fecha_fin'],
                                    'balance_start': st_data['saldo_ini'],
                                    'balance_end_real': st_data['saldo_fin'],
                                }, context=context)

            # Attach the C43 file to the current statement
            data = base64.encodestring( c43_wizard.file )
            res = statement_facade._attach_file_to_statement(cr, uid, data, statement_id, _('Bank Statement'), _('bank-statement.txt') )

        return {}


    _name = 'l10n.es.bank.statement.import.c43.wizard'

    _columns = {
        'file': fields.binary('Bank Statements File', required=True, filename='file_name'),
        'file_name': fields.char('Bank Statements File', size=64, readonly=True),
        'reco_reference_and_amount': fields.boolean('Reconcile by reference and amount'),
        'reco_vat_and_amount' : fields.boolean('Reconcile by VAT number and amount'),
        'reco_amount' : fields.boolean('Reconcile by amount'),
        'reco_rules' : fields.boolean('Statement Line Rules'),
        'reco_payment_order': fields.boolean('Reconcile payment orders by total amount'),
        'reco_max_days' : fields.integer('Max. days from statement date',help='Maximum difference in days, between the maturity date of the entry to reconcile and the bank statement entry')
        }

l10n_es_bank_statement_import_c43_wizard()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Esempio n. 32
0
                if transport: transport.close()
            except Exception:
                # ignored, just a consequence of the previous exception
                pass
        raise osv.except_osv("Connection Test Succeeded!", "Everything seems properly set up!")

    _name = 'vehicle.config'
    _description = 'Configuration for Vehicle Fits ftp link'
    _table = 'vehiclefits_config'
    _columns = {

        'name': fields.char('Name', size=20),
        'vf_url': fields.char('Url', size=30, help="Url to Magento Web"),
        'sftp_user': fields.char('Ftp user', size=20, required=True),
        'sftp_password': fields.char('Ftp password', size=20, required=False),
        'sftp_pem': fields.binary('RSA Key', required=True),
        'sftp_host': fields.char('FTP IP host', size=15, required=True),
        'sftp_port': fields.integer('Ftp Port', help='Port of the connection'),
        'sftp_local_file': fields.char('Full path to local csv file'),
        'sftp_remote_file': fields.char('Name of remote file', help="Default name for import is"
                                                                    " product-fitments-import.csv"),
        'sftp_remote_dir': fields.char('Full remote path'),
        'erp_host': fields.char('Erp host', size=20, required=True),
        'erp_user': fields.char('Erp DB user', size=15, required=True),
        'erp_password': fields.char('Erp password', size=20, required=True),
        'erp_db': fields.char('Erp DB', size=20, required=True)

    }


vehicle_config()
Esempio n. 33
0
    def _is_remotewarehouse(self, cr, uid, context=None):
        try:
            entity = self.pool.get('sync.client.entity').get_entity(cr, uid)
            if entity.usb_instance_type == 'remote_warehouse':
                return True
        except Exception, e:
            pass
        return False

    _columns = {
        'message' : fields.text("Caption", readonly=True),
        'state' : fields.selection([
                ('need-provide-manually','Need To Provide Manually The Files'),
                ('need-download','Need Download'),
                ('up-to-date','Up-To-Date'),
                ('need-install','Need Install'),
                ('need-restart','Need Restart'),
                ('blocked','Blocked')
            ], string="Status"),
        'patch' : fields.binary("Patch"),
        'error': fields.text('Error', readonly="1"),
    }

    _defaults = {
        'message' : _generate,
        'state' : _get_state,
        'error': _get_error,
    }

upgrade()
        'saturday_delivery': fields.boolean('Saturday Delivery?'),
        'description': fields.text('Description'),
        'state':fields.selection(STATE_SELECTION, 'Status', readonly=True,),

        # The following are UPS filled information
        'billed_weight':fields.float('Billed Weight', digits=(10, 4), 
            readonly=True, help=(
                'The billed weght may be different from the actual weight.'
                'This is computed by UPS.')),
        'billed_weight_uom':fields.many2one('product.uom', 'Billed Weight UOM',
            readonly=True),
        'total_amount':fields.float('Total Amount', digits=(14, 4),
            select="1", readonly=True),
        'total_amount_currency':fields.many2one('res.currency',
            'Total Amount Currency', select="2", readonly=True,),
        'digest': fields.binary('Information digest for DIGEST'),
        'notificationemailaddr': fields.char('Notification eMail Addresses',
            size=255, help='Separated by commas(,).'),
    }

    _defaults = {
        'name': lambda *a: 'Not Processed',
        'state': lambda *a: 'draft'
    }

UpsShippingRegister()


class UpsShippingRegisterPackage(osv.osv):
    """
    Model to record all packages corresponding
        "path": fields.function(_get_module_path, method=True, string="Path", type="char", size=512, readonly=True),
        "technical_certificate": fields.selection(
            [("not_started", "Not Started"), ("failed", "Failed"), ("succeeded", "Succeeded"), ("skipped", "Skipped")],
            "Technical Certification",
        ),
        "functional_certificate": fields.selection(
            [("not_started", "Not Started"), ("failed", "Failed"), ("succeeded", "Succeeded"), ("skipped", "Skipped")],
            "Functional Certification",
        ),
        "sale_ids": fields.many2many(
            "sale.order", "maintenance_module_sale_rel", "module_id", "sale_id", "Sale orders"
        ),
        "nbr_source_line": fields.integer(
            "Source Line of Code", help="number of source line of code of uploaded module"
        ),
        "module_zip": fields.binary("Module Zip File"),
        "state": fields.selection(
            [("draft", "Draft"), ("open", "Open"), ("failed", "Failed"), ("done", "Done"), ("cancel", "Cancel")],
            "State",
            readonly=True,
        ),
        "test_ids": fields.one2many("test", "module_id", "Tests"),
        "test_tech_ids": one2many_mod_advert("test", "id", "Tests"),
        "test_func_ids": one2many_mod_advert("test", "id", "Tests"),
        "tech_certificate": fields.boolean("Technicle certificate", help="tick if you want technicle certificate"),
        "func_certificate": fields.boolean("Functional certificate", help="tick if you want functional certificate"),
        "tech_user_id": fields.many2one("res.users", "Technicle User", help="User for Technicle tests"),
        "func_user_id": fields.many2one("res.users", "Functional User", help="User for Functional tests"),
    }

    _defaults = {
Esempio n. 36
0
        finally:
            ofile.close()
        return True

    def _set_image(self, cr, uid, id, name, value, arg, context=None):
        local_media_repository = self.pool.get('res.company').get_local_media_repository(cr, uid, context=context)
        if local_media_repository:
            image = self.browse(cr, uid, id, context=context)
            return self._save_file(os.path.join(local_media_repository, image.product_id.default_code), '%s%s'%(image.name, image.extention), value)
        return self.write(cr, uid, id, {'file_db_store' : value}, context=context)

    _columns = {
        'name':fields.char('Image Title', size=100, required=True),
        'extention': fields.char('file extention', size=6),
        'link':fields.boolean('Link?', help="Images can be linked from files on your file system or remote (Preferred)"),
        'file_db_store':fields.binary('Image stored in database'),
        'file':fields.function(_get_image, fnct_inv=_set_image, type="binary", method=True, filters='*.png,*.jpg,*.gif'),
        'url':fields.char('File Location', size=250),
        'comments':fields.text('Comments'),
        'product_id':fields.many2one('product.product', 'Product')
    }

    _defaults = {
        'link': lambda *a: False,
    }

    _sql_constraints = [('uniq_name_product_id', 'UNIQUE(product_id, name)',
                _('A product can have only one image with the same name'))]

product_images()
Esempio n. 37
0
                                input_model[ir_model_field.name]

                record_dict['fields'] = field_dict
                data_json.append(record_dict)

        out = base64.encodestring(json.dumps(data_json, indent=4))

        return self.write(cr, uid, ids, {
            'state': 'done', 'dm_export_data_wizard_data': out,
            'name': json_exported_file_name
        }, context=context)

    EXPORT_TYPE = (('a', 'based on model'), ('b', 'based on module'))

    _columns = {
        'name': fields.char('Filename', size=128, readonly=True),
        'dm_export_data_wizard_type': fields.selection(EXPORT_TYPE,
            'DM Export Data Wizard Type'),
        'ir_model_id': fields.many2one('ir.model', 'IR Model'),
        'ir_module_module_id': fields.many2one('ir.module.module',
                                               'IR Module Module'),
        'dm_export_data_wizard_data': fields.binary('Export Data Wizard Data',
                                                 readonly=True),
        'state': fields.selection([('init', 'init'), ('done', 'done')],
                                  'state', readonly=True),
    }

    _defaults = {'state': 'init', 'dm_export_data_wizard_type': 'a'}

DmExportDataWizard()
		}
	_defaults = {
		'active': lambda *a, 1,
		}
	_sql_constraints = [('name_uniq', 'unique(name)', 'Pallet names must be unique!')]
pallet_types()

class pallet_stack_layout(osv.osv):

	_name = 'pallet.stack.layout'
    _columns = {
		'name': fields.char('Description', size=128, required=True),
		'active': fields.boolean('Active'),
		'program': fields.integer('Program Number', help='If this is stacked on a palletiser, this is the palletiser program number'),
		'pallet_type_id': fields.many2one('pallet.types','Pallet Type', ondelete='set null'),
		'layout_diagram': fields.binary('Layout diagram', filters='*.bmp,*.jpg,*.gif')
		'slipsheeted': fields.boolean('Slipsheeted', help='If product is stacked onto slipsheets, this box should be ticked.'),
		'layer_qty': fields.integer('Packages per layer'),
		'layer_height': fields.integer('Height per layer (mm)'),
		'layer_ids': fields.one2many('pallet_stack_layers', 'layout_id','Layer options'),
        }
	_defaults = {
		'active': lambda *a, 1,
		}
pallet_stack_layout()

class pallet_stack_layers(osv.osv):
	_name = 'pallet.stack.layers'
	#TODO This needs to calculate sum height of each layer and add the pallet height to come up with an overall height.
	#def _calc_total_height(self, cr, uid, ids, field_name, arg, context=None)
	
        return True

    def _set_image(self, cr, uid, id, name, value, arg, context=None):
        image = self.browse(cr, uid, id, context=context)
        full_path = self._image_path(cr, uid, image, context=context)
        if full_path:
            return self._save_file(full_path, value)
        return self.write(cr, uid, id, {"file_db_store": value}, context=context)

    _columns = {
        "name": fields.char("Image Title", translate=True, size=100, required=True),
        "extention": fields.char("file extention", size=6),
        "link": fields.boolean(
            "Link?", help="Images can be linked from files on your file system or remote (Preferred)"
        ),
        "file_db_store": fields.binary("Image stored in database"),
        "file": fields.function(
            _get_image, fnct_inv=_set_image, type="binary", method=True, filters="*.png,*.jpg,*.gif"
        ),
        "url": fields.char("File Location", size=128),
        "comments": fields.text("Comments", translate=True),
        "product_id": fields.many2one("product.product", "Product"),
    }

    _defaults = {"link": lambda *a: False}

    _sql_constraints = [
        ("uniq_name_product_id", "UNIQUE(product_id, name)", _("A product can have only one image with the same name"))
    ]