小编Neo*_*oVe的帖子

自定义Facebook登录按钮 - Android

我正在遵循这个教程,但到目前为止我无法使它工作,虽然这是从一年前左右...

我正在使用androidStudo 1.2.2和FacebookSDK 4.

我想使用自定义按钮简单登录facebook,如下图所示:

例

现在,在本教程的示例中,我遇到了Session变量问题,它说它无法解决它getActivity()

有没有人在FacebookSDK4.0上试过这个?

这是正确的方法还是有更新的东西?

提前致谢!

android facebook facebook-sdk-4.0

47
推荐指数
5
解决办法
7万
查看次数

该项目可能正在使用不包含方法'compileSdkVersion()'的Gradle版本

在尝试运行最初在Eclipse ADT上创建的项目时,我遇到了这个问题.

Error:(17, 0) Gradle DSL method not found: 'compileSdkVersion()'
Possible causes:<ul><li>The project 'TaxiAndroidOpen-master' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
Run Code Online (Sandbox Code Playgroud)

我已将此转换为Android Studio gradle系统.

但我无法运行它,也无法编译它,因为这个错误,这里是生成的gradle:

// Top-level build file where you can add configuration options common to  all sub-projects/modules.
buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
   }
}
allprojects {
repositories {
    jcenter()
   } …
Run Code Online (Sandbox Code Playgroud)

eclipse android gradle android-studio

14
推荐指数
2
解决办法
8万
查看次数

将模型管理添加到Active Admin - Rails 3

我是Rails和ActiveAdmin的新手.

我希望有一个类似Django管理员的界面,我的应用程序模型,所以我可以管理产品和其他东西.

到目前为止,我有admin_users我可以在我的应用程序中添加或删除管理员用户的URL,这太棒了.

我正在使用Rails 3,我想知道我是否可以添加除用户之外的新菜单,以便我可以管理其他模型 dashboard

我试过了 rails generate active_admin:resource Product

它创建一个名为product.rbon 的文件,app/admin/但它不起作用,这是我的Product模型product.rb

class Product < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, 
     :recoverable, :rememberable, :trackable, :validatable

# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
belongs_to :category
has_many :line_items
has_many :orders, through: :line_items

validates_presence_of :category_id, :name, :price_cents
attr_accessible :avatar
has_attached_file :avatar, :styles => { :medium …
Run Code Online (Sandbox Code Playgroud)

ruby django ruby-on-rails ruby-on-rails-3 activeadmin

6
推荐指数
1
解决办法
4555
查看次数

SQL Server中的DateTime问题

我正在尝试对MS SQL Server中已设置的数据库执行INSERT,数据库服务器位于共享主机(godaddy)中.

而我想要实现的是将文章存储到数据库中,但每次我发布或获取文章的预览时服务器都会抛出我

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the …
Run Code Online (Sandbox Code Playgroud)

c# sql-server asp.net ado.net datetime

5
推荐指数
1
解决办法
3万
查看次数

我的自定义模块没有出现在我的openerp 7安装上

我有一个我最初为openerp 6.1制作的自定义模块,我想将它安装在我得到的另一个openerp服务器上,使用最新的openerp 7版本.

我已经做了"更新模块列表"并搜索了"额外"和"未安装"过滤器,但没有成功.

我在某处看到openerp 6.1模块在openerp 7上并不完全相同

omebody可以对此有所了解吗?此外,关于openerp 7上的自定义模块的文档目前还很糟糕.

这是我的 __init__.py

import schoolsout
Run Code Online (Sandbox Code Playgroud)

__openerp__.py

{
"name" : "Student Information",
"version" : "6.0.1",
"author" : "Koci",
"website" : "http://www.tuespacioweb.com.ve",
"category" : "General",
"depends" : ["base"],
"description" : "Certificados de NO Produccion Grafibond",
"init_xml" : [],
"demo xml" : [],
"update_xml" : [ "schoolsout_view.xml"],
"installable": True,
"active": False,
"certificate" : ""
Run Code Online (Sandbox Code Playgroud)

}

schoolsout.py

from openerp.osv import fields, orm

class student(orm.Model):

    _name = 'student.student'

    _columns = {
            'name' : fields.char('Student Name', size=16, required …
Run Code Online (Sandbox Code Playgroud)

python module openerp ubuntu-12.04

4
推荐指数
1
解决办法
8858
查看次数

NotImplementedError:frozendict不支持'update' - Odoo v8

我的Odoo v8模块上有这个代码:

@api.multi
def button_generate_wh_doc(self):
    context = self._context
    partner = self.env['res.partner']
    res = {}
    for inv in self:
        view_id = self.env['ir.ui.view'].search([
            ('name', '=', 'account.invoice.wh.iva.customer')])
        context.update({
            'invoice_id': inv.id,
            'type': inv.type,
            'default_partner_id': partner._find_accounting_partner(
                inv.partner_id).id,
            'default_name': inv.name or inv.number,
            'view_id': view_id,
        })
        res = {
            'name': _('Withholding vat customer'),
            'type': 'ir.actions.act_window',
            'res_model': 'account.wh.iva',
            'view_type': 'form',
            'view_id': False,
            'view_mode': 'form',
            'nodestroy': True,
            'target': 'current',
            'domain': "[('type', '=', '" + inv.type + "')]",
            'context': context
        }
    return res
Run Code Online (Sandbox Code Playgroud)

这是一个按钮动作,但当我点击它时它会抛出我:

File "/home/user/odoov8/odoo-venezuela/l10n_ve_withholding_iva/model/invoice.py", line 427, in button_generate_wh_doc …
Run Code Online (Sandbox Code Playgroud)

python openerp odoo-8

2
推荐指数
2
解决办法
2866
查看次数

编程错误:无法适应类型“stock.location” - Odoo v9

我正在迁移一个 Odoo v8 模块,该模块用于将 .csv 上传到stock.inventory模型中。

我已经修复了一些东西,但我仍然有一些错误,比如这个方法:

@api.one
def action_import(self):
    """Load Inventory data from the CSV file."""
    ctx = self._context
    stloc_obj = self.env['stock.location']
    inventory_obj = self.env['stock.inventory']
    inv_imporline_obj = self.env['stock.inventory.import.line']
    product_obj = self.env['product.product']
    if 'active_id' in ctx:
        inventory = inventory_obj.browse(ctx['active_id'])
    if not self.data:
        raise exceptions.Warning(_("You need to select a file!"))
    # Decode the file data
    data = base64.b64decode(self.data)
    file_input = cStringIO.StringIO(data)
    file_input.seek(0)
    location = self.location
    reader_info = []
    if self.delimeter:
        delimeter = str(self.delimeter)
    else:
        delimeter = ','
    reader = …
Run Code Online (Sandbox Code Playgroud)

python openerp odoo-9

2
推荐指数
1
解决办法
7376
查看次数

在树视图上添加默认过滤器 - OpenErp自定义模块

我需要为我的模块的树视图添加一个默认过滤器.

我在openerp中看到了一些代码示例,如下所示:

<filter
    string="Partner"
    icon="terp-partner"
    domain="[]"
    context="{'group_by':'partner_id'}"
    />
Run Code Online (Sandbox Code Playgroud)

这个purchase模块partner_id中的一个,作为一个例子分组.

现在,我有一个自定义模块,当你点击它的菜单时,我需要一个'默认'过滤器.

此过滤器必须显示所有未"过期"的记录,或者在浏览模块中的记录时未通过实际日期的记录.

我在自定义模块中有这个字段:

'Fecha_de_Vence': fields.date(
    'Fecha de Vencimiento',
    required=True,
    select=True,
    ),
Run Code Online (Sandbox Code Playgroud)

这是我需要作为此模块中所有记录的过滤器的字段.

现在,在"高级搜索"中,我可以举例Fecha de Vencimientoactual date,不过,我需要将其作为"默认"过滤器.

任何人都可以在openerp的xml视图中默认如何获得这个?

python xml filter openerp

1
推荐指数
1
解决办法
1万
查看次数

类型错误:write() 得到了一个意外的关键字参数“context” - Odoo v8 到 Odoo v10 社区

我继承了res.partner类,并且有这两种方法:

jour_id = fields.Many2one('account.journal', string='Journal', required=False,
    help="Default journal for damaged invoices")
acc_id = fields.Many2one('account.account', string='Account', 
    help="Default account used for invoices and lines from damaged invoices")
printer_fiscal = fields.Boolean(string='Manages fiscal printer',
    help='Indicates that the company can operate a fiscal printer')

@api.model
def create(self, vals): 
    """ To create a new record,
    adds a Boolean field to true
    indicates that the partner is a company
    """
    #if context is None:
        #context = {}
    ctx = self._context.copy()
    ctx.update({'create_company': True})
    return super(ResCompany, self).create(vals) …
Run Code Online (Sandbox Code Playgroud)

python openerp odoo-8 odoo-10

1
推荐指数
1
解决办法
3749
查看次数

从另一个模型创建 stock.picking - Odoo v8

我有这个方法:

@api.multi
def create_printy(self):
    copy_record = self.env['stock.picking'] # now you call the method directly
    for record in self:

        order_lines = []
        for rec in record.order_lines:
            order_lines.append(
            (0,0,
            {
                'product_id': rec.isbn.id,
                'product_qty': rec.qty,
                }
            ))
        copy_record.create({
            'origin': order.name,
            'picking_type_id.id': 'outgoing',
            'move_lines': order_lines, 
            'move_type': 'direct',
            'priority': '1',
            'company_id': record.company_id.id,
        })
Run Code Online (Sandbox Code Playgroud)

这是一个按钮,应该stock.picking从我的模型中创建一个新的。

我已经尝试过,picking_type_id.id但它似乎不起作用,在标准插件中的每个示例上,你只是看到picking_type_id,我的模型中也没有任何定义,但我虽然我可以传递一种可用的类型,它是outgoing(我需要的)。

现在,它向我抛出了这个:

Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a …
Run Code Online (Sandbox Code Playgroud)

python python-2.7 odoo odoo-8

1
推荐指数
1
解决办法
649
查看次数