Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

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

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

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

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

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

    Odoo 开发与实施交流
    1
    2
    2146
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bluesthink last edited by

      经过分析跟踪原代码,发现问题出在做出入库条件判断的时候没有考虑判断生产库位,没有考虑虚拟库位的特殊性: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):  #注意句中无换行符号






      1 Reply Last reply Reply Quote 0
      • First post
        Last post