跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. 关于7.0中把原料的库存核算设为“实时(自动进行)后,原料内部调拨到生产库位投产都自动生产会计分录问题的解决

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

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
2 帖子 1 发布者 2.4k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • B 离线
    B 离线
    bluesthink
    写于 最后由 编辑
    #1

    经过分析跟踪原代码,发现问题出在做出入库条件判断的时候没有考虑判断生产库位,没有考虑虚拟库位的特殊性: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 条回复 最后回复
    0

    • 登录

    • 没有帐号? 注册

    • 登录或注册以进行搜索。
    • 第一个帖子
      最后一个帖子
    0
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组