Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

关于7.0中把原料的库存核算设为“实时(自动进行)后,原料内部调拨到生产库位投产都自动生产会计分录问题的解决



  • 经过分析跟踪原代码,发现问题出在做出入库条件判断的时候没有考虑判断生产库位,没有考虑虚拟库位的特殊性:openerp默认的虚拟库位对应Company_id是null值。生成会计分录的代码就不详细解释了,记得论坛以前有人解释过。

    原代码:addons/stock/stock.py

    2299        if move.product_id.valuation == 'real_time': # FIXME: product valuation should perhaps be a property?
    2300            if context is None:
    2301                context = {}
    2302            src_company_ctx = dict(context,force_company=move.location_id.company_id.id)
    2303            dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id)
    2304            account_moves = []
    2305            # Outgoing moves (or cross-company output part)
    2306            if move.location_id.company_id <br />2307                and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal'<br />2308                      or move.location_id.company_id != move.location_dest_id.company_id):
    2309                journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, src_company_ctx)
    2310                reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
    2311                #returning goods to supplier
    2312                if move.location_dest_id.usage == 'supplier':
    2313                    account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_valuation, acc_src, reference_amount, reference_currency_id, c    ontext))]
    2314                else:
    2315                    account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_valuation, acc_dest, reference_amount, reference_currency_id,      context))]
    2316
    2317            # Incoming moves (or cross-company input part)
    2318            if move.location_dest_id.company_id <br />2319                and (move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal'<br />2320                      or move.location_id.company_id != move.location_dest_id.company_id):
    2321                journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, dest_company_ctx)
    2322                reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
    2323                #goods return from customer
    2324                if move.location_id.usage == 'customer':
    2325                    account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_dest, acc_valuation, reference_amount, reference_currency_id,      context))]





    代码做如下修改:

    在2306行前面加入:
    company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id  #获得用户当前公司ID
    2306行改为:

    if move.location_id.company_id == company_id and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal' and move.location_dest_id.usage != 'production' or move.location_id.company_id != move.location_dest_id.company_id and move.location_dest_id.company_id):  #注意句中无换行符号

    2318行改为:
    if move.location_dest_id.company_id == company_id and (move.location_id.usage != 'internal' and move.location_id.usage != 'production' and move.location_dest_id.usage == 'internal' or move.location_id.company_id != move.location_dest_id.company_id and move.location_id.company_id):  #注意句中无换行符号








  • 经过分析跟踪原代码,发现问题出在做出入库条件判断的时候没有考虑判断生产库位,没有考虑虚拟库位的特殊性:openerp默认的虚拟库位对应Company_id是null值。生成会计分录的代码就不详细解释了,记得论坛以前有人解释过。

    原代码:addons/stock/stock.py

    2299        if move.product_id.valuation == 'real_time': # FIXME: product valuation should perhaps be a property?
    2300            if context is None:
    2301                context = {}
    2302            src_company_ctx = dict(context,force_company=move.location_id.company_id.id)
    2303            dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id)
    2304            account_moves = []
    2305            # Outgoing moves (or cross-company output part)
    2306            if move.location_id.company_id <br />2307                and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal'<br />2308                      or move.location_id.company_id != move.location_dest_id.company_id):
    2309                journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, src_company_ctx)
    2310                reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
    2311                #returning goods to supplier
    2312                if move.location_dest_id.usage == 'supplier':
    2313                    account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_valuation, acc_src, reference_amount, reference_currency_id, c    ontext))]
    2314                else:
    2315                    account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_valuation, acc_dest, reference_amount, reference_currency_id,      context))]
    2316
    2317            # Incoming moves (or cross-company input part)
    2318            if move.location_dest_id.company_id <br />2319                and (move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal'<br />2320                      or move.location_id.company_id != move.location_dest_id.company_id):
    2321                journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, dest_company_ctx)
    2322                reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx)
    2323                #goods return from customer
    2324                if move.location_id.usage == 'customer':
    2325                    account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_dest, acc_valuation, reference_amount, reference_currency_id,      context))]





    代码做如下修改:

    在2306行前面加入:
    company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id  #获得用户当前公司ID
    2306行改为:

    if move.location_id.company_id == company_id and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal' and move.location_dest_id.usage != 'production' or move.location_id.company_id != move.location_dest_id.company_id and move.location_dest_id.company_id):  #注意句中无换行符号

    2318行改为:
    if move.location_dest_id.company_id == company_id and (move.location_id.usage != 'internal' and move.location_id.usage != 'production' and move.location_dest_id.usage == 'internal' or move.location_id.company_id != move.location_dest_id.company_id and move.location_id.company_id):  #注意句中无换行符号







登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待