mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add purchase_report
add 皮具doc
This commit is contained in:
7
app_purchase_report/__init__.py
Normal file
7
app_purchase_report/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import controllers
|
||||||
|
from . import models
|
||||||
|
from . import report
|
||||||
|
from . import ir
|
||||||
|
from . import res
|
||||||
57
app_purchase_report/__manifest__.py
Normal file
57
app_purchase_report/__manifest__.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# -*- 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': "App Purchase Report Enhance. Add received, invoiced, date planned",
|
||||||
|
'version': '11.0.8.05',
|
||||||
|
'author': 'Sunpop.cn',
|
||||||
|
'category': 'Base',
|
||||||
|
'website': 'http://www.sunpop.cn',
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
'sequence': 2,
|
||||||
|
'summary': """
|
||||||
|
Odoo Purchase Report Enhance. Add received, invoiced, date planned
|
||||||
|
""",
|
||||||
|
'description': """
|
||||||
|
Purchase Report Enhance. Add received, invoiced, date planned.
|
||||||
|
采购报告增强。
|
||||||
|
""",
|
||||||
|
'price': 0.00,
|
||||||
|
'currency': 'EUR',
|
||||||
|
'depends': [],
|
||||||
|
'images': ['static/description/banner.png'],
|
||||||
|
'data': [
|
||||||
|
],
|
||||||
|
'demo': [
|
||||||
|
],
|
||||||
|
'test': [
|
||||||
|
],
|
||||||
|
'css': [
|
||||||
|
],
|
||||||
|
'qweb': [
|
||||||
|
],
|
||||||
|
'js': [
|
||||||
|
],
|
||||||
|
'images': [
|
||||||
|
],
|
||||||
|
'post_load': None,
|
||||||
|
'post_init_hook': None,
|
||||||
|
'installable': True,
|
||||||
|
'application': True,
|
||||||
|
'auto_install': False,
|
||||||
|
}
|
||||||
1
app_purchase_report/controllers/__init__.py
Normal file
1
app_purchase_report/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
16
app_purchase_report/i18n/zh_CN.po
Normal file
16
app_purchase_report/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_report/ir/__init__.py
Normal file
1
app_purchase_report/ir/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
1
app_purchase_report/models/__init__.py
Normal file
1
app_purchase_report/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
3
app_purchase_report/report/__init__.py
Normal file
3
app_purchase_report/report/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import purchase_report
|
||||||
97
app_purchase_report/report/purchase_report.py
Normal file
97
app_purchase_report/report/purchase_report.py
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Please note that these reports are not multi-currency !!!
|
||||||
|
#
|
||||||
|
|
||||||
|
from odoo import api, fields, models, tools
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseReport(models.Model):
|
||||||
|
_inherit = "purchase.report"
|
||||||
|
|
||||||
|
qty_received = fields.Float('Qty Received', readonly=True)
|
||||||
|
qty_invoiced = fields.Float('Qty Invoiced', readonly=True)
|
||||||
|
date_planned = fields.Datetime(string='Scheduled Date', readonly=True)
|
||||||
|
|
||||||
|
@api.model_cr
|
||||||
|
def init(self):
|
||||||
|
tools.drop_view_if_exists(self._cr, 'purchase_report')
|
||||||
|
self._cr.execute("""
|
||||||
|
create view purchase_report as (
|
||||||
|
WITH currency_rate as (%s)
|
||||||
|
select
|
||||||
|
min(l.id) as id,
|
||||||
|
s.date_order as date_order,
|
||||||
|
s.state,
|
||||||
|
s.date_approve,
|
||||||
|
l.date_planned,
|
||||||
|
s.dest_address_id,
|
||||||
|
spt.warehouse_id as picking_type_id,
|
||||||
|
s.partner_id as partner_id,
|
||||||
|
s.create_uid as user_id,
|
||||||
|
s.company_id as company_id,
|
||||||
|
s.fiscal_position_id as fiscal_position_id,
|
||||||
|
l.product_id,
|
||||||
|
p.product_tmpl_id,
|
||||||
|
t.categ_id as category_id,
|
||||||
|
s.currency_id,
|
||||||
|
t.uom_id as product_uom,
|
||||||
|
sum(l.product_qty/u.factor*u2.factor) as unit_quantity,
|
||||||
|
sum(l.qty_received / u.factor * u2.factor) as qty_received,
|
||||||
|
sum(l.qty_invoiced / u.factor * u2.factor) as qty_invoiced,
|
||||||
|
extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay,
|
||||||
|
extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
|
||||||
|
count(*) as nbr_lines,
|
||||||
|
sum(l.price_unit / COALESCE(cr.rate, 1.0) * l.product_qty)::decimal(16,2) as price_total,
|
||||||
|
avg(100.0 * (l.price_unit / COALESCE(cr.rate,1.0) * l.product_qty) / NULLIF(ip.value_float*l.product_qty/u.factor*u2.factor, 0.0))::decimal(16,2) as negociation,
|
||||||
|
sum(ip.value_float*l.product_qty/u.factor*u2.factor)::decimal(16,2) as price_standard,
|
||||||
|
(sum(l.product_qty * l.price_unit / COALESCE(cr.rate, 1.0))/NULLIF(sum(l.product_qty/u.factor*u2.factor),0.0))::decimal(16,2) as price_average,
|
||||||
|
partner.country_id as country_id,
|
||||||
|
partner.commercial_partner_id as commercial_partner_id,
|
||||||
|
analytic_account.id as account_analytic_id,
|
||||||
|
sum(p.weight * l.product_qty/u.factor*u2.factor) as weight,
|
||||||
|
sum(p.volume * l.product_qty/u.factor*u2.factor) as volume
|
||||||
|
from purchase_order_line l
|
||||||
|
join purchase_order s on (l.order_id=s.id)
|
||||||
|
join res_partner partner on s.partner_id = partner.id
|
||||||
|
left join product_product p on (l.product_id=p.id)
|
||||||
|
left join product_template t on (p.product_tmpl_id=t.id)
|
||||||
|
LEFT JOIN ir_property ip ON (ip.name='standard_price' AND ip.res_id=CONCAT('product.template,',t.id) AND ip.company_id=s.company_id)
|
||||||
|
left join product_uom u on (u.id=l.product_uom)
|
||||||
|
left join product_uom u2 on (u2.id=t.uom_id)
|
||||||
|
left join stock_picking_type spt on (spt.id=s.picking_type_id)
|
||||||
|
left join account_analytic_account analytic_account on (l.account_analytic_id = analytic_account.id)
|
||||||
|
left join currency_rate cr on (cr.currency_id = s.currency_id and
|
||||||
|
cr.company_id = s.company_id and
|
||||||
|
cr.date_start <= coalesce(s.date_order, now()) and
|
||||||
|
(cr.date_end is null or cr.date_end > coalesce(s.date_order, now())))
|
||||||
|
group by
|
||||||
|
s.company_id,
|
||||||
|
s.create_uid,
|
||||||
|
s.partner_id,
|
||||||
|
u.factor,
|
||||||
|
s.currency_id,
|
||||||
|
l.price_unit,
|
||||||
|
s.date_approve,
|
||||||
|
l.date_planned,
|
||||||
|
l.product_uom,
|
||||||
|
s.dest_address_id,
|
||||||
|
s.fiscal_position_id,
|
||||||
|
l.product_id,
|
||||||
|
p.product_tmpl_id,
|
||||||
|
t.categ_id,
|
||||||
|
s.date_order,
|
||||||
|
s.state,
|
||||||
|
spt.warehouse_id,
|
||||||
|
u.uom_type,
|
||||||
|
u.category_id,
|
||||||
|
t.uom_id,
|
||||||
|
u.id,
|
||||||
|
u2.factor,
|
||||||
|
partner.country_id,
|
||||||
|
partner.commercial_partner_id,
|
||||||
|
analytic_account.id
|
||||||
|
)
|
||||||
|
""" % self.env['res.currency']._select_companies_rates())
|
||||||
1
app_purchase_report/res/__init__.py
Normal file
1
app_purchase_report/res/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
BIN
app_purchase_report/static/description/banner.png
Normal file
BIN
app_purchase_report/static/description/banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
BIN
app_purchase_report/static/description/icon.png
Normal file
BIN
app_purchase_report/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
55
app_purchase_report/static/description/index.html
Normal file
55
app_purchase_report/static/description/index.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<section class="oe_container">
|
||||||
|
<div class="oe_row oe_spaced" style="max-width: 800px;">
|
||||||
|
<div class="oe_span12">
|
||||||
|
<h2 class="oe_slogan">App </h2>
|
||||||
|
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
||||||
|
<p>This moduld allows user to . </p>
|
||||||
|
<h1>More Powerful addons:
|
||||||
|
<a class="btn btn-primary mb16" href="http://www.odoo.com/apps/modules/browse?author=Sunpop.cn">Supop.cn Odoo Addons</a>
|
||||||
|
</h1>
|
||||||
|
<br>
|
||||||
|
<h3>Lastest update: v11.0.7.27, 2018-07-27</h3>
|
||||||
|
<ul>
|
||||||
|
<li>1. ...</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="oe_demo oe_screenshot mt32">
|
||||||
|
<img src="banner.png" 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