mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add purchase bug fix
This commit is contained in:
7
app_purchase_quantity_fix/__init__.py
Normal file
7
app_purchase_quantity_fix/__init__.py
Normal file
@@ -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
|
||||
71
app_purchase_quantity_fix/__openerp__.py
Normal file
71
app_purchase_quantity_fix/__openerp__.py
Normal file
@@ -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,
|
||||
}
|
||||
1
app_purchase_quantity_fix/controllers/__init__.py
Normal file
1
app_purchase_quantity_fix/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
27
app_purchase_quantity_fix/hooks.py
Normal file
27
app_purchase_quantity_fix/hooks.py
Normal file
@@ -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)
|
||||
16
app_purchase_quantity_fix/i18n/zh_CN.po
Normal file
16
app_purchase_quantity_fix/i18n/zh_CN.po
Normal file
@@ -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"
|
||||
1
app_purchase_quantity_fix/ir/__init__.py
Normal file
1
app_purchase_quantity_fix/ir/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
3
app_purchase_quantity_fix/models/__init__.py
Normal file
3
app_purchase_quantity_fix/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import purchase
|
||||
62
app_purchase_quantity_fix/models/purchase.py
Normal file
62
app_purchase_quantity_fix/models/purchase.py
Normal file
@@ -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
|
||||
2
app_purchase_quantity_fix/report/__init__.py
Normal file
2
app_purchase_quantity_fix/report/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
1
app_purchase_quantity_fix/res/__init__.py
Normal file
1
app_purchase_quantity_fix/res/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
BIN
app_purchase_quantity_fix/static/description/bug1.jpg
Normal file
BIN
app_purchase_quantity_fix/static/description/bug1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
BIN
app_purchase_quantity_fix/static/description/bug2.jpg
Normal file
BIN
app_purchase_quantity_fix/static/description/bug2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
app_purchase_quantity_fix/static/description/bug3.jpg
Normal file
BIN
app_purchase_quantity_fix/static/description/bug3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
BIN
app_purchase_quantity_fix/static/description/bug_purchase1.jpg
Normal file
BIN
app_purchase_quantity_fix/static/description/bug_purchase1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
BIN
app_purchase_quantity_fix/static/description/icon.png
Normal file
BIN
app_purchase_quantity_fix/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
73
app_purchase_quantity_fix/static/description/index.html
Normal file
73
app_purchase_quantity_fix/static/description/index.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced" style="max-width: 800px;">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">odoo 10 purchase quantity bug fix</h2>
|
||||
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
||||
<p>This moduld Fix the big purchase bug(only in odoo 10)
|
||||
<h3>Lastest update: v10.0.4.17, 2018-04-17</h3>
|
||||
<ul>
|
||||
<li>Create a PO with product</li>
|
||||
<li>Validate a picking</li>
|
||||
<li>Make a return picking.</li>
|
||||
<li>Valide this return.</li>
|
||||
<li>-> The quantity received is not update (except Master)</li>
|
||||
<li>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).
|
||||
</li>
|
||||
<li>Validate partialy this return-return</li>
|
||||
<li>-> The quantity received is not update</li>
|
||||
<li>-> The action to show pickings doesn’t show the return-return picking</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="bug1.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="bug2.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="bug3.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="bug1.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="oe_container oe_dark">
|
||||
<div class="oe_row oe_spaced text-center">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Technical Help & Support</h2>
|
||||
</div>
|
||||
<div class="col-md-12 pad0">
|
||||
<div class="oe_mt16">
|
||||
<p><h4>
|
||||
For any type of technical help & support requests, Feel free to contact us</h4></p>
|
||||
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
|
||||
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
|
||||
<p><h4>
|
||||
Via QQ: 300883</h4></p>
|
||||
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
|
||||
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||
<i class="fa fa-envelope"></i> 300883@qq.com</a>
|
||||
</div>
|
||||
<div class="oe_mt16">
|
||||
<p><h4>
|
||||
Visit our website for more support.</h4></p>
|
||||
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||
class="btn btn-warning btn-lg" rel="nofollow" href="http://www.sunpop.cn" target="_blank"><span
|
||||
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||
<i class="fa fa-web"></i>http://www.sunpop.cn</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user