diff --git a/app_purchase_quantity_fix/__init__.py b/app_purchase_quantity_fix/__init__.py new file mode 100644 index 00000000..ceee2ce8 --- /dev/null +++ b/app_purchase_quantity_fix/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + +from hooks import pre_init_hook +from . import controllers +from . import models +from . import ir +from . import res \ No newline at end of file diff --git a/app_purchase_quantity_fix/__openerp__.py b/app_purchase_quantity_fix/__openerp__.py new file mode 100644 index 00000000..9b83f516 --- /dev/null +++ b/app_purchase_quantity_fix/__openerp__.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +# Created on 2017-11-05 +# author: 广州尚鹏,http://www.sunpop.cn +# email: 300883@qq.com +# resource of Sunpop +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +# Odoo在线中文用户手册(长期更新) +# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html + +# Odoo10离线中文用户手册下载 +# http://www.sunpop.cn/odoo10_user_manual_document_offline/ +# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备) +# http://www.sunpop.cn/odoo10_developer_document_offline/ +# description: + + +{ + 'name': "Purchase quantity fix if return(odoo 10 purchase order return bug fix)", + 'version': '10.0.3.24', + 'author': 'Sunpop.cn', + 'category': 'Base', + 'website': 'http://www.sunpop.cn', + 'license': 'LGPL-3', + 'sequence': 2, + 'summary': """ + odoo 10 purchase bug fix(return quantity error bug fix). + odoo 10 采购退货后货物收到数量不正确,本模式对此bug进行了修复。 + """, + 'description': """ + We fix this bug in odoo 10. + + Steps to reproduce: + Create a PO with product + Validate a picking + Say ‘oups is not the good PO :-(‘ + Make a return picking. + Valide this return. + -> The quantity received is not update (except Master) + Make a return of return (to return in initial situation). (better than to do a copy of original to keep the link with purchase and parent picking). + Validate partialy this return-return + -> The quantity received is not update + -> The action to show pickings doesn’t show the return-return picking + """, + 'price': 98.00, + 'currency': 'EUR', + 'depends': ['purchase'], + 'images': [], + 'data': [ + ], + 'demo': [ + ], + 'test': [ + ], + 'css': [ + ], + 'qweb': [ + ], + 'js': [ + ], + 'images': [ + ], + 'pre_init_hook': 'pre_init_hook', + 'post_load': None, + 'pre_init_hook': None, + 'post_init_hook': None, + 'installable': True, + 'application': True, + 'auto_install': False, +} diff --git a/app_purchase_quantity_fix/controllers/__init__.py b/app_purchase_quantity_fix/controllers/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_purchase_quantity_fix/controllers/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_purchase_quantity_fix/hooks.py b/app_purchase_quantity_fix/hooks.py new file mode 100644 index 00000000..2c44e8f0 --- /dev/null +++ b/app_purchase_quantity_fix/hooks.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# Created on 2017-11-22 +# author: 广州尚鹏,http://www.sunpop.cn +# email: 300883@qq.com +# resource of Sunpop +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +# Odoo在线中文用户手册(长期更新) +# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html + +# Odoo10离线中文用户手册下载 +# http://www.sunpop.cn/odoo10_user_manual_document_offline/ +# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备) +# http://www.sunpop.cn/odoo10_developer_document_offline/ +# description: + +def pre_init_hook(cr): + """ + 数据初始化,只在安装时执行,更新时不执行 + """ + try: + # --设置barcode,默认=物料编码 + pass + + except Exception, e: + raise Warning(e) diff --git a/app_purchase_quantity_fix/i18n/zh_CN.po b/app_purchase_quantity_fix/i18n/zh_CN.po new file mode 100644 index 00000000..f45db9f9 --- /dev/null +++ b/app_purchase_quantity_fix/i18n/zh_CN.po @@ -0,0 +1,16 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * felive_home +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-08 14:28+0000\n" +"PO-Revision-Date: 2018-01-08 14:28+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/app_purchase_quantity_fix/ir/__init__.py b/app_purchase_quantity_fix/ir/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_purchase_quantity_fix/ir/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_purchase_quantity_fix/models/__init__.py b/app_purchase_quantity_fix/models/__init__.py new file mode 100644 index 00000000..b46d7f44 --- /dev/null +++ b/app_purchase_quantity_fix/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import purchase diff --git a/app_purchase_quantity_fix/models/purchase.py b/app_purchase_quantity_fix/models/purchase.py new file mode 100644 index 00000000..39864525 --- /dev/null +++ b/app_purchase_quantity_fix/models/purchase.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from datetime import datetime +from dateutil.relativedelta import relativedelta + +from odoo import api, fields, models, SUPERUSER_ID, _ +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT +from odoo.tools.float_utils import float_is_zero, float_compare +from odoo.exceptions import UserError, AccessError +from odoo.tools.misc import formatLang +from odoo.addons.base.res.res_partner import WARNING_MESSAGE, WARNING_HELP +import odoo.addons.decimal_precision as dp + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + @api.depends('order_line.move_ids.state', + 'order_line.move_ids.picking_id', + 'order_line.move_ids.returned_move_ids', + 'order_line.move_ids.returned_move_ids.returned_move_ids') + def _compute_picking(self): + for order in self: + pickings = self.env['stock.picking'] + for line in order.order_line: + # We keep a limited scope on purpose. Ideally, we should also use move_orig_ids and + # do some recursive search, but that could be prohibitive if not done correctly. + return_moves = line.move_ids.mapped('returned_move_ids') + moves = line.move_ids | return_moves | return_moves.mapped('returned_move_ids') + moves = moves.filtered(lambda r: r.state != 'cancel') + pickings |= moves.mapped('picking_id') + order.picking_ids = pickings + order.picking_count = len(pickings) + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + @api.depends('order_id.state', + 'move_ids.state', + 'move_ids.returned_move_ids.state', + 'move_ids.returned_move_ids.returned_move_ids.state') + def _compute_qty_received(self): + for line in self: + if line.order_id.state not in ['purchase', 'done']: + line.qty_received = 0.0 + continue + if line.product_id.type not in ['consu', 'product']: + line.qty_received = line.product_qty + continue + total = 0.0 + return_moves = line.move_ids.mapped('returned_move_ids') + moves = line.move_ids | return_moves | return_moves.mapped('returned_move_ids') + for move in moves: + value = 0.0 + if move.state == 'done': + value = move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom) + if move.location_id.usage == 'supplier': + total += value + else: + total -= value + line.qty_received = total diff --git a/app_purchase_quantity_fix/report/__init__.py b/app_purchase_quantity_fix/report/__init__.py new file mode 100644 index 00000000..633f8661 --- /dev/null +++ b/app_purchase_quantity_fix/report/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- + diff --git a/app_purchase_quantity_fix/res/__init__.py b/app_purchase_quantity_fix/res/__init__.py new file mode 100644 index 00000000..40a96afc --- /dev/null +++ b/app_purchase_quantity_fix/res/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/app_purchase_quantity_fix/static/description/bug1.jpg b/app_purchase_quantity_fix/static/description/bug1.jpg new file mode 100644 index 00000000..7612f93f Binary files /dev/null and b/app_purchase_quantity_fix/static/description/bug1.jpg differ diff --git a/app_purchase_quantity_fix/static/description/bug2.jpg b/app_purchase_quantity_fix/static/description/bug2.jpg new file mode 100644 index 00000000..99913a3d Binary files /dev/null and b/app_purchase_quantity_fix/static/description/bug2.jpg differ diff --git a/app_purchase_quantity_fix/static/description/bug3.jpg b/app_purchase_quantity_fix/static/description/bug3.jpg new file mode 100644 index 00000000..080283fd Binary files /dev/null and b/app_purchase_quantity_fix/static/description/bug3.jpg differ diff --git a/app_purchase_quantity_fix/static/description/bug_purchase1.jpg b/app_purchase_quantity_fix/static/description/bug_purchase1.jpg new file mode 100644 index 00000000..1d72f7b4 Binary files /dev/null and b/app_purchase_quantity_fix/static/description/bug_purchase1.jpg differ diff --git a/app_purchase_quantity_fix/static/description/icon.png b/app_purchase_quantity_fix/static/description/icon.png new file mode 100644 index 00000000..2a04f219 Binary files /dev/null and b/app_purchase_quantity_fix/static/description/icon.png differ diff --git a/app_purchase_quantity_fix/static/description/index.html b/app_purchase_quantity_fix/static/description/index.html new file mode 100644 index 00000000..2f5a1a4f --- /dev/null +++ b/app_purchase_quantity_fix/static/description/index.html @@ -0,0 +1,73 @@ +
+
+
+

odoo 10 purchase quantity bug fix

+
+

This moduld Fix the big purchase bug(only in odoo 10) +

Lastest update: v10.0.4.17, 2018-04-17

+
    +
  • Create a PO with product
  • +
  • Validate a picking
  • +
  • Make a return picking.
  • +
  • Valide this return.
  • +
  • -> The quantity received is not update (except Master)
  • +
  • Make a return of return (to return in initial situation). (better than to do a copy of original to keep the link with purchase and + parent picking). +
  • +
  • Validate partialy this return-return
  • +
  • -> The quantity received is not update
  • +
  • -> The action to show pickings doesn’t show the return-return picking
  • +
+
+ +
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+

Technical Help & Support

+
+
+
+

+ For any type of technical help & support requests, Feel free to contact us

+ + guohuadeng@hotmail.com +

+ Via QQ: 300883

+ + 300883@qq.com +
+
+

+ Visit our website for more support.

+ + http://www.sunpop.cn +
+
+
+
+