Merge lp:~jean-lelievre/openobject-addons/elico-7.0_modules_updates into lp:~elico-corp/openobject-addons/elico-7.0

Proposed by Jean LELIEVRE ElicoCorp
Status: Merged
Merged at revision: 4
Proposed branch: lp:~jean-lelievre/openobject-addons/elico-7.0_modules_updates
Merge into: lp:~elico-corp/openobject-addons/elico-7.0
Diff against target: 22991 lines (+22203/-0)
125 files modified
account_prepayment/static/description/index.html (+16/-0)
delivery_plan/__init__.py (+27/-0)
delivery_plan/__openerp__.py (+58/-0)
delivery_plan/delivery_report.xml (+73/-0)
delivery_plan/i18n/zh_CN.po (+703/-0)
delivery_plan/partner.py (+33/-0)
delivery_plan/report/__init__.py (+32/-0)
delivery_plan/report/delivery_route_print.mako (+110/-0)
delivery_plan/report/delivery_route_print.mako.1 (+111/-0)
delivery_plan/report/delivery_route_print.py (+39/-0)
delivery_plan/report/delivery_route_print.py.bak (+53/-0)
delivery_plan/report/delivery_route_print.rml (+243/-0)
delivery_plan/report/delivery_route_print.rml.bk (+266/-0)
delivery_plan/sale.py (+1182/-0)
delivery_plan/security/ir.model.access.csv (+3/-0)
delivery_plan/sequence.xml (+18/-0)
delivery_plan/static/description/index.html (+40/-0)
delivery_plan/stock_view.xml (+694/-0)
delivery_plan/wizard/__init__.py (+25/-0)
delivery_plan/wizard/stock.py (+503/-0)
delivery_plan/wizard/stock_view.xml (+463/-0)
delivery_routes/__init__.py (+34/-0)
delivery_routes/__openerp__.py (+63/-0)
delivery_routes/delivery.py (+660/-0)
delivery_routes/delivery_sequence.xml (+21/-0)
delivery_routes/delivery_view.xml (+499/-0)
delivery_routes/i18n/delivery_routes.pot (+603/-0)
delivery_routes/i18n/es_PE.po (+603/-0)
delivery_routes/i18n/zh_CN.po (+873/-0)
delivery_routes/purchase.py (+33/-0)
delivery_routes/purchase_view.xml (+68/-0)
delivery_routes/report.xml (+240/-0)
delivery_routes/security/delivery_security.xml (+19/-0)
delivery_routes/security/ir.model.access.csv (+15/-0)
delivery_routes/static/description/index.html (+43/-0)
delivery_routes/stock.py (+352/-0)
delivery_routes/stock_view.xml (+203/-0)
delivery_routes/wizard/__init__.py (+34/-0)
delivery_routes/wizard/fill_picking.py (+125/-0)
delivery_routes/wizard/fill_picking.xml (+33/-0)
delivery_routes/wizard/select_range.py (+47/-0)
delivery_routes/wizard/select_range_view.xml (+32/-0)
delivery_routes/wizard/stock.py (+46/-0)
delivery_routes/wizard/stock_view.xml (+32/-0)
move_reports/__init__.py (+26/-0)
move_reports/__openerp__.py (+59/-0)
move_reports/security/ir.model.access.csv (+2/-0)
move_reports/static/description/index.html (+25/-0)
move_reports/stock_move_report/__init__.py (+22/-0)
move_reports/stock_move_report/stock_move_report.py (+482/-0)
move_reports/stock_move_report/stock_move_report_view.xml (+113/-0)
mrp_wave/__init__.py (+24/-0)
mrp_wave/__openerp__.py (+52/-0)
mrp_wave/static/description/index.html (+16/-0)
mrp_wave/wizard/__init__.py (+25/-0)
mrp_wave/wizard/scheduler.py (+1104/-0)
mrp_wave/wizard/scheduler.xml (+268/-0)
product_inventory_warning/__init__.py (+27/-0)
product_inventory_warning/__openerp__.py (+53/-0)
product_inventory_warning/i18n/zh_CN.po (+315/-0)
product_inventory_warning/product.py (+613/-0)
product_inventory_warning/product_view.xml (+137/-0)
product_inventory_warning/security/ir.model.access.csv (+3/-0)
product_inventory_warning/static/description/index.html (+23/-0)
product_inventory_warning/wizard/__init__.py (+26/-0)
product_inventory_warning/wizard/product_qty.py (+69/-0)
product_inventory_warning/wizard/product_qty_view.xml (+32/-0)
product_inventory_warning/wizard/product_sfc.py (+80/-0)
product_inventory_warning/wizard/product_sfc_view.xml (+62/-0)
product_separate_cost/__init__.py (+25/-0)
product_separate_cost/__openerp__.py (+47/-0)
product_separate_cost/product.py (+108/-0)
product_separate_cost/static/description/index.html (+12/-0)
product_stock_type/__init__.py (+26/-0)
product_stock_type/__openerp__.py (+52/-0)
product_stock_type/i18n/zh_CN.po (+93/-0)
product_stock_type/product.py (+198/-0)
product_stock_type/product_view.xml (+76/-0)
product_stock_type/static/description/index.html (+22/-0)
quality_control_elico/__init__.py (+25/-0)
quality_control_elico/__openerp__.py (+56/-0)
quality_control_elico/i18n/zh_CN.po (+214/-0)
quality_control_elico/security/ir.model.access.csv (+18/-0)
quality_control_elico/security/qc_security.xml (+15/-0)
quality_control_elico/static/description/index.html (+20/-0)
quality_control_elico/stock.py (+113/-0)
quality_control_elico/stock_view.xml (+80/-0)
stock_batch_move/__init__.py (+25/-0)
stock_batch_move/__openerp__.py (+51/-0)
stock_batch_move/i18n/zh_CN.po (+956/-0)
stock_batch_move/i18n/zh_CN.po.old (+677/-0)
stock_batch_move/static/description/index.html (+17/-0)
stock_batch_move/wizard/__init__.py (+25/-0)
stock_batch_move/wizard/stock_batch_move.py (+139/-0)
stock_batch_move/wizard/stock_batch_move_view.xml (+35/-0)
stock_extra/__init__.py (+25/-0)
stock_extra/__openerp__.py (+53/-0)
stock_extra/i18n/zh_CN.po (+956/-0)
stock_extra/i18n/zh_CN.po.old (+677/-0)
stock_extra/security/ir.model.access.csv (+2/-0)
stock_extra/static/description/index.html (+23/-0)
stock_extra/stock.py (+795/-0)
stock_extra/stock_view.xml (+965/-0)
stock_fillin_inventory_with_steps/__init__.py (+25/-0)
stock_fillin_inventory_with_steps/__openerp__.py (+46/-0)
stock_fillin_inventory_with_steps/static/description/index.html (+12/-0)
stock_fillin_inventory_with_steps/wizard/__init__.py (+25/-0)
stock_fillin_inventory_with_steps/wizard/stock_fill_inventory.py (+137/-0)
stock_location_reports/__init__.py (+25/-0)
stock_location_reports/__openerp__.py (+49/-0)
stock_location_reports/report/__init__.py (+27/-0)
stock_location_reports/report/lot_overview.py (+56/-0)
stock_location_reports/report/lot_overview.rml (+212/-0)
stock_location_reports/report/lot_overview_all.py (+55/-0)
stock_location_reports/report/lot_overview_all.rml (+212/-0)
stock_location_reports/report/stock_inventory_move.rml (+218/-0)
stock_location_reports/report/stock_inventory_move_report.py (+47/-0)
stock_location_reports/reports.xml (+11/-0)
stock_location_reports/static/description/index.html (+21/-0)
stock_with_cost/__init__.py (+25/-0)
stock_with_cost/__openerp__.py (+48/-0)
stock_with_cost/i18n/zh_CN.po (+956/-0)
stock_with_cost/static/description/index.html (+20/-0)
stock_with_cost/stock.py (+197/-0)
stock_with_cost/stock_view.xml (+130/-0)
To merge this branch: bzr merge lp:~jean-lelievre/openobject-addons/elico-7.0_modules_updates
Reviewer Review Type Date Requested Status
Elico Corp (www.elico-corp.com) Pending
Review via email: mp+184516@code.launchpad.net

Description of the change

Add the "static" folder in each required modules.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'account_prepayment/static'
=== added directory 'account_prepayment/static/description'
=== added file 'account_prepayment/static/description/account_invoice_line1.png'
0Binary files account_prepayment/static/description/account_invoice_line1.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/description/account_invoice_line1.png 2013-09-09 08:37:27 +0000 differ0Binary files account_prepayment/static/description/account_invoice_line1.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/description/account_invoice_line1.png 2013-09-09 08:37:27 +0000 differ
=== added file 'account_prepayment/static/description/account_invoice_line2.png'
1Binary files account_prepayment/static/description/account_invoice_line2.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/description/account_invoice_line2.png 2013-09-09 08:37:27 +0000 differ1Binary files account_prepayment/static/description/account_invoice_line2.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/description/account_invoice_line2.png 2013-09-09 08:37:27 +0000 differ
=== added file 'account_prepayment/static/description/index.html'
--- account_prepayment/static/description/index.html 1970-01-01 00:00:00 +0000
+++ account_prepayment/static/description/index.html 2013-09-09 08:37:27 +0000
@@ -0,0 +1,16 @@
1<section class="oe_container">
2 <div class="oe_row">
3 <h2 class="oe_slogan">account_prepayment Module</h2>
4 <h3 class="oe_slogan">Prepayment Account for Customers and <br>Usage of Prepayment Account for Payments in Purchase Order</h3>
5 <h4 class="oe_slogan"><a href="http://www.openerp.com.cn">By Elico Corp</a></h4>
6 <p>This module allows for creation of prepayment accounts for Customers. This module also allows for payment to Suppliers in Purchase Orders to be deducted from the Prepayment Accounts instead of just other normal payment accounts. </p>
7 <div class="oe_row_img oe_centered oe_mt32">
8 <img class="oe_picture oe_screenshot" src="account_invoice_line1.png">
9 <img class="oe_picture oe_screenshot" src="account_invoice_line2.png">
10 </div>
11 </div>
12 <div class="oe_row oe_centeralign oe_more_space">
13 <a href="http://www.elico-corp.com" class="oe_button oe_big">Start your <span class="oe_emph">free</span> trial</a>
14 </div>
15 <h4 class="oe_slogan">or</h4>
16</section>
0\ No newline at end of file17\ No newline at end of file
118
=== added directory 'delivery_plan'
=== added file 'delivery_plan/__init__.py'
--- delivery_plan/__init__.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/__init__.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,27 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import sale
24import wizard
25import partner
26
27# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
028
=== added file 'delivery_plan/__openerp__.py'
--- delivery_plan/__openerp__.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/__openerp__.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,58 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Delivery Time Plan',
25 'version': '1',
26 'category': 'Delivery',
27 'sequence': 19,
28 'summary': 'Plan delivery time for sale order',
29 'description': """
30Delivery Time Plan
31=================================
32* Plan delivery time for sale order
33* Add delivery return reason,
34* Calculate sale order dts, pts based on order start_date, enddate,
35* Compute dts,pts of delivery order based on start_date and end date of sale order, delivery zone of partner.
36 """,
37 'author': 'Elico Corp',
38 'website': 'http://www.elico-corp.com',
39 'images' : [],
40 'depends': ['sale_stock', 'delivery_routes',
41 'mrp',
42 "report_webkit", 'stock_extra'],
43 'data': [
44 #'security/security.xml',
45 'security/ir.model.access.csv',
46 'stock_view.xml',
47 "delivery_report.xml",
48 'wizard/stock_view.xml',
49 'sequence.xml',
50 ],
51 'test': [],
52 'demo': [],
53 'installable': True,
54 'auto_install': False,
55 'application': False,
56}
57
58# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
059
=== added file 'delivery_plan/delivery_report.xml'
--- delivery_plan/delivery_report.xml 1970-01-01 00:00:00 +0000
+++ delivery_plan/delivery_report.xml 2013-09-09 08:37:27 +0000
@@ -0,0 +1,73 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="ir_header_webkit_delivery_routes" model="ir.header_webkit">
5 <field eval="&quot;&quot;&quot;Portrait&quot;&quot;&quot;" name="orientation"/>
6 <field eval="&quot;&quot;&quot;A4&quot;&quot;&quot;" name="format"/>
7 <field eval="&quot;&quot;&quot;DeliveryRoutes&quot;&quot;&quot;" name="name"/>
8 <field eval="15.0" name="margin_top"/>
9 <field name="footer_html"><![CDATA[<html>
10 <head>
11 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
12 <script>
13 function subst() {
14 var vars={};
15 var x=document.location.search.substring(1).split('&');
16 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
17 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
18 for(var i in x) {
19 var y = document.getElementsByClassName(x[i]);
20 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
21 }
22 }
23 </script>
24 </head>
25 <body style="border:0; margin: 0;" onload="subst()">
26 <table style="border-top: 1px solid black; font-size:8px; width: 100%; position:absolute;">
27 <tr>
28 <td width="10%"><b>备注</b></td><td width="80%">1.拿货前请先确认是否有以下货物并勾选(干货蔬果,冰冻货物,熟食,饼房). 2.支付方式简写 现金 C,刷卡 P,不收钱 NC,券 Q(配送结束时填写)</td>
29 </tr>
30 <tr>
31 <td width="10%"></td><td width="80%">3.配送结果有以下几种:1:配送成功。2:没有收钱。3:部分退货.4:改时间送。(配送结束时填写)</td>
32 </tr>
33 </table>
34 </body>
35</html>]]></field>
36 <field name="html"><![CDATA[<html>
37 <head>
38 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
39 <script>
40 function subst() {
41 var vars={};
42 var x=document.location.search.substring(1).split('&');
43 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
44 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
45 for(var i in x) {
46 var y = document.getElementsByClassName(x[i]);
47 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
48 }
49 }
50 </script>
51 <style type="text/css">
52 ${css}
53 </style>
54 </head>
55 <body style="border:0; margin: 0;" onload="subst()">
56 ${_debug or ''|n} </body>
57</html>]]>
58</field>
59
60 <field name="css" ><![CDATA[
61body { font-family:Helvetica; font-size:12px; }
62.title { font-size:16px; font-weight: bold; text-align: center; }
63.basic_table{ text-align:center; border-collapse: collapse; }
64.basic_table td { border:1px solid lightGrey; font-size:12px; }
65td { padding: 0 3px; text-align:left; font-size: 12px; }
66table.noborder, table.noborder tr, table.noborder tr td, tr.noborder, tr.noborder td, td.noborder { border: none; }
67.dontcutme { page-break-inside: avoid; }]]> </field>
68 </record>
69
70 <report id="report_delivery_route_print" name="delivery.route.print" string="Delivery Route" model="delivery.route"
71 file="fc_delivery_plan/report/delivery_route_print.mako" report_type="webkit" auto="False" header = "True" menu="True" webkit_header="ir_header_webkit_delivery_routes"/>
72 </data>
73</openerp>
0\ No newline at end of file74\ No newline at end of file
175
=== added directory 'delivery_plan/i18n'
=== added file 'delivery_plan/i18n/zh_CN.po'
--- delivery_plan/i18n/zh_CN.po 1970-01-01 00:00:00 +0000
+++ delivery_plan/i18n/zh_CN.po 2013-09-09 08:37:27 +0000
@@ -0,0 +1,703 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * fc_delivery_plan
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-03-11 10:05+0000\n"
10"PO-Revision-Date: 2013-03-11 10:05+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: fc_delivery_plan
19#: field:delivery.route.line,to_be_received:0
20msgid "To be Received"
21msgstr "待收"
22
23#. module: fc_delivery_plan
24#: field:delivery.route.line,account_checked:0
25msgid "Checked"
26msgstr "已检查"
27
28#. module: fc_delivery_plan
29#: code:addons/fc_delivery_plan/sale.py:648
30#: code:addons/fc_delivery_plan/sale.py:657
31#, python-format
32msgid "Error"
33msgstr "错误"
34
35#. module: fc_delivery_plan
36#: view:stock.picking:0
37msgid "Orders planned for the Past"
38msgstr "已安排订单"
39
40#. module: fc_delivery_plan
41#: view:delivery.route:0
42#: view:delivery.route.line:0
43#: view:stock.picking:0
44msgid "Group By..."
45msgstr "分组..."
46
47#. module: fc_delivery_plan
48#: view:delivery.route:0
49#: view:delivery.route.line:0
50#: view:stock.picking:0
51msgid "Today"
52msgstr "今天"
53
54#. module: fc_delivery_plan
55#: code:addons/fc_delivery_plan/sale.py:799
56#: field:delivery.route.line,customer_date:0
57#, python-format
58msgid "Customer Delivery Time"
59msgstr "客户发货时间"
60
61#. module: fc_delivery_plan
62#: view:delivery.route.line:0
63msgid "Delivery for Today"
64msgstr "今日配送"
65
66#. module: fc_delivery_plan
67#: view:delivery.change.dts:0
68msgid "Update"
69msgstr "更新"
70
71#. module: fc_delivery_plan
72#: field:delivery.route.line,cs_remark:0
73msgid "CS Remark"
74msgstr "CS备注"
75
76#. module: fc_delivery_plan
77#: view:stock.picking:0
78msgid "Picking without batch"
79msgstr "未设分拣批次"
80
81#. module: fc_delivery_plan
82#: view:stock.picking:0
83msgid "Picking list"
84msgstr "发货单"
85
86#. module: fc_delivery_plan
87#: code:addons/fc_delivery_plan/sale.py:546
88#, python-format
89msgid "Latest error"
90msgstr "上次错误"
91
92#. module: fc_delivery_plan
93#: field:delivery.route.line,picking_note:0
94msgid "DO Notes"
95msgstr "发货单备注"
96
97#. module: fc_delivery_plan
98#: field:delivery.route.line,delivered_cpt:0
99msgid "Delivered x times"
100msgstr "已发货 x 次"
101
102#. module: fc_delivery_plan
103#: selection:delivery.change.dts,action:0
104msgid "Blank DTS/PTS"
105msgstr "未设DTS/PTS"
106
107#. module: fc_delivery_plan
108#: view:stock.picking:0
109msgid "Batch"
110msgstr "批次"
111
112#. module: fc_delivery_plan
113#: code:addons/fc_delivery_plan/sale.py:657
114#, python-format
115msgid "The Route Line %s (origin: %s) is confirmed. You can not change it."
116msgstr "路线 %s (来源: %s) 已经确认. 不可修改."
117
118#. module: fc_delivery_plan
119#: field:stock.tracking,ul_id:0
120msgid "Picking Box"
121msgstr "移库单Box"
122
123#. module: fc_delivery_plan
124#: field:delivery.route.line,origin:0
125#: view:stock.picking:0
126msgid "Origin"
127msgstr "来源"
128
129#. module: fc_delivery_plan
130#: help:stock.picking.in,dts_id:0
131msgid "Delivery time or turn to receive"
132msgstr "配送时间(收货)"
133
134#. module: fc_delivery_plan
135#: field:delivery.route.line,exceptions:0
136msgid "Received with exceptions"
137msgstr "收货例外"
138
139#. module: fc_delivery_plan
140#: model:ir.model,name:fc_delivery_plan.model_stock_move
141msgid "Stock Move"
142msgstr "库存调拨"
143
144#. module: fc_delivery_plan
145#: model:ir.model,name:fc_delivery_plan.model_delivery_dts_to_vans
146msgid "delivery.dts_to_vans"
147msgstr "delivery.dts_to_vans"
148
149#. module: fc_delivery_plan
150#: field:delivery.change.dts,dts_id:0
151#: field:delivery.driver_for_routes,dts_id:0
152#: field:delivery.dts_to_routes,dts_id:0
153#: field:delivery.dts_to_vans,dts_id:0
154#: view:delivery.route:0
155#: view:delivery.route.line:0
156#: field:delivery.route.line,dts_id:0
157#: view:sale.order:0
158#: field:sale.order,dts_id:0
159#: field:stock.move,dts_id:0
160#: view:stock.picking:0
161#: field:stock.picking.in,dts_id:0
162#: field:stock.picking.in,route_line_id:0
163#: field:stock.picking.out,route_line_id:0
164msgid "Delivery Time"
165msgstr "发货时间"
166
167#. module: fc_delivery_plan
168#: view:stock.picking:0
169msgid "Ready"
170msgstr "就绪"
171
172#. module: fc_delivery_plan
173#: view:delivery.driver:0
174#: view:delivery.route:0
175#: view:delivery.route.line:0
176msgid "Edit..."
177msgstr "编辑..."
178
179#. module: fc_delivery_plan
180#: field:delivery.route.line,adjustment:0
181msgid "Adjustment"
182msgstr "调整"
183
184#. module: fc_delivery_plan
185#: model:ir.model,name:fc_delivery_plan.model_stock_picking_out
186msgid "Delivery Orders"
187msgstr "送货单"
188
189#. module: fc_delivery_plan
190#: field:delivery.change.dts,pts_id:0
191#: field:mrp.production,pts_id:0
192#: field:procurement.order,pts_id:0
193#: view:sale.order:0
194#: view:stock.picking:0
195#: field:stock.picking.in,pts_id:0
196msgid "Preparation Time"
197msgstr "拣货时间"
198
199#. module: fc_delivery_plan
200#: model:ir.ui.menu,name:fc_delivery_plan.menu_delivery_delivery_payment
201msgid "Delivery Payments"
202msgstr "发货支付"
203
204#. module: fc_delivery_plan
205#: field:delivery.route.line,vip:0
206msgid "is VIP ?"
207msgstr "是否 VIP ?"
208
209#. module: fc_delivery_plan
210#: view:delivery.driver_for_routes:0
211#: view:delivery.dts_to_routes:0
212#: view:delivery.dts_to_vans:0
213msgid "Confirm"
214msgstr "确认"
215
216#. module: fc_delivery_plan
217#: view:stock.picking:0
218msgid "Internal Picking List"
219msgstr "内部分拣单"
220
221#. module: fc_delivery_plan
222#: view:delivery.route.line:0
223msgid "State"
224msgstr "状态"
225
226#. module: fc_delivery_plan
227#: model:ir.model,name:fc_delivery_plan.model_stock_picking
228msgid "Picking List"
229msgstr "发货单"
230
231#. module: fc_delivery_plan
232#: model:ir.model,name:fc_delivery_plan.model_delivery_dts_to_routes
233msgid "delivery.dts_to_routes"
234msgstr "delivery.dts_to_routes"
235
236#. module: fc_delivery_plan
237#: field:delivery.return.reason,type:0
238#: field:delivery.time,type:0
239msgid "Type"
240msgstr "类型"
241
242#. module: fc_delivery_plan
243#: view:stock.picking:0
244msgid "Expected Date"
245msgstr "预计日期"
246
247#. module: fc_delivery_plan
248#: selection:stock.picking.in,delivery_state:0
249msgid "Delivered with exception"
250msgstr "发货例外"
251
252#. module: fc_delivery_plan
253#: model:ir.model,name:fc_delivery_plan.model_delivery_route_line
254msgid "delivery.route.line"
255msgstr "delivery.route.line"
256
257#. module: fc_delivery_plan
258#: selection:delivery.route.line,complete_state:0
259msgid "Not planned"
260msgstr "未计划"
261
262#. module: fc_delivery_plan
263#: field:delivery.route.line,partner_phone:0
264msgid "Partner Phone"
265msgstr "客户电话"
266
267#. module: fc_delivery_plan
268#: view:stock.picking:0
269msgid "Related Order"
270msgstr "相关单据"
271
272#. module: fc_delivery_plan
273#: view:stock.picking:0
274msgid "Confirmed Internal Moves"
275msgstr "确认内部调拨"
276
277#. module: fc_delivery_plan
278#: selection:delivery.route.line,complete_state:0
279msgid "No redelivery"
280msgstr "未重新发货"
281
282#. module: fc_delivery_plan
283#: view:stock.picking:0
284msgid "Order Date"
285msgstr "订单日期"
286
287#. module: fc_delivery_plan
288#: model:ir.model,name:fc_delivery_plan.model_procurement_order
289msgid "Procurement"
290msgstr "需求单"
291
292#. module: fc_delivery_plan
293#: view:stock.picking:0
294msgid "Orders planned for the Future"
295msgstr "已计划订单"
296
297#. module: fc_delivery_plan
298#: selection:delivery.route.line,complete_state:0
299msgid "Planned"
300msgstr "已计划"
301
302#. module: fc_delivery_plan
303#: view:delivery.route:0
304msgid "Delivery Routes"
305msgstr "配送车次"
306
307#. module: fc_delivery_plan
308#: view:delivery.driver:0
309#: view:delivery.route:0
310#: view:delivery.route.line:0
311msgid "Delete"
312msgstr "删除"
313
314#. module: fc_delivery_plan
315#: field:delivery.route.line,return_reasons:0
316msgid "Return Reasons"
317msgstr "退货原因"
318
319#. module: fc_delivery_plan
320#: code:addons/fc_delivery_plan/sale.py:800
321#: field:delivery.route.line,neighborhood:0
322#, python-format
323msgid "Neighborhood"
324msgstr "邻居"
325
326#. module: fc_delivery_plan
327#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_route_form_cs
328#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_route_form_cs
329msgid "Delivery Route CS"
330msgstr "发送路线 CS"
331
332#. module: fc_delivery_plan
333#: model:ir.model,name:fc_delivery_plan.model_delivery_time
334msgid "delivery.time"
335msgstr "delivery.time"
336
337#. module: fc_delivery_plan
338#: view:stock.picking:0
339msgid "Past"
340msgstr "过去"
341
342#. module: fc_delivery_plan
343#: view:stock.picking:0
344msgid "Future"
345msgstr "未来"
346
347#. module: fc_delivery_plan
348#: selection:stock.picking.in,delivery_state:0
349msgid "Returned, no delivery"
350msgstr "退回, 未发货"
351
352#. module: fc_delivery_plan
353#: field:delivery.route.line,amount_received:0
354msgid "Received"
355msgstr "已收"
356
357#. module: fc_delivery_plan
358#: view:delivery.route:0
359#: view:delivery.route.line:0
360#: model:ir.actions.report.xml,name:fc_delivery_plan.report_delivery_route_print
361msgid "Delivery Route"
362msgstr "配送车次"
363
364#. module: fc_delivery_plan
365#: view:delivery.change.dts:0
366#: view:delivery.driver_for_routes:0
367#: view:delivery.dts_to_routes:0
368#: view:delivery.dts_to_vans:0
369msgid "or"
370msgstr "或者"
371
372#. module: fc_delivery_plan
373#: view:stock.picking:0
374msgid "Picking already processed"
375msgstr "分拣已处理"
376
377#. module: fc_delivery_plan
378#: field:res.users,dts_id:0
379msgid "Last Used Delivery Time"
380msgstr "上次配送时间"
381
382#. module: fc_delivery_plan
383#: code:addons/fc_delivery_plan/sale.py:648
384#, python-format
385msgid "The Route %s is confirmed, you can not add lines to it."
386msgstr "路线 %s 已经确认, 不可增加新的明细."
387
388#. module: fc_delivery_plan
389#: model:ir.model,name:fc_delivery_plan.model_mrp_production
390msgid "Manufacturing Order"
391msgstr "生产订单"
392
393#. module: fc_delivery_plan
394#: model:ir.ui.menu,name:fc_delivery_plan.menu_delivery_wizard
395msgid "Prepare Delivery Routes"
396msgstr "准备配送路线"
397
398#. module: fc_delivery_plan
399#: view:stock.picking:0
400msgid "Status"
401msgstr "状态"
402
403#. module: fc_delivery_plan
404#: model:ir.model,name:fc_delivery_plan.model_sale_order
405msgid "Sales Order"
406msgstr "销售订单"
407
408#. module: fc_delivery_plan
409#: view:delivery.driver:0
410#: view:delivery.route:0
411#: view:delivery.route.line:0
412msgid "í"
413msgstr "í"
414
415#. module: fc_delivery_plan
416#: model:ir.model,name:fc_delivery_plan.model_stock_tracking
417msgid "Packs"
418msgstr "包装"
419
420#. module: fc_delivery_plan
421#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_line_form_cs
422#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_line_form_cs
423msgid "Delivery Route Line CS"
424msgstr "路线明细 CS"
425
426#. module: fc_delivery_plan
427#: code:addons/fc_delivery_plan/sale.py:824
428#: view:delivery.dts_to_vans:0
429#: model:ir.actions.act_window,name:fc_delivery_plan.action_dts_to_vans
430#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_dts_to_vans
431#, python-format
432msgid "Prepare Vans for DTS"
433msgstr "根据配送时间 Vans拣货"
434
435#. module: fc_delivery_plan
436#: selection:delivery.route.line,complete_state:0
437#: view:stock.picking:0
438#: selection:stock.picking.in,delivery_state:0
439msgid "In delivery"
440msgstr "配送中"
441
442#. module: fc_delivery_plan
443#: field:picking.batch,active:0
444msgid "Active"
445msgstr "可用"
446
447#. module: fc_delivery_plan
448#: model:ir.actions.act_window,name:fc_delivery_plan.action_picking_batch
449#: view:picking.batch:0
450#: field:stock.picking,batch_id:0
451#: field:stock.picking.in,batch_id:0
452#: field:stock.picking.out,batch_id:0
453msgid "Picking Batch"
454msgstr "拣货批次"
455
456#. module: fc_delivery_plan
457#: selection:stock.picking.in,delivery_state:0
458msgid "Not yet planned for delivery"
459msgstr "还未计划配送"
460
461#. module: fc_delivery_plan
462#: selection:delivery.route.line,complete_state:0
463msgid "Exception"
464msgstr "例外"
465
466#. module: fc_delivery_plan
467#: view:delivery.route.line:0
468msgid "Delivery Route Lines"
469msgstr "配送车次清单"
470
471#. module: fc_delivery_plan
472#: selection:delivery.time,type:0
473msgid "Preparation"
474msgstr "拣货"
475
476#. module: fc_delivery_plan
477#: field:delivery.route.line,amount_unpaid:0
478msgid "Unpaid"
479msgstr "未付"
480
481#. module: fc_delivery_plan
482#: field:stock.tracking,picking_id:0
483msgid "Picking Related"
484msgstr "相关分拣"
485
486#. module: fc_delivery_plan
487#: field:delivery.change.dts,action:0
488msgid "Action"
489msgstr "动作"
490
491#. module: fc_delivery_plan
492#: field:delivery.route.line,box_type:0
493msgid "Box Type"
494msgstr "Box 类型"
495
496#. module: fc_delivery_plan
497#: view:delivery.route:0
498#: view:delivery.route.line:0
499msgid "Delivery Route for Today"
500msgstr "今日配送路线"
501
502#. module: fc_delivery_plan
503#: code:addons/fc_delivery_plan/sale.py:840
504#: view:delivery.dts_to_routes:0
505#: model:ir.actions.act_window,name:fc_delivery_plan.action_dts_to_routes
506#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_dts_to_routes
507#, python-format
508msgid "Prepare Routes for DTS"
509msgstr "根据配送时间 预备路线"
510
511#. module: fc_delivery_plan
512#: field:delivery.route.line,driver_phone:0
513msgid "Driver Phone"
514msgstr "司机电话"
515
516#. module: fc_delivery_plan
517#: view:stock.picking:0
518msgid "Orders planned for Today"
519msgstr "今日安排订单"
520
521#. module: fc_delivery_plan
522#: view:delivery.route:0
523#: view:stock.picking:0
524msgid "Done"
525msgstr "完成"
526
527#. module: fc_delivery_plan
528#: view:delivery.change.dts:0
529#: view:delivery.driver_for_routes:0
530#: view:delivery.dts_to_routes:0
531#: view:delivery.dts_to_vans:0
532#: selection:delivery.route.line,complete_state:0
533msgid "Cancel"
534msgstr "取消"
535
536#. module: fc_delivery_plan
537#: selection:stock.picking.in,delivery_state:0
538msgid "Planned for delivery"
539msgstr "配送计划"
540
541#. module: fc_delivery_plan
542#: selection:delivery.route.line,complete_state:0
543#: view:stock.picking:0
544#: selection:stock.picking.in,delivery_state:0
545msgid "Delivered"
546msgstr "已配送"
547
548#. module: fc_delivery_plan
549#: code:addons/fc_delivery_plan/sale.py:856
550#: view:delivery.driver_for_routes:0
551#: model:ir.actions.act_window,name:fc_delivery_plan.action_driver_for_routes
552#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_driver_for_routes
553#, python-format
554msgid "Choose Driver / Deliver for DTS"
555msgstr "根据配送时间 选择司机 / 送货"
556
557#. module: fc_delivery_plan
558#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_return_type
559#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_return_type
560msgid "Return Reason Type"
561msgstr "退货原因类型"
562
563#. module: fc_delivery_plan
564#: model:ir.model,name:fc_delivery_plan.model_stock_picking_in
565msgid "Incoming Shipments"
566msgstr "入库"
567
568#. module: fc_delivery_plan
569#: field:picking.batch,picking_ids:0
570msgid "Contains"
571msgstr "包含"
572
573#. module: fc_delivery_plan
574#: field:delivery.route.line,complete_state:0
575#: view:stock.picking:0
576#: field:stock.picking.in,delivery_state:0
577msgid "Delivery State"
578msgstr "配送状态"
579
580#. module: fc_delivery_plan
581#: model:ir.model,name:fc_delivery_plan.model_picking_batch
582msgid "picking.batch"
583msgstr "拣货批次"
584
585#. module: fc_delivery_plan
586#: field:delivery.route.line,so_payment_method:0
587msgid "Payment Method"
588msgstr "付款方式"
589
590#. module: fc_delivery_plan
591#: selection:delivery.route.line,complete_state:0
592msgid "Returned"
593msgstr "已退货"
594
595#. module: fc_delivery_plan
596#: view:stock.picking:0
597msgid "Assigned Internal Moves"
598msgstr "指定的内部调拨"
599
600#. module: fc_delivery_plan
601#: view:stock.picking:0
602msgid "Journal"
603msgstr "账簿"
604
605#. module: fc_delivery_plan
606#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_route_driver_kanban
607msgid "Delivery Route Driver Kanban"
608msgstr "配送路线司机看板"
609
610#. module: fc_delivery_plan
611#: selection:delivery.time,type:0
612msgid "Delivery"
613msgstr "配送"
614
615#. module: fc_delivery_plan
616#: model:ir.model,name:fc_delivery_plan.model_delivery_driver_for_routes
617msgid "delivery.driver_for_routes"
618msgstr "delivery.driver_for_routes"
619
620#. module: fc_delivery_plan
621#: view:stock.picking:0
622msgid "Waiting"
623msgstr "正在等待"
624
625#. module: fc_delivery_plan
626#: selection:delivery.change.dts,action:0
627msgid "Change DTS/PTS"
628msgstr "变更 DTS/PTS"
629
630#. module: fc_delivery_plan
631#: field:delivery.return.reason,reason:0
632#: field:delivery.return.type,name:0
633#: field:picking.batch,name:0
634msgid "Name"
635msgstr "名称"
636
637#. module: fc_delivery_plan
638#: view:stock.picking:0
639msgid "Not Planned"
640msgstr "未计划"
641
642#. module: fc_delivery_plan
643#: view:delivery.route.line:0
644msgid "Route"
645msgstr "路线"
646
647#. module: fc_delivery_plan
648#: selection:stock.picking.in,delivery_state:0
649msgid "Delivered and returned"
650msgstr "已配送和已退回"
651
652#. module: fc_delivery_plan
653#: field:stock.picking.in,carrier_id:0
654msgid "Carrier"
655msgstr "运输工具"
656
657#. module: fc_delivery_plan
658#: view:delivery.change.dts:0
659#: model:ir.actions.act_window,name:fc_delivery_plan.action_stock_change_dts_wizard
660#: model:ir.model,name:fc_delivery_plan.model_delivery_change_dts
661msgid "Change DTS / PTS"
662msgstr "变更 DTS / PTS"
663
664#. module: fc_delivery_plan
665#: field:delivery.return.reason,route_line_id:0
666msgid "Delivery Route Line"
667msgstr "配送路线明细"
668
669#. module: fc_delivery_plan
670#: model:ir.model,name:fc_delivery_plan.model_res_users
671msgid "Users"
672msgstr "用户"
673
674#. module: fc_delivery_plan
675#: model:ir.model,name:fc_delivery_plan.model_delivery_return_reason
676msgid "delivery.return.reason"
677msgstr "delivery.return.reason"
678
679#. module: fc_delivery_plan
680#: field:delivery.return.type,sequence:0
681msgid "Sequence"
682msgstr "序号"
683
684#. module: fc_delivery_plan
685#: model:ir.model,name:fc_delivery_plan.model_delivery_return_type
686msgid "delivery.return.type"
687msgstr "delivery.return.type"
688
689#. module: fc_delivery_plan
690#: view:stock.picking:0
691msgid "No batch"
692msgstr "未设批次"
693
694#. module: fc_delivery_plan
695#: field:delivery.route.line,amount_total:0
696msgid "Total"
697msgstr "合计"
698
699#. module: fc_delivery_plan
700#: field:delivery.route.line,account_remark:0
701msgid "Remark Accounting"
702msgstr "财务备注"
703
0704
=== added file 'delivery_plan/partner.py'
--- delivery_plan/partner.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/partner.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,33 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import osv, fields
24
25
26class res_partner(osv.osv):
27 _inherit = "res.partner"
28
29 _columns = {
30 'deliver_zone': fields.char('Delivery Zone', size= 64),
31 }
32
33res_partner()
0\ No newline at end of file34\ No newline at end of file
135
=== added directory 'delivery_plan/report'
=== added file 'delivery_plan/report/__init__.py'
--- delivery_plan/report/__init__.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/__init__.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,32 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
6#
7# WARNING: This program as such is intended to be used by professional
8# programmers who take the whole responsability of assessing all potential
9# consequences resulting from its eventual inadequacies and bugs
10# End users who are looking for a ready-to-use solution with commercial
11# garantees and support are strongly adviced to contract a Free Software
12# Service Company
13#
14# This program is Free Software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License
16# as published by the Free Software Foundation; either version 2
17# of the License, or (at your option) any later version.
18#
19# This program is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with this program; if not, write to the Free Software
26# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27#
28##############################################################################
29
30import delivery_route_print
31
32# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file33\ No newline at end of file
134
=== added file 'delivery_plan/report/delivery_route_print.mako'
--- delivery_plan/report/delivery_route_print.mako 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/delivery_route_print.mako 2013-09-09 08:37:27 +0000
@@ -0,0 +1,110 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3 <head>
4 <meta content="text/html; charset=UTF-8" http-equiv="content-type">
5 <style type="text/css">
6 ${css}
7 </style>
8 </head>
9 <body>
10 <% cpt = 0 %>
11 %for delivery_route in objects :
12%if cpt > 0:
13<div style="page-break-after: always;"><span style="display: none;"> </span></div>
14%endif
15 <div class="title">Delivery Distribution Control Sheet (配送交接控制表)</div>
16 <div style="font-size:12px;font-style:italic;text-align:center;">Ref / 编号 : ${delivery_route.name}</div>
17 <td><b></b></td><td></td>
18 <br />
19 <table class="basic_table" width="100%">
20 <tr>
21 <td width="17%"><b>Date<br />日期</b></td><td width="33%">${delivery_route.date}</td>
22 <td width="17%"><b>Time Slot<br />时间段</b></td><td>${delivery_route.dts_id.name or '&nbsp;'}</td>
23 </tr>
24 <tr>
25 <td><b>Driver<br />驾驶员</b></td><td>${delivery_route.driver_id.name or '&nbsp;'}</td>
26 <td><b>Deliver<br />送货员</b></td><td>${delivery_route.picker_id.name or '&nbsp;'}</td>
27 </tr>
28 <tr>
29 <td><b>Departure Time<br />出发时间</b></td><td>${delivery_route.departure_date or '&nbsp;'}</td>
30 <td><b>Operation Rep<br />运营人员</b></td><td></td>
31 </tr>
32 </table>
33 <br />
34 <div class="main">
35 <table width="100%" class="basic_table">
36 <tbody>
37 <tr style="font-weight:bold;">
38 <td style="height:26px;" colspan="4">Reason for delayed/Early departure 延迟的原因</td>
39 <td colspan="2">出库公里数: </td>
40 <td colspan="2">回库公里数: </td>
41 </tr>
42 <tr style="font-weight:bold;">
43 <td style="vertical-align:top; height:30px;" colspan="8">&nbsp;</td>
44 </tr>
45 <tr style="font-weight:bold;">
46 <td style="text-align:center; height:16px;" colspan="8">List of deliveries / 交货清单</td>
47 </tr>
48 <tr style="font-weight:bold;">
49 <td style="vertical-align:top; width:15px;">No</td>
50 <td style="vertical-align:top; width:70px;">Order <br /> 单号</td>
51 <td style="vertical-align:top; width:48px;">T<br />装箱</td>
52 <td style="vertical-align:top; width:175px;">Address<br />地址</td>
53 <td style="vertical-align:top;">Time<br />时间要求</td>
54 <td style="vertical-align:top;">Payment<br />支付方式</td>
55 <td style="vertical-align:top; width:75px;">Arrive Time<br />到达时间</td>
56 <td style="vertical-align:top; width:75px;">Observation<br />结果</td>
57 </tr>
58 <% cpt=0 %>
59 %for line in delivery_route.line_ids:
60 <% cpt+=1 %>
61 <% iced = False %>
62 <% warm = False %>
63 <% other = False %>
64 %if line.vip:
65 <tr style="font-style:italic;">
66 %else:
67 <tr>
68 %endif
69 <td style="vertical-align: top;"><div class="dontcutme">${cpt}</div></td>
70 <td style="vertical-align: top;"><div class="dontcutme">${line.origin and line.origin or ''}<!--${line.picking_id.name and '('+ line.picking_id.name + ')' or ''}--></div></td>
71 <td style="vertical-align: top;"><div class="dontcutme"><%
72 pack_set = set([ move.product_id.joomla_deliver_in for move in line.picking_id.move_lines ])
73 %>
74 % for pack in pack_set:
75 %if pack in ['warm', 'iced', 'iced_n_warm','cold']:
76 %if pack in ['iced', 'iced_n_warm'] and not iced:
77 <input type="checkbox" /> 冻F<br />
78 <% iced = True %>
79 %endif
80 %if pack in ['warm', 'iced_n_warm'] and not warm:
81 <input type="checkbox" /> 热W<br />
82 <% warm = True %>
83 %endif
84 %if pack in ['cold']:
85 <input type="checkbox" /> 冷C<br />
86 <% warm = True %>
87 %endif
88 %else:
89 %if not other:
90 <input type="checkbox" /> 常温<br />
91 <% other = True %>
92 %endif
93 %endif
94 %endfor
95 </div></td>
96 <td style="vertical-align: top;"><div class="dontcutme">${line.address_id.name or ''}<br />${line.street or line.address_id.street or ''}</div></td>
97 <td style="vertical-align: top;"><div class="dontcutme">${line.customer_date or ''}</div></td>
98 <td style="vertical-align: top;"><div class="dontcutme">${line.so_payment_method or ''}</div></td>
99 <td style="vertical-align: top;">&nbsp;</td>
100 <td style="vertical-align: top;">&nbsp;</td>
101 </tr>
102 %endfor
103 </tbody>
104 </table>
105 </div>
106 <div style="page-break-after: auto;"><span style="display: none;"> </span></div>
107 <% cpt+=1 %>
108 %endfor
109 </body>
110</html>
0\ No newline at end of file111\ No newline at end of file
1112
=== added file 'delivery_plan/report/delivery_route_print.mako.1'
--- delivery_plan/report/delivery_route_print.mako.1 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/delivery_route_print.mako.1 2013-09-09 08:37:27 +0000
@@ -0,0 +1,111 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3 <head>
4 <meta content="text/html; charset=UTF-8" http-equiv="content-type">
5 <style type="text/css">
6 ${css}
7 </style>
8 </head>
9 <body>
10 <% cpt = 0 %>
11 %for delivery_route in objects :
12%if cpt > 0:
13<div style="page-break-after: always;"><span style="display: none;"> </span></div>
14%endif
15 <div class="title">Delivery Distribution Control Sheet (配送交接控制表)</div>
16 <div style="font-size:12px;font-style:italic;text-align:center;">Ref / 编号 : ${delivery_route.name}</div>
17 <td><b></b></td><td></td>
18 <br />
19 <table class="basic_table" width="100%">
20 <tr>
21 <td width="17%"><b>Date<br />日期</b></td><td width="33%">${delivery_route.date}</td>
22 <td width="17%"><b>Time Slot<br />时间段</b></td><td>${delivery_route.dts_id.name or '&nbsp;'}</td>
23 </tr>
24 <tr>
25 <td><b>Driver<br />驾驶员</b></td><td>${delivery_route.driver_id.name or '&nbsp;'}</td>
26 <td><b>Deliver<br />送货员</b></td><td>${delivery_route.picker_id.name or '&nbsp;'}</td>
27 </tr>
28 <tr>
29 <td><b>Departure Time<br />出发时间</b></td><td>${delivery_route.departure_date or '&nbsp;'}</td>
30 <td><b>Operation Rep<br />运营人员</b></td><td></td>
31 </tr>
32 </table>
33 <br />
34 <div class="main">
35 <table width="100%" class="basic_table">
36 <tbody>
37 <tr style="font-weight:bold;">
38 <td style="border:0; padding-left:15px;vertical-align:top; height:16px;" colspan="8">Reason for delayed/Early departure 延迟的原因
39 /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
40 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 出库公里数 <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </u>
41 /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 回库公里数 <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </u></td>
42 </tr>
43 <tr style="font-weight:bold;">
44 <td style="vertical-align:top; height:30px;" colspan="8">&nbsp;</td>
45 </tr>
46 <tr style="font-weight:bold;">
47 <td style="text-align:center; height:16px;" colspan="8">List of deliveries / 交货清单</td>
48 </tr>
49 <tr style="font-weight:bold;">
50 <td style="vertical-align:top; width:15px;">No</td>
51 <td style="vertical-align:top; width:70px;">Order <br /> 单号</td>
52 <td style="vertical-align:top; width:48px;">T<br />装箱</td>
53 <td style="vertical-align:top; width:175px;">Address<br />地址</td>
54 <td style="vertical-align:top;">Time<br />时间要求</td>
55 <td style="vertical-align:top;">Payment<br />支付方式</td>
56 <td style="vertical-align:top; width:75px;">Arrive Time<br />到达时间</td>
57 <td style="vertical-align:top; width:75px;">Observation<br />结果</td>
58 </tr>
59 <% cpt=0 %>
60 %for line in delivery_route.line_ids:
61 <% cpt+=1 %>
62 <% iced = False %>
63 <% warm = False %>
64 <% other = False %>
65 %if line.vip:
66 <tr style="font-style:italic;">
67 %else:
68 <tr>
69 %endif
70 <td style="vertical-align: top;"><div class="dontcutme">${cpt}</div></td>
71 <td style="vertical-align: top;"><div class="dontcutme">${line.origin and line.origin or ''}<!--${line.picking_id.name and '('+ line.picking_id.name + ')' or ''}--></div></td>
72 <td style="vertical-align: top;"><div class="dontcutme"><%
73 pack_set = set([ move.product_id.joomla_deliver_in for move in line.picking_id.move_lines ])
74 %>
75 % for pack in pack_set:
76 %if pack in ['warm', 'iced', 'iced_n_warm']:
77 %if pack in ['iced', 'iced_n_warm'] and not iced:
78 <input type="checkbox" /> 冻F<br />
79 <% iced = True %>
80 %endif
81 %if pack in ['warm', 'iced_n_warm'] and not warm:
82 <input type="checkbox" /> 热W<br />
83 <% warm = True %>
84 %endif
85 %if pack in ['cold']:
86 <input type="checkbox" /> 冷C<br />
87 <% warm = True %>
88 %endif
89 %else:
90 %if not other:
91 <input type="checkbox" /> 常温<br />
92 <% other = True %>
93 %endif
94 %endif
95 %endfor
96 </div></td>
97 <td style="vertical-align: top;"><div class="dontcutme">${line.address_id.name or ''}<br />${line.street or line.address_id.street or ''}</div></td>
98 <td style="vertical-align: top;"><div class="dontcutme">${line.customer_date or ''}</div></td>
99 <td style="vertical-align: top;"><div class="dontcutme">${line.so_payment_method or ''}</div></td>
100 <td style="vertical-align: top;">&nbsp;</td>
101 <td style="vertical-align: top;">&nbsp;</td>
102 </tr>
103 %endfor
104 </tbody>
105 </table>
106 </div>
107 <div style="page-break-after: auto;"><span style="display: none;"> </span></div>
108 <% cpt+=1 %>
109 %endfor
110 </body>
111</html>
0\ No newline at end of file112\ No newline at end of file
1113
=== added file 'delivery_plan/report/delivery_route_print.py'
--- delivery_plan/report/delivery_route_print.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/delivery_route_print.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,39 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7# $Id$
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24import time
25
26from report import report_sxw
27import pooler
28
29class report_delivery_route_print(report_sxw.rml_parse):
30 _name = 'report.delivery.route.print'
31
32 def __init__(self, cr, uid, name, context):
33 super(report_delivery_route_print, self).__init__(cr, uid, name, context)
34
35
36report_sxw.report_sxw('delivery.route.print', 'delivery.route',
37 'addons/fc_delivery_plan/report/delivery_route_print.mako', parser=report_delivery_route_print)
38
39# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
040
=== added file 'delivery_plan/report/delivery_route_print.py.bak'
--- delivery_plan/report/delivery_route_print.py.bak 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/delivery_route_print.py.bak 2013-09-09 08:37:27 +0000
@@ -0,0 +1,53 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import time
23from report import report_sxw
24import netsvc
25
26class report_delivery_route_print(report_sxw.rml_parse):
27 _name = 'report.delivery.route.print'
28 def __init__(self, cr, uid, name, context):
29 super(report_delivery_route_print, self).__init__(cr, uid, name, context)
30 self.localcontext.update({
31 'time': time,
32 'convert': self.convert,
33 'day': self.day,
34 'month': self.month,
35 'year': self.year,
36 })
37
38 def convert(self, amount, currency): return self.pool.get('ir.translation').amount_to_text(amount, 'zh_cn', currency or 'Nuevo Sol')
39
40 def day(self, date): return self.pool.get('ir.translation').date_part(date, 'day', format='number' ,lang='zh_cn')
41
42 def month(self, date): return self.pool.get('ir.translation').date_part(date, 'month', format='text' ,lang='zh_cn')
43
44 def year(self, date): return self.pool.get('ir.translation').date_part(date, 'year', format='number' ,lang='zh_cn')
45
46report_sxw.report_sxw(
47 'delivery.route.print',
48 'delivery.route',
49 'addons/delivery_routes/report/delivery_route_print.rml',
50 parser=report_delivery_route_print,header="external"
51)
52
53# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
054
=== added file 'delivery_plan/report/delivery_route_print.rml'
--- delivery_plan/report/delivery_route_print.rml 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/delivery_route_print.rml 2013-09-09 08:37:27 +0000
@@ -0,0 +1,243 @@
1<?xml version="1.0"?>
2<document filename="test.pdf">
3 <template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
4 <pageTemplate id="first">
5 <frame id="first" x1="16.0" y1="20.0" width="808" height="545"/>
6 </pageTemplate>
7 </template>
8 <stylesheet>
9 <blockTableStyle id="Standard_Outline">
10 <blockAlignment value="LEFT"/>
11 <blockValign value="TOP"/>
12 </blockTableStyle>
13 <blockTableStyle id="Table1">
14 <blockAlignment value="LEFT"/>
15 <blockValign value="TOP"/>
16 <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
17 <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
18 <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
19 <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
20 <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
21 <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
22 <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
23 <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
24 <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
25 <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
26 <lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1"/>
27 <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
28 <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
29 </blockTableStyle>
30 <blockTableStyle id="Table2">
31 <blockAlignment value="LEFT"/>
32 <blockValign value="TOP"/>
33 <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
34 <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
35 <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
36 <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
37 <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
38 <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
39 <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
40 <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
41 <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
42 <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
43 <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
44 <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
45 <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
46 <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
47 <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
48 <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
49 <lineStyle kind="LINEAFTER" colorName="#000000" start="5,0" stop="5,-1"/>
50 <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
51 <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
52 <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/>
53 <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
54 <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/>
55 <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
56 <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,1" stop="2,-1"/>
57 <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
58 <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,1" stop="3,-1"/>
59 <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
60 <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,1" stop="4,-1"/>
61 <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
62 <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,1" stop="5,-1"/>
63 <lineStyle kind="LINEAFTER" colorName="#000000" start="5,1" stop="5,-1"/>
64 <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
65 <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,2" stop="0,-1"/>
66 <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
67 <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,2" stop="1,-1"/>
68 <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
69 <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,2" stop="2,-1"/>
70 <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
71 <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,2" stop="3,-1"/>
72 <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
73 <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,2" stop="4,-1"/>
74 <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
75 <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,2" stop="5,-1"/>
76 <lineStyle kind="LINEAFTER" colorName="#000000" start="5,2" stop="5,-1"/>
77 <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
78 </blockTableStyle>
79 <initialize>
80 <paraStyle name="all" alignment="justify"/>
81 </initialize>
82 <paraStyle name="P1" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
83 <paraStyle name="P2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
84 <paraStyle name="P3" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
85 <paraStyle name="P4" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
86 <paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
87 <paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
88 <paraStyle name="Standard" fontName="Helvetica"/>
89 <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
90 <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
91 <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
92 <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
93 <paraStyle name="Index" fontName="Helvetica"/>
94 <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
95 <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
96 <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
97 <paraStyle name="terp_default_Centre_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
98 <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
99 <paraStyle name="terp_default_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
100 <paraStyle name="terp_default_Bold_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
101 <paraStyle name="terp_default_Bold_9" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
102 <paraStyle name="terp_default_Bold_Right_9" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
103 <paraStyle name="terp_default_Right_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
104 <paraStyle name="terp_default_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
105 <paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
106 <paraStyle name="terp_default_9_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
107 <images/>
108 </stylesheet>
109 <story>
110 <para style="P3">
111 <font color="white"> </font>
112 </para>
113 <para style="P3">[[repeatIn(objects,'o')]]</para>
114 <para style="P3">[[ setLang(o.partner_id.lang) ]]</para>
115 <para style="P3">
116 <font color="white"> </font>
117 </para>
118 <para style="P3">Referencia : [[ o.name ]]</para>
119 <para style="P3">
120 <font color="white"> </font>
121 </para>
122 <para style="P3">Conductor: [[ o.driver_id.name ]]</para>
123 <para style="P3">
124 <font color="white"> </font>
125 </para>
126 <para style="P3">Fecha: [[ o.date ]] - Horario: [[ o.dts_id.name ]]</para>
127 <para style="P3">
128 <font color="white"> </font>
129 </para>
130 <blockTable colWidths="85.0,138.0,114.0,138.0" style="Table1">
131 <tr>
132 <td>
133 <para style="P1">Hora de Salida:</para>
134 </td>
135 <td>
136 <para style="P2">[[ (o.departure_date) ]]</para>
137 </td>
138 <td>
139 <para style="P1">Hora de Llegada:</para>
140 </td>
141 <td>
142 <para style="P2">
143 <font color="white"> </font>
144 </para>
145 </td>
146 </tr>
147 </blockTable>
148 <para style="P4">
149 <font color="white"> </font>
150 </para>
151 <blockTable colWidths="27.0,67.0,273.0,146.0,84.0,209.0" style="Table2">
152 <tr>
153 <td>
154 <para style="P6">Seq</para>
155 </td>
156 <td>
157 <para style="P6">POS Order</para>
158 </td>
159 <td>
160 <para style="P6">Dirección de Entrega</para>
161 </td>
162 <td>
163 <para style="P6">Destinatario</para>
164 </td>
165 <td>
166 <para style="P6">Hora de Visita</para>
167 </td>
168 <td>
169 <para style="P6">Detalle de Visita</para>
170 </td>
171 </tr>
172 <tr>
173 <td>
174 <para style="P2">[[repeatIn(o.line_ids,'line')]] [[line.sequence]]</para>
175 </td>
176 <td>
177 <para style="P5">[[line.pos_order_id.name]]</para>
178 </td>
179 <td>
180 <para style="P5">[[line.address_id.street]] [[line.address_id.street2]], [[line.address_id.district_id.name]] ([[line.address_id.address_ref]])</para>
181 </td>
182 <td>
183 <para style="P5">[[line.address_id.name]] ([[line.address_id.phone]] / [[line.address_id.mobile]])</para>
184 </td>
185 <td>
186 <para style="P5">
187 <font color="white"> </font>
188 </para>
189 </td>
190 <td>
191 <para style="P5">
192 <font color="white"> </font>
193 </para>
194 </td>
195 </tr>
196 <tr>
197 <td>
198 <para style="P2">
199 <font color="white"> </font>
200 </para>
201 </td>
202 <td>
203 <para style="P5">
204 <font color="white"> </font>
205 </para>
206 </td>
207 <td>
208 <para style="P5">
209 <font color="white"> </font>
210 </para>
211 </td>
212 <td>
213 <para style="P5">
214 <font color="white"> </font>
215 </para>
216 </td>
217 <td>
218 <para style="P5">
219 <font color="white"> </font>
220 </para>
221 </td>
222 <td>
223 <para style="P5">
224 <font color="white"> </font>
225 </para>
226 </td>
227 </tr>
228 </blockTable>
229 <para style="P3">
230 <font color="white"> </font>
231 </para>
232 <para style="P3">
233 <font color="white"> </font>
234 </para>
235 <para style="P3">
236 <font color="white"> </font>
237 </para>
238 <para style="P3">
239 <font color="white"> </font>
240 </para>
241 </story>
242</document>
243
0244
=== added file 'delivery_plan/report/delivery_route_print.rml.bk'
--- delivery_plan/report/delivery_route_print.rml.bk 1970-01-01 00:00:00 +0000
+++ delivery_plan/report/delivery_route_print.rml.bk 2013-09-09 08:37:27 +0000
@@ -0,0 +1,266 @@
1<?xml version="1.0"?>
2<document filename="test.pdf">
3 <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
4 <pageTemplate id="first">
5 <frame id="first" x1="1.0" y1="56.0" width="594" height="786"/>
6 </pageTemplate>
7 </template>
8 <stylesheet>
9 <blockTableStyle id="Standard_Outline">
10 <blockAlignment value="LEFT"/>
11 <blockValign value="TOP"/>
12 </blockTableStyle>
13 <blockTableStyle id="Table_Partner_Address">
14 <blockAlignment value="LEFT"/>
15 <blockValign value="TOP"/>
16 </blockTableStyle>
17 <blockTableStyle id="Tabla2">
18 <blockAlignment value="LEFT"/>
19 <blockValign value="TOP"/>
20 </blockTableStyle>
21 <blockTableStyle id="Tabla1">
22 <blockAlignment value="LEFT"/>
23 <blockValign value="TOP"/>
24 </blockTableStyle>
25 <blockTableStyle id="Tabla4">
26 <blockAlignment value="LEFT"/>
27 <blockValign value="TOP"/>
28 </blockTableStyle>
29 <blockTableStyle id="Tabla5">
30 <blockAlignment value="LEFT"/>
31 <blockValign value="TOP"/>
32 </blockTableStyle>
33 <blockTableStyle id="Tabla6">
34 <blockAlignment value="LEFT"/>
35 <blockValign value="TOP"/>
36 </blockTableStyle>
37 <initialize>
38 <paraStyle name="all" alignment="justify"/>
39 </initialize>
40 <paraStyle name="P1" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
41 <paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
42 <paraStyle name="P3" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
43 <paraStyle name="P4" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
44 <paraStyle name="P5" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
45 <paraStyle name="P6" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
46 <paraStyle name="P7" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
47 <paraStyle name="P8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
48 <paraStyle name="P9" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
49 <paraStyle name="P10" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
50 <paraStyle name="P11" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
51 <paraStyle name="Standard" fontName="Helvetica"/>
52 <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
53 <paraStyle name="Text_20_body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
54 <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
55 <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
56 <paraStyle name="Index" fontName="Helvetica"/>
57 <paraStyle name="terp_5f_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
58 <paraStyle name="terp_5f_default_5f_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
59 <paraStyle name="Table_20_Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
60 <paraStyle name="terp_5f_default_5f_Centre_5f_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
61 <paraStyle name="terp_5f_default_5f_Centre_5f_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
62 <paraStyle name="terp_5f_default_5f_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
63 <paraStyle name="terp_5f_default_5f_Bold_5f_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
64 <paraStyle name="terp_5f_default_5f_Bold_5f_9" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
65 <paraStyle name="terp_5f_default_5f_Bold_5f_Right_5f_9" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
66 <paraStyle name="terp_5f_default_5f_Right_5f_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
67 <paraStyle name="terp_5f_default_5f_Right_5f_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
68 <paraStyle name="terp_5f_default_5f_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
69 <paraStyle name="terp_5f_default_5f_9_5f_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
70 <images/>
71 </stylesheet>
72 <story>
73 <para style="terp_5f_default_5f_8">[[repeatIn(objects,'route')]]</para>
74 <para style="terp_5f_default_5f_8">[[ setLang(o.partner_id.lang) ]]</para>
75 <para style="terp_5f_default_5f_8">
76 <font color="white"> </font>
77 </para>
78 <blockTable colWidths="393.0,202.0" style="Table_Partner_Address">
79 <tr>
80 <td>
81 <blockTable colWidths="55.0,338.0" style="Tabla2">
82 <tr>
83 <td>
84 <para style="P2">
85 <font color="white"> </font>
86 </para>
87 </td>
88 <td>
89 <para style="P1">
90 <font color="white"> </font>
91 </para>
92 <para style="P1">[[ route.date ]]</para>
93 </td>
94 </tr>
95 <tr>
96 <td>
97 <para style="P2">
98 <font color="white"> </font>
99 </para>
100 </td>
101 <td>
102 <para style="P10">Horario </para>
103 </td>
104 </tr>
105 <tr>
106 <td>
107 <para style="P2">
108 <font color="white"> </font>
109 </para>
110 </td>
111 <td>
112 <para style="P10">Conductor</para>
113 </td>
114 </tr>
115 <tr>
116 <td>
117 <para style="P2">
118 <font color="white"> </font>
119 </para>
120 </td>
121 <td>
122 <para style="P10">[[ route.dts_id.name ]]</para>
123 </td>
124 </tr>
125 <tr>
126 <td>
127 <para style="P2">
128 <font color="white"> </font>
129 </para>
130 </td>
131 <td>
132 <para style="P9">[[ route.driver_id.name ]]</para>
133 </td>
134 </tr>
135 </blockTable>
136 </td>
137 <td>
138 <blockTable colWidths="202.0" style="Tabla1">
139 <tr>
140 <td>
141 <para style="P2">
142 <font color="white"> </font>
143 </para>
144 </td>
145 </tr>
146 <tr>
147 <td>
148 <para style="terp_5f_default_5f_9">blabla 1</para>
149 <para style="terp_5f_default_5f_9">bla bla 2</para>
150 <para style="P8">
151 <font color="white"> </font>
152 </para>
153 </td>
154 </tr>
155 </blockTable>
156 <para style="terp_5f_default_5f_8">
157 <font color="white"> </font>
158 </para>
159 </td>
160 </tr>
161 <tr>
162 <td>
163 <para style="terp_5f_default_5f_8">
164 <font color="white"> </font>
165 </para>
166 <blockTable colWidths="35.0,74.0,351.0,68.0,67.0" style="Tabla4">
167 <tr>
168 <td>
169 <para style="P5">
170 <font color="white"> </font>
171 </para>
172 </td>
173 <td>
174 <para style="P8">[[repeatIn(o.line_ids,'lines')]][[ lines.pos_order_id.name]]</para>
175 </td>
176 <td>
177 <para style="P8">[[ lines.address_id.street]]</para>
178 </td>
179 <td>
180 <para style="P5">[[ lines.address_id.district_id.name]]</para>
181 </td>
182 <td>
183 <para style="P5">[[ day(lines.visit_day) month(lines.visit_day) year(lines.visit_day) ]]</para>
184 </td>
185 </tr>
186 </blockTable>
187 <blockTable colWidths="30.0,384.0,182.0" style="Tabla5">
188 <tr>
189 <td>
190 <para style="P2">
191 <font color="white"> </font>
192 </para>
193 </td>
194 <td>
195 <para style="P4">
196 <font color="white"> </font>
197 </para>
198 </td>
199 <td>
200 <para style="P2">
201 <font color="white"> </font>
202 </para>
203 </td>
204 </tr>
205 </blockTable>
206 <blockTable colWidths="85.0,254.0,76.0,88.0,93.0" style="Tabla6">
207 <tr>
208 <td>
209 <para style="P2">
210 <font color="white"> </font>
211 </para>
212 </td>
213 <td>
214 <para style="P2">
215 <font color="white"> </font>
216 </para>
217 </td>
218 <td>
219 <para style="P2">
220 <font color="white"> </font>
221 </para>
222 </td>
223 <td>
224 <para style="P2">
225 <font color="white"> </font>
226 </para>
227 </td>
228 <td>
229 <para style="P2">
230 <font color="white"> </font>
231 </para>
232 </td>
233 </tr>
234 <tr>
235 <td>
236 <para style="P2">
237 <font color="white"> </font>
238 </para>
239 </td>
240 <td>
241 <para style="P2">
242 <font color="white"> </font>
243 </para>
244 </td>
245 <td>
246 <para style="P6">
247 <font color="white"> </font>
248 </para>
249 </td>
250 <td>
251 <para style="P6">
252 <font color="white"> </font>
253 </para>
254 </td>
255 <td>
256 <para style="P7">
257 <font color="white"> </font>
258 </para>
259 </td>
260 </tr>
261 </blockTable>
262 </td>
263 </tr>
264 </blockTable>
265 </story>
266</document>
0267
=== added file 'delivery_plan/report/delivery_route_print.sxw'
1Binary files delivery_plan/report/delivery_route_print.sxw 1970-01-01 00:00:00 +0000 and delivery_plan/report/delivery_route_print.sxw 2013-09-09 08:37:27 +0000 differ268Binary files delivery_plan/report/delivery_route_print.sxw 1970-01-01 00:00:00 +0000 and delivery_plan/report/delivery_route_print.sxw 2013-09-09 08:37:27 +0000 differ
=== added file 'delivery_plan/sale.py'
--- delivery_plan/sale.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/sale.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,1182 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from osv import osv, fields
24from datetime import datetime
25from dateutil.relativedelta import relativedelta
26import pytz
27from openerp import netsvc
28from openerp.tools.translate import _
29
30
31class sale_order(osv.osv):
32 _inherit = "sale.order"
33
34 def _get_dts_id(self, cr, uid, ids, fields, args, context=None):
35 result = {}
36 for so in self.browse(cr, uid, ids, context=context):
37 result[so.id] = so.pts_id and so.pts_id.dts_id and so.pts_id.dts_id.id or False
38 return result
39
40 def _so_to_update_after_dts_change(self, cr, uid, ids, fields=None, arg=None, context=None):
41 if type(ids) != type([]):
42 ids = [ids]
43 return self.pool.get('sale.order').search(cr, uid, [('pts_id', 'in', ids)]) or []
44
45 _store_dts_id = {
46 'sale.order': (lambda self, cr, uid, ids, context: ids, ['pts_id'], 10),
47 'delivery.time': (_so_to_update_after_dts_change, ['dts_id'], 10),
48 }
49
50 _columns = {
51 'pts_id': fields.many2one('delivery.time', 'Preparation Time', domain=[('type', '=', 'pts')]),
52 'dts_id': fields.function(_get_dts_id, method=True, type='many2one', relation='delivery.time', string='Delivery Time', store=_store_dts_id, readonly=True, domain=[('type', '=', 'dts')]),
53 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
54 'start_date': fields.datetime('Delivery Start Date'),
55 'end_date': fields.datetime(' Delivery End Date'),
56 # 'so_payment_method': fields.char('Payment Method', size=32),
57 }
58
59
60 def action_cancel_order_with_moves_not_delivered(self, cr, uid, ids, context=None):
61 wf_service = netsvc.LocalService("workflow")
62 if context is None:
63 context = {}
64 sale_order_line_obj = self.pool.get('sale.order.line')
65 drl_obj = self.pool.get('delivery.route.line')
66 #proc_obj = self.pool.get('procurement.order')
67 for sale in self.browse(cr, uid, ids, context=context):
68 try:
69 for pick in sale.picking_ids:
70 for mov in pick.move_lines:
71 if mov.state not in ('done','cancel'):
72 mov.write({'state':'cancel'})
73
74 for pick in sale.picking_ids:
75 if pick.state != 'cancel':
76 #wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
77 pick.write({'state':'cancel'})
78 for inv in sale.invoice_ids:
79 wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
80 for line in sale.order_line:
81 if line.procurement_id:
82 wf_service.trg_validate(uid, 'procurement.order', line.procurement_id.id, 'button_check', cr)
83
84 #cancel delivery route line
85 drl_ids = drl_obj.search(cr, uid, [('sale_order_id','=',sale.id),('state','!=','cancel')])
86 drl_obj.action_cancel(cr,uid,drl_ids,context=context)
87
88 order_ref = context.get('order_ref',False)
89 self.write(cr, uid, [sale.id], {'state':'shipping_except','client_order_ref':order_ref})
90 cr.commit()
91 except:
92 _logger.info('==== #LY action_cancel_order_with_moves_not_delivered fail %s===='%(sale.id))
93 return True
94
95 def action_cancel_order_with_moves(self, cr, uid, ids, context=None):
96 wf_service = netsvc.LocalService("workflow")
97 if context is None:
98 context = {}
99 sale_order_line_obj = self.pool.get('sale.order.line')
100 drl_obj = self.pool.get('delivery.route.line')
101 #proc_obj = self.pool.get('procurement.order')
102 for sale in self.browse(cr, uid, ids, context=context):
103 try:
104 if sale.state == 'done':
105 return False
106 for pick in sale.picking_ids:
107 if pick.state == 'done':
108 return False
109 for mov in pick.move_lines:
110 if mov.state == 'done':
111 return False
112 for inv in sale.invoice_ids:
113 if inv.state == 'paid':
114 return False
115
116 for pick in sale.picking_ids:
117 wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
118 for pick in sale.picking_ids:
119 if pick.state != 'cancel':
120 wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
121
122 for inv in sale.invoice_ids:
123 wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
124 for line in sale.order_line:
125 if line.procurement_id:
126 wf_service.trg_validate(uid, 'procurement.order', line.procurement_id.id, 'button_check', cr)
127
128 #cancel delivery route line
129 drl_ids = drl_obj.search(cr, uid, [('sale_order_id','=',sale.id),('state','!=','cancel')])
130 drl_obj.action_cancel(cr,uid,drl_ids,context=context)
131
132 sale_order_line_obj.write(cr, uid, [l.id for l in sale.order_line], {'state': 'cancel'})
133 self.write(cr, uid, [sale.id], {'state': 'cancel'})
134 cr.commit()
135 except:
136 _logger.info('==== #LY action_cancel_order_with_moves fail %s===='%(sale.id))
137 return True
138
139 def _prepare_order_line_procurement(self, cr, uid, order, pt_id, line, move_id, date_planned, context=None):
140 return {
141 'name': line.name,
142 'origin': order.name,
143 'date_planned': date_planned,
144 'product_id': line.product_id.id,
145 'product_qty': line.product_uom_qty,
146 'product_uom': line.product_uom.id,
147 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
148 'product_uos': (line.product_uos and line.product_uos.id) or line.product_uom.id,
149 'location_id': order.shop_id.warehouse_id.lot_stock_id.id,
150 'procure_method': line.type,
151 'move_id': move_id,
152 'company_id': order.company_id.id,
153 'note': line.name,
154 'pts_id': pt_id,
155 }
156
157 def _prepare_order_line_move_fc(self, cr, uid, order, line, picking_id, pt_id, date_planned, context=None):
158 location_id = order.shop_id.warehouse_id.lot_stock_id.id
159 output_id = order.shop_id.warehouse_id.lot_output_id.id
160 return {
161 'name': line.name,
162 'picking_id': picking_id,
163 'product_id': line.product_id.id,
164 'date': date_planned,
165 'date_expected': date_planned,
166 'product_qty': line.product_uom_qty,
167 'product_uom': line.product_uom.id,
168 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
169 'product_uos': (line.product_uos and line.product_uos.id) or line.product_uom.id,
170 'product_packaging': line.product_packaging.id,
171 'partner_id': line.address_allotment_id.id or order.partner_shipping_id.id,
172 'location_id': location_id,
173 'location_dest_id': output_id,
174 'sale_line_id': line.id,
175 'tracking_id': False,
176 'state': 'draft',
177 'company_id': order.company_id.id,
178 'price_unit': line.product_id.standard_price or 0.0,
179 'pts_id':pt_id,
180 }
181
182 def _prepare_order_picking(self, cr, uid, order, dt_id, pt_id, context=None):
183 # SHOULD USE ir_sequence.next_by_code() or ir_sequence.next_by_id()
184 pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
185 return {
186 'name': pick_name,
187 'origin': order.name,
188 'date': order.date_order,
189 'type': 'out',
190 'state': 'auto',
191 'move_type': order.picking_policy,
192 'sale_id': order.id,
193 'partner_id': order.partner_shipping_id.id,
194 'note': order.note,
195 'invoice_state': (order.order_policy == 'picking' and '2binvoiced') or 'none',
196 'company_id': order.company_id.id,
197 'dts_id':dt_id,
198 'pts_id':pt_id,
199 }
200
201 def _prepare_pts_dts(self, cr, uid, order, context=None):
202 if not context:
203 context = {}
204 tz = pytz.timezone('Asia/Shanghai')
205 tz2 = pytz.timezone('America/Anchorage')
206 delivery_time_obj = self.pool.get('delivery.time')
207 time_slot_obj = self.pool.get('delivery.time.slot')
208 val={}
209
210 dts = False
211 pts = False
212 pt_id = False
213 dt_id = False
214 min_date = False
215 slot_id = False
216 now = datetime.now()
217 address = order.partner_shipping_id or order.partner_id or False
218
219 if order.start_date:
220 min_date = order.start_date
221 dts = order.start_date
222 dts = datetime.strptime(dts, '%Y-%m-%d %H:%M:%S')
223 dts = pytz.utc.localize(dts).astimezone(tz)
224 if order.date_order:
225 pts = datetime.strptime(order.date_order, '%Y-%m-%d')
226 pts = pytz.utc.localize(pts).astimezone(tz)
227 if not pts:
228 pts = dts
229
230 if dts:
231 start_date = datetime.strftime(dts, '%Y-%m-%d')
232 from_time = datetime.strftime(dts, '%H:%M')
233 #LY remove the shanghai restrict out
234 # if address and (not address.city or address.city.lower() in ['shanghai']):
235 # from_time = datetime.strftime(dts, '%H:%M')
236 # else: # eg: in Nanjing
237 # from_time = '09:30'
238 name = datetime.strftime(dts, '%y%m%d')
239 name_pts = name
240 start_date_pts = start_date
241
242 slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'dts')], order='max_time')
243 if slot_ids:
244 slot = time_slot_obj.browse(cr, uid, slot_ids[0])
245 name += slot.name
246 end_date = start_date + ' ' + slot.end_time
247 start_date += ' ' + slot.start_time
248 start_date = datetime.strptime(start_date, '%Y-%m-%d %H:%M')
249 start_date = pytz.utc.localize(start_date).astimezone(tz2)
250 start_date = datetime.strftime(start_date, '%Y-%m-%d %H:%M')
251 end_date = datetime.strptime(end_date, '%Y-%m-%d %H:%M')
252 end_date = pytz.utc.localize(end_date).astimezone(tz2)
253 end_date = datetime.strftime(end_date, '%Y-%m-%d %H:%M')
254
255 dt_ids = delivery_time_obj.search(cr, uid, [('name', '=', name), ('type', '=', 'dts'), ('slot_id', '=', slot.id)])
256 if dt_ids:
257 dt_id = dt_ids[0]
258 else:
259 dt_id = delivery_time_obj.create(cr, uid, {
260 'name':name,
261 'start_date': start_date,
262 'end_date': end_date,
263 'active': True,
264 'type': 'dts',
265 'slot_id': slot.id,
266 }, context)
267 cr.commit()
268
269 if pts and dt_id:
270 date_pts = datetime.strftime(pts, '%Y-%m-%d')
271 from_time = datetime.strftime(pts, '%H:%M')
272 if date_pts < datetime.strftime(dts, '%Y-%m-%d'):
273 date_pts = datetime.strftime(dts, '%Y-%m-%d')
274 from_time = '00:00'
275
276 pts_slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'pts'), ('dts_id', '=', slot.id)], order='max_time')
277 if pts_slot_ids:
278 pts_slot = time_slot_obj.browse(cr, uid, pts_slot_ids[0])
279 name_pts += pts_slot.name
280 end_date_pts = start_date_pts + ' ' + pts_slot.end_time
281 start_date_pts += ' ' + pts_slot.start_time
282 start_date_pts = datetime.strptime(start_date_pts, '%Y-%m-%d %H:%M')
283 start_date_pts = pytz.utc.localize(start_date_pts).astimezone(tz2)
284 start_date_pts = datetime.strftime(start_date_pts, '%Y-%m-%d %H:%M')
285 end_date_pts = datetime.strptime(end_date_pts, '%Y-%m-%d %H:%M')
286 end_date_pts = pytz.utc.localize(end_date_pts).astimezone(tz2)
287 end_date_pts = datetime.strftime(end_date_pts, '%Y-%m-%d %H:%M')
288
289 pt_ids = delivery_time_obj.search(cr, uid, [('name', '=', name_pts), ('type', '=', 'pts'), ('slot_id', '=', pts_slot.id)])
290 if pt_ids:
291 pt_id = pt_ids[0]
292 else:
293 pt_id = delivery_time_obj.create(cr, uid, {
294 'name':name_pts,
295 'start_date': start_date_pts,
296 'end_date': end_date_pts,
297 'active': True,
298 'type': 'pts',
299 'slot_id': pts_slot.id,
300 'dts_id': dt_id,
301 }, context)
302 cr.commit()
303 val['pts_id'] = pt_id
304 if val:
305 order.write(val)
306 return min_date, dt_id, pt_id
307
308
309 def _create_pickings_and_procurements(self, cr, uid, order, order_lines, picking_id=False, context=None):
310 """Create the required procurements to supply sales order lines, also connecting
311 the procurements to appropriate stock moves in order to bring the goods to the
312 sales order's requested location.
313
314 If ``picking_id`` is provided, the stock moves will be added to it, otherwise
315 a standard outgoing picking will be created to wrap the stock moves, as returned
316 by :meth:`~._prepare_order_picking`.
317
318 Modules that wish to customize the procurements or partition the stock moves over
319 multiple stock pickings may override this method and call ``super()`` with
320 different subsets of ``order_lines`` and/or preset ``picking_id`` values.
321
322 :param browse_record order: sales order to which the order lines belong
323 :param list(browse_record) order_lines: sales order line records to procure
324 :param int picking_id: optional ID of a stock picking to which the created stock moves
325 will be added. A new picking will be created if ommitted.
326 :return: True
327 """
328 val = {}
329 move_obj = self.pool.get('stock.move')
330 picking_obj = self.pool.get('stock.picking')
331 procurement_obj = self.pool.get('procurement.order')
332 proc_ids = []
333
334 min_date, dt_id, pt_id = self._prepare_pts_dts(cr, uid, order)
335 # min_date, dt_id, pt_id = order.date_order, order.dts_id.id, order.pts_id.id
336 print '<<<<<<<<<<<<<< %s, %s, %s' % (min_date, dt_id, pt_id)
337
338 for line in order_lines:
339 if line.state == 'done':
340 continue
341
342 date_planned = min_date or self._get_date_planned(cr, uid, order, line, order.date_order, context=context)
343
344 if line.product_id:
345 if line.product_id.type in ('product', 'consu'):
346 if not picking_id:
347 picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, dt_id, pt_id, context=context))
348 move_id = move_obj.create(cr, uid, self._prepare_order_line_move_fc(cr, uid, order, line, picking_id, pt_id, date_planned, context=context))
349 else:
350 # a service has no stock move
351 move_id = False
352
353 proc_id = procurement_obj.create(cr, uid, self._prepare_order_line_procurement(cr, uid, order, pt_id, line, move_id, date_planned, context=context))
354 proc_ids.append(proc_id)
355 line.write({'procurement_id': proc_id})
356 self.ship_recreate(cr, uid, order, line, move_id, proc_id)
357
358 wf_service = netsvc.LocalService("workflow")
359 if picking_id:
360 wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
361 for proc_id in proc_ids:
362 wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
363
364 if order.state == 'shipping_except':
365 val['state'] = 'progress'
366 val['shipped'] = False
367
368 if (order.order_policy == 'manual'):
369 for line in order.order_line:
370 if (not line.invoiced) and (line.state not in ('cancel', 'draft')):
371 val['state'] = 'manual'
372 break
373 order.write(val)
374 return True
375
376sale_order()
377
378
379class picking_batch(osv.osv):
380 _name = "picking.batch"
381 _columns = {
382 'name': fields.char('Name', size=32, translate=True),
383 'picking_ids': fields.one2many('stock.picking', 'batch_id', 'Contains'),
384 'active': fields.boolean('Active'),
385 }
386
387 _defaults = {
388 'active': True,
389 }
390
391picking_batch()
392
393
394class stock_picking(osv.osv):
395 _name = "stock.picking"
396 _inherit = "stock.picking"
397 _columns = {
398 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
399 'route_line_id': fields.one2many('delivery.route.line', 'picking_id', 'Delivery Time'),
400 'so_payment_method': fields.char('Payment Method', size=32),
401 }
402
403 def write(self, cr, uid, ids, vals, context=None):
404 context = context or {}
405 pts_id = False
406 if type(ids) != type([]):
407 ids = [ids]
408 if 'dts_id' in vals:
409 move_pool = self.pool.get('stock.move')
410 proc_pool = self.pool.get('procurement.order')
411 pts_pool = self.pool.get('delivery.time')
412 drl_pool = self.pool.get('delivery.route.line')
413
414 if 'pts_id' not in vals:
415 pts_id = pts_pool.search(cr, uid, [('active', '=', True), ('type', '=', 'pts'), ('dts_id', '=', vals['dts_id'])], order='start_date DESC')
416 if pts_id:
417 pts_id = pts_id[0]
418 vals.update({'pts_id':pts_id})
419 else:
420 pts_id = vals['pts_id']
421
422 if pts_id:
423 move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
424 if move_ids:
425 move_pool.write(cr, uid, move_ids, {'pts_id':pts_id})
426 proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
427 if proc_ids:
428 proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
429
430# Actually DONE in fields.function
431# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
432# if route_lines:
433# drl_pool.write(cr, uid, route_lines, {'dts_id': vals['dts_id']})
434 return super(stock_picking, self).write(cr, uid, ids, vals, context=context)
435
436
437 def pts_id_change(self, cr, uid, ids, pts_id, context=None):
438 res = {}
439 context = context or {}
440 if type(ids) != type([]):
441 ids = [ids]
442 move_pool = self.pool.get('stock.move')
443 proc_pool = self.pool.get('procurement.order')
444 pts_pool = self.pool.get('delivery.time')
445 drl_pool = self.pool.get('delivery.route.line')
446
447 if pts_id:
448 pts = pts_pool.browse(cr, uid, [pts_id])[0]
449 #self.write(cr, uid, ids, {'dts_id':pts and pts.dts_id and pts.dts_id.id or False})
450 res['dts_id'] = pts and pts.dts_id and pts.dts_id.id or False
451
452 move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
453 if move_ids:
454 vals = {'pts_id':pts_id}
455 if pts_id:
456 vals.update({'date_expected':pts.dts_id.start_date})
457 move_pool.write(cr, uid, move_ids, vals)
458 proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
459 if proc_ids:
460 proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
461
462# Actually DONE in fields.function
463# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
464# if route_lines and 'dts_id' in res:
465# drl_pool.write(cr, uid, route_lines, {'dts_id': res['dts_id']})
466 return {'value': res}
467
468
469 def create(self, cr, uid, data, context=None):
470 """
471 create route line
472 """
473 if not data.get('pts_id', False) and data.get('origin', False):
474 so_obj = self.pool.get('sale.order')
475 so_ids = so_obj.search(cr, uid, [('name', '=', data.get('origin'))]) or []
476 for so in so_obj.browse(cr, uid, so_ids):
477 data.update({'pts_id':so.pts_id and so.pts_id.id or False, 'dts_id':so.pts_id and so.pts_id.dts_id and so.pts_id.dts_id.id or False})
478
479 return_type = data.get('return', 'none')
480 sp = super(stock_picking, self).create(cr, uid, data, context=context)
481 if data.get('type', 'internal') in ['in','out'] and data.get('pts_id', False) and return_type not in ['customer', 'supplier']:
482 self.pool.get('delivery.route.line').create(cr, uid, {'picking_id':sp, })
483 return sp
484
485stock_picking()
486
487
488class stock_picking_out(osv.osv):
489 _inherit = "stock.picking.out"
490 _columns = {
491 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
492 'route_line_id': fields.one2many('delivery.route.line', 'picking_id', 'Delivery Time'),
493 'so_payment_method': fields.char('Payment Method', size=32),
494 }
495
496 def write(self, cr, uid, ids, vals, context=None):
497 context = context or {}
498 pts_id = False
499 if type(ids) != type([]):
500 ids = [ids]
501 if 'dts_id' in vals:
502 move_pool = self.pool.get('stock.move')
503 proc_pool = self.pool.get('procurement.order')
504 pts_pool = self.pool.get('delivery.time')
505 drl_pool = self.pool.get('delivery.route.line')
506
507 if 'pts_id' not in vals:
508 pts_id = pts_pool.search(cr, uid, [('active', '=', True), ('type', '=', 'pts'), ('dts_id', '=', vals['dts_id'])], order='start_date DESC')
509 if pts_id:
510 pts_id = pts_id[0]
511 vals.update({'pts_id':pts_id})
512 else:
513 pts_id = vals['pts_id']
514
515 if pts_id:
516 move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
517 if move_ids:
518 move_pool.write(cr, uid, move_ids, {'pts_id':pts_id})
519 proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
520 if proc_ids:
521 proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
522
523# Actually DONE in fields.function
524# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
525# if route_lines:
526# drl_pool.write(cr, uid, route_lines, {'dts_id': vals['dts_id']})
527 return super(stock_picking_out, self).write(cr, uid, ids, vals, context=context)
528
529
530 def pts_id_change(self, cr, uid, ids, pts_id, context=None):
531 res = {}
532 context = context or {}
533 if type(ids) != type([]):
534 ids = [ids]
535 move_pool = self.pool.get('stock.move')
536 proc_pool = self.pool.get('procurement.order')
537 pts_pool = self.pool.get('delivery.time')
538 drl_pool = self.pool.get('delivery.route.line')
539
540 if pts_id:
541 pts = pts_pool.browse(cr, uid, [pts_id])[0]
542 #self.write(cr, uid, ids, {'dts_id':pts and pts.dts_id and pts.dts_id.id or False})
543 res['dts_id'] = pts and pts.dts_id and pts.dts_id.id or False
544
545 move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
546 if move_ids:
547 vals = {'pts_id':pts_id}
548 if pts_id:
549 vals.update({'date_expected':pts.dts_id.start_date})
550 move_pool.write(cr, uid, move_ids, vals)
551 proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
552 if proc_ids:
553 proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
554
555# Actually DONE in fields.function
556# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
557# if route_lines and 'dts_id' in res:
558# drl_pool.write(cr, uid, route_lines, {'dts_id': res['dts_id']})
559 return {'value': res}
560
561
562 def create(self, cr, uid, data, context=None):
563 """
564 create route line
565 """
566 if not data.get('pts_id', False) and data.get('origin', False):
567 so_obj = self.pool.get('sale.order')
568 so_ids = so_obj.search(cr, uid, [('name', '=', data.get('origin'))]) or []
569 for so in so_obj.browse(cr, uid, so_ids):
570 data.update({'pts_id':so.pts_id and so.pts_id.id or False, 'dts_id':so.pts_id and so.pts_id.dts_id and so.pts_id.dts_id.id or False})
571
572 return_type = data.get('return', 'none')
573 sp = super(stock_picking_out, self).create(cr, uid, data, context=context)
574 if data.get('pts_id', False) and return_type not in ['customer', 'supplier']:
575 self.pool.get('delivery.route.line').create(cr, uid, {'picking_id':sp, })
576 return sp
577
578stock_picking_out()
579
580
581class stock_picking_in(osv.osv):
582 _inherit = "stock.picking.in"
583
584 _columns = {
585 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
586 'route_line_id': fields.one2many('delivery.route.line', 'picking_id', 'Delivery Time'),
587 }
588
589 def write(self, cr, uid, ids, vals, context=None):
590 context = context or {}
591 pts_id = False
592 if type(ids) != type([]):
593 ids = [ids]
594 if 'dts_id' in vals:
595 move_pool = self.pool.get('stock.move')
596 proc_pool = self.pool.get('procurement.order')
597 pts_pool = self.pool.get('delivery.time')
598 drl_pool = self.pool.get('delivery.route.line')
599
600 if 'pts_id' not in vals:
601 pts_id = pts_pool.search(cr, uid, [('active', '=', True), ('type', '=', 'pts'), ('dts_id', '=', vals['dts_id'])], order='start_date DESC')
602 if pts_id:
603 pts_id = pts_id[0]
604 vals.update({'pts_id':pts_id})
605 else:
606 pts_id = vals['pts_id']
607
608 if pts_id:
609 move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
610 if move_ids:
611 move_pool.write(cr, uid, move_ids, {'pts_id':pts_id})
612 proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
613 if proc_ids:
614 proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
615
616# Actually DONE in fields.function
617# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
618# if route_lines:
619# drl_pool.write(cr, uid, route_lines, {'dts_id': vals['dts_id']})
620 return super(stock_picking_in, self).write(cr, uid, ids, vals, context=context)
621
622
623 def pts_id_change(self, cr, uid, ids, pts_id, context=None):
624 res = {}
625 context = context or {}
626 if type(ids) != type([]):
627 ids = [ids]
628 move_pool = self.pool.get('stock.move')
629 proc_pool = self.pool.get('procurement.order')
630 pts_pool = self.pool.get('delivery.time')
631 drl_pool = self.pool.get('delivery.route.line')
632
633 if pts_id:
634 pts = pts_pool.browse(cr, uid, [pts_id])[0]
635 #self.write(cr, uid, ids, {'dts_id':pts and pts.dts_id and pts.dts_id.id or False})
636 res['dts_id'] = pts and pts.dts_id and pts.dts_id.id or False
637
638 move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
639 if move_ids:
640 vals = {'pts_id':pts_id}
641 if pts_id:
642 vals.update({'date_expected':pts.dts_id.start_date})
643 move_pool.write(cr, uid, move_ids, vals)
644 proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
645 if proc_ids:
646 proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
647
648# Actually DONE in fields.function
649# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
650# if route_lines and 'dts_id' in res:
651# drl_pool.write(cr, uid, route_lines, {'dts_id': res['dts_id']})
652 return {'value': res}
653
654
655 def create(self, cr, uid, data, context=None):
656 """
657 create route line
658 """
659 if not data.get('pts_id', False) and data.get('origin', False):
660 so_obj = self.pool.get('sale.order')
661 so_ids = so_obj.search(cr, uid, [('name', '=', data.get('origin'))]) or []
662 for so in so_obj.browse(cr, uid, so_ids):
663 data.update({'pts_id':so.pts_id and so.pts_id.id or False, 'dts_id':so.pts_id and so.pts_id.dts_id and so.pts_id.dts_id.id or False})
664
665 purchase_id = data.get('purchase_id', False)
666 return_type = data.get('return', 'none')
667 if purchase_id:
668 po = self.pool.get('purchase.order').browse(cr, uid, purchase_id)
669 if not po.is_collected:
670 purchase_id = False
671
672 sp = super(stock_picking_in, self).create(cr, uid, data, context=context)
673 if data.get('pts_id', False) and return_type not in ['customer', 'supplier'] and not purchase_id:
674 self.pool.get('delivery.route.line').create(cr, uid, {'picking_id':sp, })
675 return sp
676
677stock_picking_in()
678
679
680class stock_tracking(osv.osv):
681 _inherit = "stock.tracking"
682
683 _columns = {
684 'picking_id': fields.many2one('stock.picking', 'Picking Related', change_default=True),
685 'ul_id': fields.many2one('product.ul', 'Picking Box', change_default=True),
686 }
687stock_tracking()
688
689
690class mrp_production(osv.osv):
691 _inherit = 'mrp.production'
692
693 _columns = {
694 'pts_id': fields.many2one('delivery.time', 'Preparation Time', select=True, domain=[('type', '=', 'pts')]),
695 }
696
697 def _make_production_internal_shipment_line(self, cr, uid, production_line, shipment_id, parent_move_id, destination_location_id=False, context=None):
698 stock_move = self.pool.get('stock.move')
699 production = production_line.production_id
700 date_planned = production.date_planned
701 # Internal shipment is created for Stockable and Consumer Products
702 if production_line.product_id.type not in ('product', 'consu'):
703 return False
704 source_location_id = production.location_src_id.id
705 if not destination_location_id:
706 destination_location_id = source_location_id
707 return stock_move.create(cr, uid, {
708 'name': production.name,
709 'picking_id': shipment_id,
710 'product_id': production_line.product_id.id,
711 'product_qty': production_line.product_qty,
712 'product_uom': production_line.product_uom.id,
713 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
714 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
715 'date': date_planned,
716 'move_dest_id': parent_move_id,
717 'location_id': source_location_id,
718 'location_dest_id': destination_location_id,
719 'state': 'waiting',
720 'company_id': production.company_id.id,
721 'pts_id': production.pts_id and production.pts_id.id or False,
722 })
723
724 def _make_production_internal_shipment(self, cr, uid, production, context=None):
725 ir_sequence = self.pool.get('ir.sequence')
726 stock_picking = self.pool.get('stock.picking')
727 routing_loc = None
728 pick_type = 'internal'
729 partner_id = False
730
731 # Take routing address as a Shipment Address.
732 # If usage of routing location is a internal, make outgoing shipment otherwise internal shipment
733 if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
734 routing_loc = production.bom_id.routing_id.location_id
735 if routing_loc.usage != 'internal':
736 pick_type = 'out'
737 partner_id = routing_loc.partner_id and routing_loc.partner_id.id or False
738
739 # Take next Sequence number of shipment base on type
740 # SHOULD USE ir_sequence.next_by_code() or ir_sequence.next_by_id()
741 pick_name = ir_sequence.get(cr, uid, 'stock.picking.' + pick_type)
742
743 picking_id = stock_picking.create(cr, uid, {
744 'name': pick_name,
745 'origin': (production.origin or '').split(':')[0] + ':' + production.name,
746 'type': pick_type,
747 'move_type': 'one',
748 'state': 'auto',
749 'partner_id': partner_id,
750 'auto_picking': self._get_auto_picking(cr, uid, production),
751 'company_id': production.company_id.id,
752 'pts_id': production.pts_id and production.pts_id.id or False,
753 'dts_id': production.pts_id and production.pts_id.dts_id and production.pts_id.dts_id.id or False,
754 })
755 production.write({'picking_id': picking_id}, context=context)
756 return picking_id
757
758 def _make_production_produce_line(self, cr, uid, production, context=None):
759 stock_move = self.pool.get('stock.move')
760 source_location_id = production.product_id.property_stock_production.id
761 destination_location_id = production.location_dest_id.id
762 data = {
763 'name': production.name,
764 'date': production.date_planned,
765 'product_id': production.product_id.id,
766 'product_qty': production.product_qty,
767 'product_uom': production.product_uom.id,
768 'product_uos_qty': production.product_uos and production.product_uos_qty or False,
769 'product_uos': production.product_uos and production.product_uos.id or False,
770 'location_id': source_location_id,
771 'location_dest_id': destination_location_id,
772 'move_dest_id': production.move_prod_id.id,
773 'state': 'waiting',
774 'company_id': production.company_id.id,
775 'pts_id': production.pts_id and production.pts_id.id or False,
776 }
777 move_id = stock_move.create(cr, uid, data, context=context)
778 production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context)
779 return move_id
780
781 def _make_production_consume_line(self, cr, uid, production_line, parent_move_id, source_location_id=False, context=None):
782 stock_move = self.pool.get('stock.move')
783 production = production_line.production_id
784 # Internal shipment is created for Stockable and Consumer Products
785 if production_line.product_id.type not in ('product', 'consu'):
786 return False
787 destination_location_id = production.product_id.property_stock_production.id
788 if not source_location_id:
789 source_location_id = production.location_src_id.id
790 move_id = stock_move.create(cr, uid, {
791 'name': production.name,
792 'date': production.date_planned,
793 'product_id': production_line.product_id.id,
794 'product_qty': production_line.product_qty,
795 'product_uom': production_line.product_uom.id,
796 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
797 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
798 'location_id': source_location_id,
799 'location_dest_id': destination_location_id,
800 'move_dest_id': parent_move_id,
801 'state': 'waiting',
802 'company_id': production.company_id.id,
803 'pts_id': production.pts_id and production.pts_id.id or False,
804 })
805 production.write({'move_lines': [(4, move_id)]}, context=context)
806 return move_id
807
808mrp_production()
809
810
811class procurement_order(osv.osv):
812 _inherit = 'procurement.order'
813
814 _columns = {
815 'pts_id': fields.many2one('delivery.time', 'Preparation Time', select=True, domain=[('type', '=', 'pts')]),
816 'message': fields.char(_('Latest error'), size=2048, help="Exception occurred while computing procurement orders."),
817 }
818
819 def make_mo(self, cr, uid, ids, context=None):
820 """ Make Manufacturing(production) order from procurement
821 @return: New created Production Orders procurement wise
822 """
823 res = {}
824 company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
825 production_obj = self.pool.get('mrp.production')
826 move_obj = self.pool.get('stock.move')
827 wf_service = netsvc.LocalService("workflow")
828 procurement_obj = self.pool.get('procurement.order')
829 for procurement in procurement_obj.browse(cr, uid, ids, context=context):
830 res_id = procurement.move_id.id
831 newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.produce_delay or 0.0)
832 newdate = newdate - relativedelta(days=company.manufacturing_lead)
833 produce_id = production_obj.create(cr, uid, {
834 'origin': procurement.origin,
835 'product_id': procurement.product_id.id,
836 'product_qty': procurement.product_qty,
837 'product_uom': procurement.product_uom.id,
838 'product_uos_qty': procurement.product_uos and procurement.product_uos_qty or False,
839 'product_uos': procurement.product_uos and procurement.product_uos.id or False,
840 'location_src_id': procurement.location_id.id,
841 'location_dest_id': procurement.location_id.id,
842 'bom_id': procurement.bom_id and procurement.bom_id.id or False,
843 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
844 'move_prod_id': res_id,
845 'company_id': procurement.company_id.id,
846 'pts_id': procurement.pts_id and procurement.pts_id.id or context and context.get('force_pts_id', False) or False,
847 })
848
849 res[procurement.id] = produce_id
850 self.write(cr, uid, [procurement.id], {'state': 'running', 'production_id': produce_id})
851 bom_result = production_obj.action_compute(cr, uid,
852 [produce_id], properties=[x.id for x in procurement.property_ids])
853 wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
854 if res_id:
855 move_obj.write(cr, uid, [res_id], {'location_id': procurement.location_id.id})
856 self.production_order_create_note(cr, uid, ids, context=context)
857 return res
858
859procurement_order()
860
861
862class delivery_time(osv.osv):
863 _inherit = 'delivery.time'
864
865 def search(self, cr, uid, args, offset=0, limit=None, order='name', context=None, count=False):
866 # now = datetime.now()
867 # args.append(('name','>=',datetime.strftime(now,'%y%m%d')))
868 return super(delivery_time, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
869
870delivery_time()
871
872
873class delivery_return_type(osv.osv):
874 _name = 'delivery.return.type'
875
876 _columns = {
877 'name': fields.char('Name', size=64, required=True, select=True),
878 'sequence': fields.integer('Sequence'),
879 }
880 _order = 'sequence'
881delivery_return_type()
882
883
884class delivery_return_reason(osv.osv):
885 _name = 'delivery.return.reason'
886
887 _columns = {
888 'type': fields.many2one('delivery.return.type', 'Type', required=True),
889 'reason': fields.char('Name', size=1024, required=False),
890 'route_line_id': fields.many2one('delivery.route.line', 'Delivery Route Line'),
891 }
892delivery_return_reason()
893
894
895class delivery_route(osv.osv):
896 _inherit = 'delivery.route'
897
898 def _auto_init(self, cr, context=None):
899 super(delivery_route, self)._auto_init(cr, context=context)
900 cr.execute("SELECT table_name FROM information_schema.tables WHERE table_name = 'delivery_scheduler_running'")
901 if not cr.fetchone():
902 cr.execute('CREATE TABLE delivery_scheduler_running (running boolean)')
903 cr.commit()
904 cr.execute('INSERT INTO delivery_scheduler_running (running) VALUES (FALSE)')
905
906 def set_confirm_cs(self, cr, uid, ids, context=None):
907 self.write(cr, uid, ids, {'confirm_cs': True}, context=context)
908 return True
909
910delivery_route()
911
912
913class delivery_route_line(osv.osv):
914 _inherit = 'delivery.route.line'
915
916 def search(self, cr, uid, args, offset=0, limit=None, order='dts_name', context=None, count=False):
917 context = context or {}
918 new_order = context.get('sorting', order)
919 return super(delivery_route_line, self).search(cr, uid, args, offset=offset, limit=limit, order=new_order, context=context, count=count)
920
921 def set_not_vip(self, cr, uid, ids, context=None):
922 return self.write(cr, uid, ids, {'vip':False})
923
924 def set_vip(self, cr, uid, ids, context=None):
925 return self.write(cr, uid, ids, {'vip':True})
926
927 def write(self, cr, uid, ids, vals, context=None):
928 if type(ids) != type([]):
929 ids = [ids]
930 context = context or {}
931 if ('route_id' in vals or 'color' in vals or 'sequence' in vals) and not 'force_update' in context:
932 for line in self.browse(cr, uid, ids):
933 if line.state == 'draft':
934 current_dts = context.get('force_dts_id_kanban', False) or False
935 # if current_dts:
936 # vals.update({'dts_id':current_dts})
937 if 'route_id' in vals and vals['route_id']:
938 route_state = self.pool.get('delivery.route').read(cr, uid, [vals['route_id']], ['state', 'name'])
939 if route_state[0]['state'] != 'draft':
940 print('The Route %s is confirmed, you can not add lines to it.' % (route_state[0]['name']))
941 raise osv.except_osv(_('Error'), _('The Route %s is confirmed, you can not add lines to it.' % (route_state[0]['name'])))
942
943 elif 'update_color' in context and context['update_color'] == 1:
944 current_color = str(line.color)
945 cr.execute("SELECT color FROM (select count(*) as cpt, color as color from delivery_route_line WHERE route_id=" + str(vals['route_id']) + " AND color != " + current_color + " AND color IS NOT null AND color > 0 GROUP BY color) t ORDER BY cpt DESC")
946 color = cr.fetchone()
947 if color and color[0]:
948 vals.update({'color':color[0]})
949
950 elif current_dts:
951 cr.execute("SELECT DISTINCT color FROM delivery_route_line WHERE (dts_id=" + str(current_dts) + " OR id = " + str(line.id) + ") AND color IS NOT null AND color > 0")
952 colors = map(lambda x: x[0], cr.fetchall())
953 color = False
954
955 for idx in range(1, 22):
956 if idx not in colors and not color and idx != current_color:
957 color = idx
958 if color:
959 vals.update({'color':color})
960 else:
961 print('No more Route available for the DTS %s.' % (line.dts_id.name))
962 raise osv.except_osv(_('Error'), _('No more Route available for the DTS %s.' % (line.dts_id.name)))
963
964 elif 'check4color' in context and context['check4color'] and 'color' in vals:
965 cr.execute("SELECT DISTINCT route_id FROM delivery_route_line WHERE dts_id=" + str(line.dts_id.id) + " AND color = " + str(vals['color']) + " AND color > 0 AND state not in ('draft','cancel')")
966 route_line_ids = map(lambda x: x[0], cr.fetchall())
967 if route_line_ids:
968 print('The Route Line %s (origin: %s) can not be put in a confirmed Route (%s).' % (line.picking_id.name, line.picking_id.origin, route_line_ids))
969 raise osv.except_osv(_('Error'), _('The Route Line %s (origin: %s) can not be put in a confirmed Route (%s).' % (line.picking_id.name, line.picking_id.origin, route_line_ids)))
970 else:
971 print('The Route Line %s (origin: %s) is confirmed. You can not change it.' % (line.picking_id.name, line.picking_id.origin))
972 raise osv.except_osv(_('Error'), _('The Route Line %s (origin: %s) is confirmed. You can not change it.' % (line.picking_id.name, line.picking_id.origin)))
973 return super(delivery_route_line, self).write(cr, uid, ids, vals, context=context)
974
975
976 def set_van(self, cr, uid, ids, van=0, context=None):
977 self.write(cr, uid, ids, {'color': van}, context=context)
978 return True
979 def set_van_0(self, cr, uid, ids, context=None):
980 return self.set_van(cr, uid, ids, 0, context)
981 def set_van_1(self, cr, uid, ids, context=None):
982 return self.set_van(cr, uid, ids, 1, context)
983 def set_van_2(self, cr, uid, ids, context=None):
984 return self.set_van(cr, uid, ids, 2, context)
985 def set_van_3(self, cr, uid, ids, context=None):
986 return self.set_van(cr, uid, ids, 3, context)
987 def set_van_4(self, cr, uid, ids, context=None):
988 return self.set_van(cr, uid, ids, 4, context)
989 def set_van_5(self, cr, uid, ids, context=None):
990 return self.set_van(cr, uid, ids, 5, context)
991 def set_van_6(self, cr, uid, ids, context=None):
992 return self.set_van(cr, uid, ids, 6, context)
993 def set_van_7(self, cr, uid, ids, context=None):
994 return self.set_van(cr, uid, ids, 7, context)
995 def set_van_8(self, cr, uid, ids, context=None):
996 return self.set_van(cr, uid, ids, 8, context)
997 def set_van_9(self, cr, uid, ids, context=None):
998 return self.set_van(cr, uid, ids, 9, context)
999
1000
1001 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
1002 context = context or {}
1003 if 'view_name' in context and view_type == 'kanban':
1004 view_ids = self.pool.get('ir.ui.view').search(cr, uid, [('model', '=', 'delivery.route.line'), ('name', '=', context['view_name'])], context=context)
1005 if view_ids:
1006 view_id = view_ids[0]
1007 del context['view_name']
1008 return super(delivery_route_line, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
1009
1010
1011 def _get_neighborhood(self, cr, uid, ids, fields, args, context=None):
1012 res = {}
1013 for route in self.browse(cr, uid, ids):
1014 # res[route.id] = route.picking_id and route.picking_id.sale_id and route.picking_id.sale_id.deliver_zone or route.picking_id and route.picking_id.partner_id and route.picking_id.partner_id.vm_district or False
1015 res[route.id] = route.picking_id and route.picking_id.partner_id and route.picking_id.partner_id.deliver_zone or False
1016 return res
1017
1018 def _get_dts_id(self, cr, uid, ids, fields, args, context=None):
1019 context = context or {}
1020 res = {}
1021 for route in self.browse(cr, uid, ids):
1022 if route.state in ['draft'] and context.get('set_dts', True):
1023 res[route.id] = route.picking_id and route.picking_id.pts_id and route.picking_id.pts_id.dts_id and route.picking_id.pts_id.dts_id.id or False
1024 else:
1025 res[route.id] = route.dts_id and route.dts_id.id or False
1026 return res
1027
1028 def _get_dts_name(self, cr, uid, ids, fields, args, context=None):
1029 context = context or {}
1030 res = {}
1031 for route in self.browse(cr, uid, ids):
1032 if route.state in ['draft'] and context.get('set_dts', True):
1033 res[route.id] = route.picking_id and route.picking_id.pts_id and route.picking_id.pts_id.dts_id and route.picking_id.pts_id.dts_id.name or 'n/a'
1034 else:
1035 res[route.id] = route.dts_name or 'n/a'
1036 return res
1037
1038 def _get_special_time(self, cr, uid, ids, fields, args, context=None):
1039 tz = pytz.timezone('Asia/Shanghai')
1040 result = {}
1041 for route in self.browse(cr, uid, ids):
1042 res = {}
1043 customer_date = ''
1044 route_dts_id = route.dts_id and route.dts_id.id
1045 so_dts_id = route.picking_id.sale_id.dts_id and route.picking_id.sale_id.dts_id.id
1046
1047 if so_dts_id and route_dts_id != so_dts_id:
1048 customer_date = route.picking_id.sale_id.dts_id.name
1049
1050 elif route.picking_id.sale_id:
1051 date_start = route.picking_id.sale_id.start_date or False
1052 date_end = route.picking_id.sale_id.end_date or False
1053
1054 if date_start:
1055 date_start = datetime.strptime(date_start, '%Y-%m-%d %H:%M:%S')
1056 date_start = pytz.utc.localize(date_start).astimezone(tz)
1057
1058 customer_date = datetime.strftime(date_start, '%H:%M')
1059 #LY if customer_date is 00:00, no special time.
1060 if customer_date != '00:00':
1061 if date_end:
1062 date_end = datetime.strptime(date_end, '%Y-%m-%d %H:%M:%S')
1063 date_end = pytz.utc.localize(date_end).astimezone(tz)
1064 customer_date += ' - '
1065 customer_date += datetime.strftime(date_end, '%H:%M')
1066 res['customer_date'] = customer_date or ' '
1067 result[route.id] = res
1068 return result
1069
1070 def _get_street(self, cr, uid, ids, fields, args, context=None):
1071 res = {}
1072 for route in self.browse(cr, uid, ids):
1073 res[route.id] = route.picking_id and route.picking_id.partner_id and route.picking_id.partner_id.street or ' n/a'
1074 return res
1075
1076 def _route_to_update_after_picking_change(self, cr, uid, ids, fields=None, arg=None, context=None):
1077 if type(ids) != type([]):
1078 ids = [ids]
1079 return self.pool.get('delivery.route.line').search(cr, uid, [('picking_id', 'in', ids)]) or []
1080
1081 def _route_to_update_after_dts_change(self, cr, uid, ids, fields=None, arg=None, context=None):
1082 if type(ids) != type([]):
1083 ids = [ids]
1084 picking_ids = self.pool.get('stock.picking').search(cr, uid, [('dts_id', 'in', ids)]) or []
1085 return self.pool.get('delivery.route.line')._route_to_update_after_picking_change(cr, uid, picking_ids, None, None, context=context)
1086
1087 def _route_to_update_after_so_change(self, cr, uid, ids, fields=None, arg=None, context=None):
1088 if type(ids) != type([]):
1089 ids = [ids]
1090 return self.pool.get('delivery.route.line').search(cr, uid, [('sale_order_id', 'in', ids)]) or []
1091
1092 def _route_to_update_after_po_change(self, cr, uid, ids, fields=None, arg=None, context=None):
1093 if type(ids) != type([]):
1094 ids = [ids]
1095 return self.pool.get('delivery.route.line').search(cr, uid, [('purchase_id', 'in', ids)]) or []
1096
1097 def _route_to_update_after_partner_change(self, cr, uid, ids, fields=None, arg=None, context=None):
1098 if type(ids) != type([]):
1099 ids = [ids]
1100 picking_ids = self.pool.get('stock.picking').search(cr, uid, [('partner_id', 'in', ids)]) or []
1101 return self.pool.get('delivery.route.line')._route_to_update_after_picking_change(cr, uid, picking_ids, None, None, context=context)
1102
1103 _store_dts = {
1104 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 10),
1105 'stock.picking': (_route_to_update_after_picking_change, ['pts_id'], 10),
1106 }
1107 _store_dts_name = {
1108 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 10),
1109 'stock.picking': (_route_to_update_after_picking_change, ['pts_id'], 10),
1110 'delivery.time': (_route_to_update_after_dts_change, ['name'], 10),
1111 }
1112 _store_special_time = {
1113 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 12),
1114 'stock.picking': (_route_to_update_after_picking_change, ['sale_id','dts_id'], 12),
1115 'sale.order': (_route_to_update_after_so_change, ['dts_id'], 12),
1116 }
1117 _store_neighborhood = {
1118 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 10),
1119 'stock.picking': (_route_to_update_after_picking_change, ['partner_id'], 10),
1120 'res.partner': (_route_to_update_after_partner_change, ['vm_district'], 10),
1121 }
1122
1123 _store_amount = {
1124 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id', 'adjustment'], 10),
1125 'stock.picking': (_route_to_update_after_picking_change, ['sale_id', 'purchase_id', 'origin'], 10),
1126 'purchase.order': (_route_to_update_after_po_change, ['amount_total'], 10),
1127 }
1128
1129 _store_street = {
1130 'delivery.route.line': (lambda self,cr,uid,ids,context: ids,['picking_id'],10),
1131 'stock.picking': (_route_to_update_after_picking_change, ['partner_id'], 10),
1132 }
1133
1134 def _get_amount(self, cr, uid, ids, fields, args, context=None):
1135 result = {}
1136 for route in self.browse(cr, uid, ids):
1137 res = {}
1138 res['amount_total'] = 0.0
1139 res['amount_unpaid'] = 0.0
1140 res['to_be_received'] = 0.0
1141
1142 if route.picking_id and route.picking_id.sale_id:
1143 res['amount_total'] = route.picking_id.sale_id.amount_total
1144 res['amount_unpaid'] = res['amount_total']
1145 res['to_be_received'] = res['amount_unpaid'] + route.adjustment
1146 elif route.picking_id and route.picking_id.purchase_id:
1147 res['amount_total'] = route.picking_id.purchase_id.amount_total
1148 res['amount_unpaid'] = 0.0
1149 res['to_be_received'] = res['amount_unpaid'] + route.adjustment
1150 result[route.id] = res
1151 return result
1152
1153 _columns = {
1154 'dts_id': fields.function(_get_dts_id, type='many2one', obj='delivery.time', store=_store_dts, string='Delivery Time', _classic_read=True),
1155 'dts_name': fields.function(_get_dts_name, type='char', size=124, store=_store_dts_name, string='Delivery Time'),
1156 'return_reasons': fields.one2many('delivery.return.reason', 'route_line_id', 'Return Reasons', readonly=False),
1157 'delivered_cpt': fields.related('picking_id', 'delivered_cpt', type='integer', string='Delivered x times', readonly=True),
1158 'customer_date': fields.function(_get_special_time, type='char', size=64, store=_store_special_time, multi="special_time", string=_('Customer Delivery Time')),
1159 'neighborhood': fields.function(_get_neighborhood, type='char', size=255, store=_store_neighborhood, string=_('Neighborhood')),
1160 'street': fields.function(_get_street, type='char', size=128, store=_store_street, string='Street'),
1161 'vip': fields.boolean('is VIP ?'),
1162 'amount_total': fields.function(_get_amount, type='float', multi="amount", store=_store_amount, string='Total'),
1163 'amount_unpaid': fields.function(_get_amount, type='float', multi="amount", store=_store_amount, string='Unpaid'),
1164 'adjustment': fields.float('Adjustment'),
1165 'cs_remark': fields.text('CS Remark'),
1166 'to_be_received': fields.function(_get_amount, type='float', multi="amount", store=_store_amount, string='To be Received'),
1167 'amount_received': fields.float('Received'),
1168 'account_checked': fields.boolean('Checked'),
1169 'account_remark': fields.text('Remark Accounting'),
1170 }
1171delivery_route_line()
1172
1173
1174class res_users(osv.osv):
1175 _inherit = 'res.users'
1176
1177 _columns = {
1178 'dts_id': fields.many2one('delivery.time', 'Last Used Delivery Time'),
1179 }
1180res_users()
1181
1182# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
01183
=== added directory 'delivery_plan/security'
=== added file 'delivery_plan/security/ir.model.access.csv'
--- delivery_plan/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ delivery_plan/security/ir.model.access.csv 2013-09-09 08:37:27 +0000
@@ -0,0 +1,3 @@
1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2access_delivery_return_reason_fc,delivery.return.reason.fc,delivery_plan.model_delivery_return_reason,delivery_routes.group_delivery_user,1,1,1,1
3access_delivery_return_reason_cs,delivery.return.reason.cs,delivery_plan.model_delivery_return_reason,delivery_routes.group_customer_service_user,1,1,0,0
04
=== added file 'delivery_plan/sequence.xml'
--- delivery_plan/sequence.xml 1970-01-01 00:00:00 +0000
+++ delivery_plan/sequence.xml 2013-09-09 08:37:27 +0000
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data noupdate="1">
4 <!-- Sequences for sale.order -->
5 <record id="seq_type_picking_batch" model="ir.sequence.type">
6 <field name="name">Picking Batch</field>
7 <field name="code">picking.batch</field>
8 </record>
9
10 <record id="seq_picking_batch" model="ir.sequence">
11 <field name="name">Picking Batch</field>
12 <field name="code">picking.batch</field>
13 <field name="prefix">PB%(year)s%(month)s%(day)s</field>
14 <field name="padding">3</field>
15 <field name="company_id" eval="False"/>
16 </record>
17 </data>
18</openerp>
0\ No newline at end of file19\ No newline at end of file
120
=== added directory 'delivery_plan/static'
=== added directory 'delivery_plan/static/description'
=== added file 'delivery_plan/static/description/delivery_plan1.png'
2Binary files delivery_plan/static/description/delivery_plan1.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan1.png 2013-09-09 08:37:27 +0000 differ21Binary files delivery_plan/static/description/delivery_plan1.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan1.png 2013-09-09 08:37:27 +0000 differ
=== added file 'delivery_plan/static/description/delivery_plan2.png'
3Binary files delivery_plan/static/description/delivery_plan2.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan2.png 2013-09-09 08:37:27 +0000 differ22Binary files delivery_plan/static/description/delivery_plan2.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan2.png 2013-09-09 08:37:27 +0000 differ
=== added file 'delivery_plan/static/description/delivery_plan3.png'
4Binary files delivery_plan/static/description/delivery_plan3.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan3.png 2013-09-09 08:37:27 +0000 differ23Binary files delivery_plan/static/description/delivery_plan3.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan3.png 2013-09-09 08:37:27 +0000 differ
=== added file 'delivery_plan/static/description/delivery_plan4.png'
5Binary files delivery_plan/static/description/delivery_plan4.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan4.png 2013-09-09 08:37:27 +0000 differ24Binary files delivery_plan/static/description/delivery_plan4.png 1970-01-01 00:00:00 +0000 and delivery_plan/static/description/delivery_plan4.png 2013-09-09 08:37:27 +0000 differ
=== added file 'delivery_plan/static/description/index.html'
--- delivery_plan/static/description/index.html 1970-01-01 00:00:00 +0000
+++ delivery_plan/static/description/index.html 2013-09-09 08:37:27 +0000
@@ -0,0 +1,40 @@
1 <section class="oe_container oe_website_only">
2
3 <div class="oe_row oe_more_spaced">
4 <h2 class="oe_slogan">delivery_plan Module</h2>
5 <h3 class="oe_slogan">Add and Edit Details of Delivery</h3>
6 <h4 class="oe_slogan"><a href="http://www.openerp.com.cn">By Elico Corp</a></h4>
7 <div class="oe_span6">
8 <p>This modules adds the 2 new fields to the purchase and sales orders which are: Start Delivery Date and End Delivery Date.<br> Users will be able to edit delivery details with this module.</p>
9 <div class="oe_span6">
10 <img class="oe_picture" src="delivery_plan1.png">
11 </div>
12 </div>
13 <div class="oe_span6">
14 <p>Features:</p> - Automatically assign Purchase / Sales Orders a Preparation Time Slot and Delivery Time Slot to match Start and End Delivery Date<br> - Edit Delivery Time Slot and Assigned Transport and its Drivers for Orders<br> - Kanban View of All Deliveries categorized by Delivery Time Slot and Assigned Transport<br> - Input reason for returned goods<br> - Easier Confirmation for Delivery before Departure by Customer Service<br> - Adjust of payments of the received by Customers<br> - Input notes for special services for customers during delivery
15 </div>
16 </div>
17 <div class="oe_span4 oe_centered">
18 <h3>Prepare Vans for DTS</h3>
19 <div class="oe_row_img oe_centered">
20 <img class="oe_picture" src="delivery_plan2.png">
21 </div>
22 </div>
23 <div class="oe_span4 oe_centered">
24 <h3>Prepare Routes for DTS</h3>
25 <div class="oe_row_img oe_centered">
26 <img class="oe_picture" src="delivery_plan3.png">
27 </div>
28 </div>
29 <div class="oe_span4 oe_centered">
30 <h3>Choose Driver for DTS</h3>
31 <div class="oe_row_img oe_centered">
32 <img class="oe_picture" src="delivery_plan4.png">
33 </div>
34 </div>
35 <div class="oe_row oe_centeralign oe_more_space" style="clear:both;">
36 <a href="http://www.elico-corp.com" class="oe_button oe_big"> Start your <span class="oe_emph">free</span> trial</a>
37 </div>
38 <h4 class="oe_slogan">or</h4>
39
40</section>
0\ No newline at end of file41\ No newline at end of file
142
=== added file 'delivery_plan/stock_view.xml'
--- delivery_plan/stock_view.xml 1970-01-01 00:00:00 +0000
+++ delivery_plan/stock_view.xml 2013-09-09 08:37:27 +0000
@@ -0,0 +1,694 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="procurement_form_view_pts_elico" model="ir.ui.view">
6 <field name="name">procurement_form_view_pts_elico</field>
7 <field name="model">procurement.order</field>
8 <field name="inherit_id" ref="procurement.procurement_form_view" />
9 <field name="arch" type="xml">
10 <xpath expr="//field[@name='origin']" position="after">
11 <field name="pts_id" attrs="{'readonly': [('state','!=','draft')]}" domain="[('type','=','pts'),('active','=',True)]"/>
12 </xpath>
13 </field>
14 </record>
15 <record id="procurement_tree_view_pts_elico" model="ir.ui.view">
16 <field name="name">procurement_tree_view_pts_elico</field>
17 <field name="model">procurement.order</field>
18 <field name="inherit_id" ref="procurement.procurement_tree_view" />
19 <field name="arch" type="xml">
20 <xpath expr="//field[@name='origin']" position="before">
21 <field name="pts_id" domain="[('type','=','pts')]"/>
22 </xpath>
23 </field>
24 </record>
25
26 <record id="mrp_production_search_view_pts_elico" model="ir.ui.view">
27 <field name="name">mrp_production_search_view_pts_elico</field>
28 <field name="model">mrp.production</field>
29 <field name="inherit_id" ref="mrp.view_mrp_production_filter" />
30 <field name="arch" type="xml">
31 <xpath expr="//field[@string='Production']" position="after">
32 <field name="pts_id" context="{'domain':[('type','=','pts')]}"/>
33 </xpath>
34 <xpath expr="//filter[@string='Date']" position="after">
35 <filter string="Preparation Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'pts_id'}"/>
36 </xpath>
37 </field>
38 </record>
39 <record id="mrp_production_form_view_pts_elico" model="ir.ui.view">
40 <field name="name">mrp_production_form_view_pts_elico</field>
41 <field name="model">mrp.production</field>
42 <field name="inherit_id" ref="mrp.mrp_production_form_view" />
43 <field name="arch" type="xml">
44 <xpath expr="//field[@name='date_planned']" position="after">
45 <field name="pts_id" readonly="1" domain="[('type','=','pts'),('active','=',True)]"/>
46 </xpath>
47 </field>
48 </record>
49 <record id="mrp_production_tree_view_pts_elico" model="ir.ui.view">
50 <field name="name">mrp_production_tree_view_pts_elico</field>
51 <field name="model">mrp.production</field>
52 <field name="inherit_id" ref="mrp.mrp_production_tree_view" />
53 <field name="arch" type="xml">
54 <xpath expr="//field[@name='date_planned']" position="after">
55 <field name="pts_id" domain="[('type','=','pts')]"/>
56 </xpath>
57 </field>
58 </record>
59
60 <record id="view_picking_out_pts_form_elico" model="ir.ui.view">
61 <field name="name">stock.picking.out.form_pts_elico</field>
62 <field name="model">stock.picking.out</field>
63 <field name="inherit_id" ref="stock.view_picking_out_form"/>
64 <field name="arch" type="xml">
65 <xpath expr="//field[@name='partner_id']" position="after">
66 <field name="dts_id" readonly="1"/>
67 <field name="pts_id" on_change="pts_id_change(pts_id, context)" attrs="{'readonly': [('state','in',['cancel','done'])]}" domain="[('type','=','pts'),('active','=',True)]"/>
68 <field name="sale_id"/>
69 </xpath>
70 </field>
71 </record>
72
73 <record id="view_picking_out_pts_tree_elico" model="ir.ui.view">
74 <field name="name">stock.picking.out.tree_pts_elico</field>
75 <field name="model">stock.picking.out</field>
76 <field name="inherit_id" ref="stock.view_picking_out_tree"/>
77 <field name="arch" type="xml">
78 <xpath expr="//field[@name='partner_id']" position="after">
79 <field name="dts_id" domain="[('type','=','dts')]"/>
80 <field name="pts_id" domain="[('type','=','pts')]"/>
81 </xpath>
82 </field>
83 </record>
84 <record id="view_picking_pts_form_elico" model="ir.ui.view">
85 <field name="name">stock.picking.form_pts_elico</field>
86 <field name="model">stock.picking</field>
87 <field name="inherit_id" ref="stock.view_picking_form"/>
88 <field name="arch" type="xml">
89 <xpath expr="//field[@name='partner_id']" position="after">
90 <field name="dts_id" readonly="1"/>
91 <field name="pts_id" on_change="pts_id_change(pts_id, context)" attrs="{'readonly': [('state','in',['cancel','done'])]}" domain="[('type','=','pts'),('active','=',True)]"/>
92 </xpath>
93 </field>
94 </record>
95 <record id="view_picking_pts_tree_elico" model="ir.ui.view">
96 <field name="name">stock.picking.tree_pts_elico</field>
97 <field name="model">stock.picking</field>
98 <field name="inherit_id" ref="stock.vpicktree"/>
99 <field name="arch" type="xml">
100 <xpath expr="//field[@name='min_date']" position="after">
101 <field name="dts_id" domain="[('type','=','dts')]"/>
102 <field name="pts_id" domain="[('type','=','pts')]"/>
103 </xpath>
104 </field>
105 </record>
106 <record id="view_picking_in_pts_form_elico" model="ir.ui.view">
107 <field name="name">stock.picking.in.form_pts_elico</field>
108 <field name="model">stock.picking.in</field>
109 <field name="inherit_id" ref="stock.view_picking_in_form"/>
110 <field name="arch" type="xml">
111 <xpath expr="//field[@name='partner_id']" position="after">
112 <field name="dts_id" domain="[('type','=','dts'),('active','=',True)]" attrs="{'readonly': [('state','in',['cancel','done'])]}"/>
113 <field name="pts_id" invisible="1" on_change="pts_id_change(pts_id, context)" attrs="{'readonly': [('state','in',['cancel','done'])]}" domain="[('type','=','pts'),('active','=',True)]"/>
114 </xpath>
115 </field>
116 </record>
117 <record id="view_picking_in_pts_tree_elico" model="ir.ui.view">
118 <field name="name">stock.picking.in.tree_pts_elico</field>
119 <field name="model">stock.picking.in</field>
120 <field name="inherit_id" ref="stock.view_picking_in_tree"/>
121 <field name="arch" type="xml">
122 <xpath expr="//field[@name='partner_id']" position="after">
123 <field name="dts_id" domain="[('type','=','dts')]"/>
124 <!--field name="pts_id" invisible="1"/-->
125 </xpath>
126 </field>
127 </record>
128
129 <record id="view_order_pts_form_elico" model="ir.ui.view">
130 <field name="name">sale.order.form_pts_elico</field>
131 <field name="model">sale.order</field>
132 <field name="inherit_id" ref="sale.view_order_form"/>
133 <field name="arch" type="xml">
134 <xpath expr="//field[@name='date_order']" position="after">
135 <field name="dts_id" domain="[('type','=','dts')]"/>
136 <field name="pts_id" domain="[('type','=','pts')]"/>
137 <field name="start_date" />
138 <field name="end_date" />
139 <field name="so_payment_method"/>
140 </xpath>
141 </field>
142 </record>
143 <record id="view_order_pts_tree_elico" model="ir.ui.view">
144 <field name="name">sale.order.tree_pts_elico</field>
145 <field name="model">sale.order</field>
146 <field name="inherit_id" ref="sale.view_order_tree"/>
147 <field name="arch" type="xml">
148 <xpath expr="//field[@name='date_order']" position="after">
149 <field name="dts_id" domain="[('type','=','dts')]"/>
150 <field name="pts_id" domain="[('type','=','pts')]"/>
151 </xpath>
152 </field>
153 </record>
154 <record id="view_quotation_pts_tree_elico" model="ir.ui.view">
155 <field name="name">sale.quotation.tree_pts_elico</field>
156 <field name="model">sale.order</field>
157 <field name="inherit_id" ref="sale.view_quotation_tree"/>
158 <field name="arch" type="xml">
159 <xpath expr="//field[@name='date_order']" position="after">
160 <field name="dts_id" invisible="1"/>
161 <field name="pts_id" invisible="1"/>
162 </xpath>
163 </field>
164 </record>
165 <record id="view_order_pts_search_elico" model="ir.ui.view">
166 <field name="name">sale.order.search_pts_elico</field>
167 <field name="model">sale.order</field>
168 <field name="inherit_id" ref="sale.view_sales_order_filter"/>
169 <field name="arch" type="xml">
170 <xpath expr="/search/group/filter[@string='Order Date']" position="after">
171 <field name="pts_id" context="{'domain':[('type','=','pts')]}"/>
172 <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
173 <filter string="Preparation Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'pts_id'}"/>
174 <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_id'}"/>
175 </xpath>
176 </field>
177 </record>
178
179 <!-- Delivery Picking Tree -->
180 <record id="delivery_picking_tree" model="ir.ui.view">
181 <field name="name">stock.picking.tree</field>
182 <field name="model">stock.picking</field>
183 <field name="arch" type="xml">
184 <tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Picking list">
185 <field name="name"/>
186 <field name="origin"/>
187 <field name="partner_id"/>
188 <field name="street"/>
189 <field name="pts_id" invisible="1"/>
190 <field name="purchase_id" invisible="1"/>
191 <field name="sale_id" invisible="1"/>
192 <field name="dts_id"/>
193 <field name="min_date"/>
194 <field name="type"/>
195 <field name="state"/>
196 <field name="delivery_state"/>
197 <button name="%(delivery_routes.action_picking_get_order)d"
198 string="Related Order" type="action"
199 icon="terp-mail-forward"
200 attrs="{'invisible': [('purchase_id','=',None),('sale_id','=',None)]}"
201 groups="base.group_user"/>
202 </tree>
203 </field>
204 </record>
205
206 <!-- Delivery Picking Search -->
207 <record id="view_picking_internal_search_extend" model="ir.ui.view">
208 <field name="name">stock.picking.internal.search.extend</field>
209 <field name="model">stock.picking</field>
210 <field name="arch" type="xml">
211 <search string="Internal Picking List">
212 <field name="name" string="Internal Picking List" filter_domain="['|',('name','ilike', self),('origin','ilike',self)]"/>
213 <filter icon="terp-go-today" name="for_past" string="Past" domain="[('min_date','&lt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for the Past"/>
214 <filter icon="terp-go-today" name="for_today" string="Today" domain="[('min_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('min_date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for Today"/>
215 <filter icon="terp-go-today" name="for_future" string="Future" domain="[('min_date','&gt;=',time.strftime('%%Y-%%m-%%d 23:59:59'))]" help="Orders planned for the Future"/>
216 <separator/>
217 <filter icon="terp-check" name="not_planned" string="Not Planned" domain="[('delivery_state','=','not_planned')]"/>
218 <filter icon="terp-check" name="delivery" string="In delivery" domain="[('delivery_state','=',['del_rt','in_del','in_del','in_del','planned'])]"/>
219 <filter icon="terp-check" name="delivered" string="Delivered" domain="[('delivery_state','=',['del_ok','del_ex','del_rt_exp'])]"/>
220 <separator/>
221 <filter icon="terp-check" name="available" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
222 <filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves"/>
223 <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Picking already processed"/>
224 <filter icon="terp-dialog-close" name="no_batch" string="No batch" domain="[('batch_id','=',None)]" help="Picking without batch"/>
225 <field name="partner_id"/>
226 <field name="batch_id"/>
227 <field name="product_id"/>
228 <field name="origin"/>
229 <field name="stock_journal_id"/>
230 <field name="pts_id" context="{'domain':[('type','=','pts')]}"/>
231 <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
232 <group expand="0" string="Group By...">
233 <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
234 <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
235 <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
236 <filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
237 <filter string="Batch" domain="[]" context="{'group_by':'batch_id'}"/>
238 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
239 <filter string="Preparation Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'pts_id'}"/>
240 <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_id'}"/>
241 <filter string="Delivery State" icon="terp-folder-orange" domain="[]" context="{'group_by':'delivery_state'}"/>
242 </group>
243 </search>
244 </field>
245 </record>
246
247 <record id="delivery_routes.action_delivery_routes_picking" model="ir.actions.act_window">
248 <field name="name">Delivery Pickings</field>
249 <field name="res_model">stock.picking</field>
250 <field name="type">ir.actions.act_window</field>
251 <field name="view_type">form</field>
252 <field name="view_id" ref="delivery_picking_tree"/>
253 <field name="view_mode">tree,form,calendar</field>
254 <field name="domain">[('type','in',['out','in']),('return','=','none'),('state','!=','cancel')]</field>
255 <field name="context">{'default_type': 'out', 'search_default_for_today':1, 'contact_display': 'partner_address'}</field>
256 <field name="search_view_id" ref="view_picking_internal_search_extend"/>
257 <field name="help" type="html">
258 <p class="oe_view_nocontent_create">
259 </p><p>
260 Pack selected delivery notes
261 </p>
262 </field>
263 </record>
264
265 <!-- picking batch Form view -->
266 <record id="picking_batch_view" model="ir.ui.view">
267 <field name="name">picking.batch.form</field>
268 <field name="model">picking.batch</field>
269 <field name="type">form</field>
270 <field name="arch" type="xml">
271 <form string="Picking Batch" version="7.0">
272 <group>
273 <field name="name"/>
274 <field name="active"/>
275 </group>
276 <field name="picking_ids"/>
277 </form>
278 </field>
279 </record>
280
281 <!-- picking batch Tree view -->
282 <record id="picking_batch_tree_view" model="ir.ui.view">
283 <field name="name">picking.batch.tree</field>
284 <field name="model">picking.batch</field>
285 <field name="arch" type="xml">
286 <tree string="Picking Batch">
287 <field name="name"/>
288 </tree>
289 </field>
290 </record>
291
292 <!-- picking batch action -->
293 <record id="action_picking_batch" model="ir.actions.act_window">
294 <field name="name">Picking Batch</field>
295 <field name="res_model">picking.batch</field>
296 <field name="type">ir.actions.act_window</field>
297 <field name="view_type">form</field>
298 <field name="view_mode">tree,form</field>
299 </record>
300
301 <!-- Delivery route kanban view -->
302 <record model="ir.ui.view" id="delivery_routes.delivery_route_line_kanban_view">
303 <field name="name">delivery.route.line.kanban</field>
304 <field name="model">delivery.route.line</field>
305 <field name="arch" type="xml">
306 <kanban version="7.0" default_group_by="route_id" quick_creatable="false">
307 <field name="dts_id"/>
308 <field name="picking_id"/>
309 <field name="route_id"/>
310 <field name="address_id"/>
311 <field name="customer_date"/>
312 <field name="street"/>
313 <field name="note"/>
314 <field name="vip"/>
315 <field name="sequence"/>
316 <field name="color"/>
317 <field name="state"/>
318 <templates>
319 <t t-name="kanban-box">
320 <div t-if="record.state.raw_value != 'draft'" t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click not_dragable">
321 <div class="oe_kanban_content">
322 <div>
323 <b><field name="origin"/></b> (<field name="delivered_cpt"/>)
324 <a t-if="record.vip.raw_value == 1" type="object" name="set_not_vip" class="oe_e oe_star_on">7</a>
325 <a t-if="record.vip.raw_value != 1" type="object" name="set_vip" class="oe_e oe_star_off">7</a>
326 </div>
327 <div>
328 <field name="address_id"/><br/>
329 <field name="street"/><br/>
330 <field name="customer_date"/><br/>
331 <div class="oe_ellipsis"><t t-raw="record.note.value"/></div>
332 </div>
333 </div>
334 <div class="oe_clear"></div>
335 </div>
336 <div t-if="record.state.raw_value == 'draft'" t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
337 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
338 <span class="oe_e">í</span>
339 <ul class="oe_dropdown_menu">
340 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
341 </ul>
342 </div>
343 <div class="oe_kanban_content">
344 <div>
345 <b><field name="origin"/></b> (<field name="delivered_cpt"/>)
346 <a t-if="record.vip.raw_value == 1" type="object" name="set_not_vip" class="oe_e oe_star_on">7</a>
347 <a t-if="record.vip.raw_value != 1" type="object" name="set_vip" class="oe_e oe_star_off">7</a>
348 </div>
349 <div>
350 <field name="address_id"/><br/>
351 <field name="street"/><br/>
352 <field name="customer_date"/>
353 <div class="oe_ellipsis"><t t-raw="record.note.value"/></div>
354 </div>
355 </div>
356 <div class="oe_clear"></div>
357 </div>
358 </t>
359 </templates>
360 </kanban>
361 </field>
362 </record>
363
364 <record id="delivery_routes.view_delivery_route_line_form" model="ir.ui.view">
365 <field name="name">delivery.route.line.form</field>
366 <field name="model">delivery.route.line</field>
367 <field name="arch" type="xml">
368 <form string="Delivery Route Line" version="7.0">
369 <header>
370 <!--button name="action_draft" string="Draft" type="object" states="cancel"/-->
371 <!--button name="action_confirm" string="Confirm" class="oe_highlight" type="object" states="draft"/-->
372 <!--button name="action_delivered" string="In delivery" type="object" class="oe_highlight" states="confirm"/-->
373 <button name="action_received" string="Received" type="object" class="oe_highlight" states="delivered" groups="delivery_routes.group_delivery_manager"/>
374 <button name="action_received_exp" string="Received with exception" type="object" states="delivered" groups="delivery_routes.group_delivery_manager"/>
375 <button name="action_returned" string="Returned" type="object" states="delivered" groups="delivery_routes.group_delivery_manager"/>
376 <button name="action_returned_exp" string="Returned, no Delivery" type="object" states="delivered" groups="delivery_routes.group_delivery_manager"/>
377 <button name="action_cancel" string="Cancel" type="object" states="confirm" groups="delivery_routes.group_delivery_user"/>
378 <field name="state" widget="statusbar" statusbar_visible="draft,confirm,delivered,received,returned,cancel" statusbar_colors='{"received":"green","returned":"red","delivered":"blue"}'/>
379 </header>
380 <sheet>
381 <group colspan="4" col="4">
382 <field name="sequence" attrs="{'readonly':[('state','not in',['draft'])]}"/>
383 <field name="route_id" attrs="{'readonly':[('state','not in',['draft'])]}"/>
384 <field name="address_id" readonly="1"/>
385 <field name="dts_id" domain="[('type','=','dts')]"/>
386 <!--field name="origin"/-->
387 <field name="street" readonly="1"/>
388 <field name="picking_id" domain="[('return','=','none'),('delivery_state','in',['not_planned','del_rt']),('type','in',['in','out']),('state','!=','cancel')]"/>
389 <field name="so_payment_method" readonly="1"/>
390 <field name="box_type"/>
391 <field name="visit_date"/>
392 <field name="driver" readonly="1"/>
393 <field name="purchase_id" attrs="{'invisible':[('purchase_id','=',False)]}"/>
394 <field name="sale_order_id" attrs="{'invisible':[('sale_order_id','=',False)]}"/>
395 <field name="exceptions" invisible="1"/>
396 <group colspan="4" col="1" attrs="{'invisible':[('exceptions','=',False),('state','not in',['returned'])]}">
397 <separator string="Return Reasons"/>
398 <field name="return_reasons" nolabel="1">
399 <tree editable="bottom">
400 <field name="type"/>
401 <field name="reason"/>
402 </tree>
403 </field>
404 </group>
405 <group colspan="4" col="2">
406 <separator string="Notes"/>
407 <separator string="DO Notes"/>
408 </group>
409 <group colspan="4" col="2">
410 <field name="note" nolabel="1"/>
411 <field name="picking_note" nolabel="1" readonly="1"/>
412 </group>
413 </group>
414 </sheet>
415 </form>
416 </field>
417 </record>
418
419 <record id="view_delivery_route_line_tree_elico" model="ir.ui.view">
420 <field name="name">delivery.route.line.tree_elico</field>
421 <field name="model">delivery.route.line</field>
422 <field name="inherit_id" ref="delivery_routes.view_delivery_route_line_tree"/>
423 <field name="arch" type="xml">
424 <xpath expr="//field[@name='origin']" position="after">
425 <field name="dts_id"/>
426 <field name="dts_name" invisible="1"/>
427 <field name="customer_date"/>
428 </xpath>
429 <xpath expr="//field[@name='note']" position="after">
430 <field name="amount_received" groups="account.group_account_user" sum="Total Received"/>
431 <field name="account_checked" string="OK" groups="account.group_account_user"/>
432 <field name="account_remark" string="Acc. Notes" groups="account.group_account_user"/>
433 </xpath>
434 </field>
435 </record>
436 <record id="delivery_routes.view_delivery_line_search" model="ir.ui.view">
437 <field name="name">delivery.route.line.search_elico</field>
438 <field name="model">delivery.route.line</field>
439 <field name="arch" type="xml">
440 <search string="Delivery Line">
441 <field name="picking_id" />
442 <field name="address_id" />
443 <field name="origin" />
444 <filter name="no_route" string="no route" domain="[('route_id','=',None)]" help="line without route" />
445 <filter icon="terp-go-today" string="Today" domain="[('route_id.date','=',time.strftime('%%Y-%%m-%%d'))]" help="Delivery for Today" name="today"/>
446 <group expand="0" string="Group By...">
447 <filter string="Route" icon="terp-folder-orange" domain="[]" context="{'group_by':'route_id'}"/>
448 <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_name'}"/>
449 <filter string="State" icon="terp-folder-orange" domain="[]" context="{'group_by':'state'}"/>
450 </group>
451 </search>
452 </field>
453 </record>
454
455 <!--record model="ir.ui.view" id="delivery_route_address_kanban_view">
456 <field name="name">delivery.route.address.kanban</field>
457 <field name="model">delivery.route.line</field>
458 <field name="arch" type="xml">
459 <kanban version="7.0">
460 <field name="dts_id"/>
461 <field name="picking_id"/>
462 <field name="route_id"/>
463 <field name="address_id"/>
464 <field name="note"/>
465 <field name="sequence"/>
466 <templates>
467 <t t-name="kanban-box">
468 <div t-attf-class="oe_kanban_card oe_kanban_global_click">
469 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
470 <span class="oe_e">í</span>
471 <ul class="oe_dropdown_menu">
472 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
473 <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
474 </ul>
475 </div>
476 <div class="oe_kanban_content">
477 <div><b><field name="street"/></b></div>
478 </div>
479 <div class="oe_clear"></div>
480 </div>
481 </t>
482 </templates>
483 </kanban>
484 </field>
485 </record-->
486
487
488 <record id="action_delivery_return_type" model="ir.actions.act_window">
489 <field name="name">Return Reason Type</field>
490 <field name="type">ir.actions.act_window</field>
491 <field name="res_model">delivery.return.type</field>
492 <field name="view_type">form</field>
493 <field name="view_mode">tree,form</field>
494 </record>
495 <menuitem action="action_delivery_return_type" id="menu_action_delivery_return_type" parent="delivery_routes.menu_delivery_config" sequence="99"/>
496
497
498 <menuitem name="Delivery Payments"
499 id="menu_delivery_delivery_payment"
500 parent="delivery_routes.menu_delivery_root"
501 groups="delivery_routes.group_customer_service_user,account.group_account_user"
502 sequence="5"/>
503
504
505 <record id="view_delivery_route_form_cs" model="ir.ui.view">
506 <field name="name">delivery.route.form_CS</field>
507 <field name="model">delivery.route</field>
508 <field name="priority">17</field>
509 <field name="arch" type="xml">
510 <form string="Delivery Route" version="7.0">
511 <header>
512 <button name="set_confirm_cs" string="Confirm CS" type="object" class="oe_highlight" groups="delivery_routes.group_customer_service_user" attrs="{'invisible':[('confirm_cs','=',True)]}"/>
513 <button name="action_done" string="Done" type="object" class="oe_highlight" states="departure" groups="account.group_account_user"/>
514 <field name="state" widget="statusbar" statusbar_visible="draft,confirm,departure,done,cancel" statusbar_colors='{"done":"green","cancel":"red","departure":"blue"}'/>
515 </header>
516 <sheet>
517 <group colspan="4" col="4">
518 <field name="name" readonly="1"/>
519 <field name="date" readonly="1"/>
520 <field name="departure_date" readonly="1"/>
521 <field name="arrive_date"/>
522 <field name="dts_id" readonly="1"/>
523 <newline />
524 <field name="driver_id" readonly="1"/>
525 <field name="picker_id" readonly="1"/>
526 <field name="confirm_cs" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('state','not in',['confirm','draft'])]}"/>
527 <newline />
528 <field name="line_ids" colspan="4" nolabel="1">
529 <tree editable="bottom" create="false" delete="false">
530 <field name="origin"/>
531 <field name="amount_total" sum="Total"/>
532 <field name="amount_unpaid" sum="Total Unpaid"/>
533 <field name="adjustment" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}" sum="Total Adjustment"/>
534 <field name="cs_remark" string="CS Notes" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}"/>
535 <field name="to_be_received" sum="Total to be received" string="To be Rec."/>
536 <field name="amount_received" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}" sum="Total Received"/>
537 <field name="account_checked" string="OK" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
538 <field name="account_remark" string="Acc. Notes" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
539 <field name="complete_state" string="State" readonly="1"/>
540 <field name="state" invisible="1"/>
541 <field name="confirm_cs" invisible="1"/>
542 </tree>
543 </field>
544 </group>
545 </sheet>
546 </form>
547 </field>
548 </record>
549 <record id="view_delivery_route_tree_cs" model="ir.ui.view">
550 <field name="name">delivery.route.tree_cs</field>
551 <field name="model">delivery.route</field>
552 <field name="type">tree</field>
553 <field name="arch" type="xml">
554 <tree string="Delivery Routes">
555 <field name="name"/>
556 <field name="date"/>
557 <field name="dts_id"/>
558 <field name="departure_date"/>
559 <field name="arrive_date"/>
560 <field name="state"/>
561 </tree>
562 </field>
563 </record>
564 <record id="view_delivery_search_cs" model="ir.ui.view">
565 <field name="name">delivery.route.search_cs</field>
566 <field name="model">delivery.route</field>
567 <field name="arch" type="xml">
568 <search string="Delivery Route">
569 <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
570 <field name="date"/>
571 <filter icon="terp-go-today" string="Today" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]" help="Delivery Route for Today" name="today"/>
572 <group expand="0" string="Group By...">
573 <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_id'}"/>
574 </group>
575 </search>
576 </field>
577 </record>
578 <record id="action_delivery_route_form_cs" model="ir.actions.act_window">
579 <field name="name">Delivery Route CS</field>
580 <field name="type">ir.actions.act_window</field>
581 <field name="res_model">delivery.route</field>
582 <field name="view_type">form</field>
583 <field name="view_mode">tree,form</field>
584 <field name="context">{'active_test':False,'search_default_today':True,'force_update':True}</field>
585 <field name="search_view_id" ref="view_delivery_search_cs"/>
586 </record>
587 <record id="action_delivery_route_form_form_cs" model="ir.actions.act_window.view">
588 <field name="view_mode">form</field>
589 <field name="sequence">2</field>
590 <field name="view_id" ref="view_delivery_route_form_cs"/>
591 <field name="act_window_id" ref="action_delivery_route_form_cs"/>
592 </record>
593 <record id="action_delivery_route_form_tree_cs" model="ir.actions.act_window.view">
594 <field name="view_mode">tree</field>
595 <field name="sequence">1</field>
596 <field name="view_id" ref="view_delivery_route_tree_cs"/>
597 <field name="act_window_id" ref="action_delivery_route_form_cs"/>
598 </record>
599 <menuitem action="action_delivery_route_form_cs" id="menu_action_delivery_route_form_cs" parent="menu_delivery_delivery_payment" sequence="1" groups="delivery_routes.group_customer_service_user,account.group_account_user"/>
600
601 <record id="view_delivery_line_tree_cs" model="ir.ui.view">
602 <field name="name">delivery.route.line.tree_cs</field>
603 <field name="model">delivery.route.line</field>
604 <field name="type">tree</field>
605 <field name="arch" type="xml">
606 <tree string="Delivery Route Lines" editable="bottom" create="false" delete="false">
607 <field name="origin" readonly="1"/>
608 <field name="dts_id" readonly="1"/>
609 <field name="dts_name" invisible="1"/>
610 <field name="route_id" invisible="1"/>
611 <field name="address_id" readonly="1"/>
612 <field name="amount_total" sum="Total"/>
613 <field name="amount_unpaid" sum="Total Unpaid"/>
614 <field name="adjustment" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}" sum="Total Adjustment"/>
615 <field name="cs_remark" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}"/>
616 <field name="to_be_received" sum="Total to be received"/>
617 <field name="amount_received" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}" sum="Total Received"/>
618 <field name="account_checked" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
619 <field name="account_remark" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
620 <field name="complete_state" readonly="1"/>
621 <field name="state" invisible="1"/>
622 <field name="confirm_cs" invisible="1"/>
623 </tree>
624 </field>
625 </record>
626 <record id="view_delivery_line_search_cs" model="ir.ui.view">
627 <field name="name">delivery.route.search_cs</field>
628 <field name="model">delivery.route.line</field>
629 <field name="arch" type="xml">
630 <search string="Delivery Route">
631 <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
632 <field name="origin"/>
633 <filter icon="terp-go-today" string="Today" domain="[('route_id.date','=',time.strftime('%%Y-%%m-%%d'))]" help="Delivery Route for Today" name="today"/>
634 <group expand="0" string="Group By...">
635 <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_name'}"/>
636 </group>
637 </search>
638 </field>
639 </record>
640 <record id="action_delivery_line_form_cs" model="ir.actions.act_window">
641 <field name="name">Delivery Route Line CS</field>
642 <field name="type">ir.actions.act_window</field>
643 <field name="res_model">delivery.route.line</field>
644 <field name="view_type">form</field>
645 <field name="view_mode">tree</field>
646 <field name="context">{'active_test':False,'search_default_today':True,'force_update':True}</field>
647 <field name="search_view_id" ref="view_delivery_line_search_cs"/>
648 </record>
649 <record id="action_delivery_line_form_tree_cs" model="ir.actions.act_window.view">
650 <field name="view_mode">tree</field>
651 <field name="sequence">1</field>
652 <field name="view_id" ref="view_delivery_line_tree_cs"/>
653 <field name="act_window_id" ref="action_delivery_line_form_cs"/>
654 </record>
655 <menuitem action="action_delivery_line_form_cs" id="menu_action_delivery_line_form_cs" parent="menu_delivery_delivery_payment" sequence="99" groups="delivery_routes.group_customer_service_user,account.group_account_user"/>
656
657
658
659
660
661
662 <!-- Menu -->
663 <!--
664 <menuitem action="action_picking_batch" name="Picking Batch"
665 id="menu_action_picking_batch"
666 parent="delivery_routes.menu_delivery_delivery" sequence="9"/>
667 -->
668
669 <!-- picking Form view -->
670 <!--
671 <record model='ir.ui.view' id='picking_batch_form_view'>
672 <field name='name'>Delivery Routes Picking Form Inherit</field>
673 <field name='model'>stock.picking</field>
674 <field name='inherit_id' ref='stock.view_picking_form'/>
675 <field name='type'>form</field>
676 <field name="priority" eval="2"/>
677 <field name='arch' type='xml'>
678 <field name="move_type" position="after">
679 <field name="batch_id" />
680 <field name="pts_id" domain="[('type','=','pts'),('active','=',True)]"/>
681 <field name="route_line_id"/>
682 <field name="delivery_date"/>
683 <field name="route_state"/>
684 <field name="delivered"/>
685 </field>
686 </field>
687 </record>
688 <menuitem action="action_picking_pack_tree" name="Delivery Picking"
689 id="menu_action_picking_pack"
690 parent="delivery_routes.menu_delivery_delivery" sequence="10"/>
691 -->
692 <!-- Menu -->
693 </data>
694</openerp>
0695
=== added directory 'delivery_plan/wizard'
=== added file 'delivery_plan/wizard/__init__.py'
--- delivery_plan/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/wizard/__init__.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import stock
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
026
=== added file 'delivery_plan/wizard/stock.py'
--- delivery_plan/wizard/stock.py 1970-01-01 00:00:00 +0000
+++ delivery_plan/wizard/stock.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,503 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
6# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import threading
24from openerp import netsvc
25from openerp import pooler
26from openerp import tools
27from openerp.tools.translate import _
28from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
29from osv import osv, fields
30from datetime import datetime
31from dateutil.relativedelta import relativedelta
32import math
33import pytz
34import logging
35logger = logging.getLogger(__name__)
36
37
38class delivery_dts_to_routes(osv.osv_memory):
39 _name = 'delivery.dts_to_routes'
40
41 def _init_dts_id(self, cr, uid, context=None):
42 last_dts = self.pool.get('res.users').read(cr, 1, [uid], ['dts_id'])[0]['dts_id']
43 if last_dts:
44 ids = self.pool.get('delivery.time').search(cr, uid, [('id', '=', last_dts[0])])
45 else:
46 now = datetime.now()
47 ids = self.pool.get('delivery.time').search(cr, uid, [('type', '=', 'dts'), ('active', '=', True), ('name', 'ilike', datetime.strftime(now, '%y%m%d') + '%')])
48 return ids and ids[0] or False
49
50 _columns = {
51 'dts_id': fields.many2one('delivery.time', 'Delivery Time', select=True, required=True, domain=[('type', '=', 'dts'), ('active', '=', True)]),
52 }
53 _defaults = {
54 'dts_id': lambda self, cr, uid, context: self._init_dts_id(cr, uid, context=context),
55 }
56
57 def generate_routes(self, cr, uid, ids, context=None):
58 context = context or {}
59 route_obj = self.pool.get('delivery.route')
60 line_obj = self.pool.get('delivery.route.line')
61
62 if ids:
63 data = self.browse(cr, uid, ids)[0]
64 else:
65 data = self.pool.get('delivery.time').browse(cr, 1, context['wiz_dts_id'])
66 self.pool.get('res.users').write(cr, 1, [uid], {'dts_id':data.dts_id.id})
67
68 color2routes = {}
69 line_ids = line_obj.search(cr, uid, [("dts_id", "=", data.dts_id.id)], order="color")
70 for line in line_obj.browse(cr, uid, line_ids):
71 route_id = False
72 base_name = data.dts_id.name.split()[0]
73 if line.color > 0:
74 line_color = str(line.color).rjust(2, '0')
75 if line_color in color2routes:
76 route_id = color2routes[line_color]
77 else:
78 route_ids = route_obj.search(cr, uid, [('name', '=', base_name + str(line_color))], context=context)
79 route_id = route_ids and route_ids[0] or False
80 color2routes.update({line_color: route_id})
81
82 if not route_id:
83 route_id = route_obj.create(cr, uid, {
84 'name': base_name + str(line_color),
85 'date': data.dts_id.start_date and data.dts_id.start_date.split() and data.dts_id.start_date.split()[0] or False,
86 'dts_id': data.dts_id.id,
87 'departure_date': data.dts_id.start_date or False,
88 'arrive_date': data.dts_id.end_date or False,
89 })
90 color2routes.update({line_color: route_id})
91 line_obj.write(cr, uid, [line.id], {'route_id':route_id}, context={'force_update':1})
92
93 #domain = ['&','|','&',('picking_id.type','=','in'),'&',('picking_id.state','=','assigned'),("picking_id.is_collected","=",True),'&',('picking_id.type','=','out'),("picking_id.state","not in",["cancel"]),'|',("route_id","in",tuple(route_ids)),("route_id","=",None)]
94 domain = ['&','|','&',('picking_id.type','=','in'),'&',('picking_id.state','=','assigned'),("picking_id.is_collected","=",True),'&',('picking_id.type','=','out'),("picking_id.state","not in",["cancel"]),("dts_id","=",data.dts_id.id)]
95
96 return {
97 'type': 'ir.actions.act_window',
98 'res_model':'delivery.route.line',
99 'view_type':'form',
100 'view_mode':'kanban,form',
101 'context':"{'update_color':1,'view_name':'delivery.route.line.kanban','force_dts_id_kanban': %s}" % data.dts_id.id,
102 'domain': domain,
103 }
104delivery_dts_to_routes()
105
106
107class delivery_dts_to_vans(osv.osv_memory):
108 _name = 'delivery.dts_to_vans'
109
110 def _init_dts_id(self, cr, uid, context=None):
111 last_dts = self.pool.get('res.users').read(cr, 1, [uid], ['dts_id'])[0]['dts_id']
112 if last_dts:
113 ids = self.pool.get('delivery.time').search(cr, uid, [('id', '=', last_dts[0])])
114 else:
115 now = datetime.now()
116 ids = self.pool.get('delivery.time').search(cr, uid, [('type', '=', 'dts'), ('active', '=', True), ('name', 'ilike', datetime.strftime(now, '%y%m%d') + '%')])
117 return ids and ids[0] or False
118
119 _columns = {
120 'dts_id': fields.many2one('delivery.time', 'Delivery Time', select=True, required=True, domain=[('type', '=', 'dts'), ('active', '=', True)]),
121 }
122 _defaults = {
123 'dts_id': lambda self, cr, uid, context: self._init_dts_id(cr, uid, context=context),
124 }
125
126 def open_kanban(self, cr, uid, ids, context=None):
127 if ids:
128 data = self.browse(cr, uid, ids)[0]
129 else:
130 data = self.pool.get('delivery.time').browse(cr, 1, context['wiz_dts_id'])
131 self.pool.get('res.users').write(cr, 1, [uid], {'dts_id':data.dts_id.id})
132 #domain = [("picking_id.state", "!=", "cancel"), ("picking_id.type", "in", ["in", "out"]), ("dts_id", "=", data.dts_id.id)]
133 domain = ['&','|','&',('picking_id.type','=','in'),'&',('picking_id.state','=','assigned'),("picking_id.is_collected","=",True),'&',('picking_id.type','=','out'),("picking_id.state","not in",["cancel"]),("dts_id","=",data.dts_id.id)]
134
135 return {
136 'type': 'ir.actions.act_window',
137 'res_model':'delivery.route.line',
138 'view_type':'form',
139 'view_mode':'kanban,form',
140 'context':"{'view_name':'delivery.route.line.kanban_fc','sorting':'neighborhood,street,picking_id','check4color':" + str(data.dts_id.id) + "}",
141 'domain': domain,
142 }
143delivery_dts_to_vans()
144
145
146
147class delivery_driver_for_routes(osv.osv_memory):
148 _name = 'delivery.driver_for_routes'
149
150 def _init_dts_id(self, cr, uid, context=None):
151 last_dts = self.pool.get('res.users').read(cr, 1, [uid], ['dts_id'])[0]['dts_id']
152 if last_dts:
153 ids = self.pool.get('delivery.time').search(cr, uid, [('id', '=', last_dts[0])])
154 else:
155 now = datetime.now()
156 ids = self.pool.get('delivery.time').search(cr, uid, [('type', '=', 'dts'), ('active', '=', True), ('name', 'ilike', datetime.strftime(now, '%y%m%d') + '%')])
157 return ids and ids[0] or False
158
159 _columns = {
160 'dts_id': fields.many2one('delivery.time', 'Delivery Time', select=True, required=True, domain=[('type', '=', 'dts'), ('active', '=', True)]),
161 #'action': fields.selection([('driver_id','Driver'),('picker_id','Deliver')], string="Choose", required=True),
162 }
163 _defaults = {
164 'dts_id': lambda self, cr, uid, context: self._init_dts_id(cr, uid, context=context),
165 #'action': lambda *a: 'driver_id',
166 }
167
168 def open_kanban(self, cr, uid, ids, context=None):
169 if ids:
170 data = self.browse(cr, uid, ids)[0]
171 else:
172 data = self.pool.get('delivery.time').browse(cr, 1, context['wiz_dts_id'])
173 self.pool.get('res.users').write(cr, 1, [uid], {'dts_id':data.dts_id.id})
174 driver_pool = self.pool.get('delivery.driver')
175 route_tmp_pool = self.pool.get('delivery.route_tmp')
176 route_pool = self.pool.get('delivery.route')
177
178 #cr.execute("DELETE FROM delivery_route_tmp WHERE dts_id=" + data.dts_id.id + " ")
179 cr.execute("DELETE FROM delivery_route_tmp")
180 cr.execute("UPDATE delivery_driver SET tmp_route_id = Null")
181 cr.commit()
182
183 route_ids = route_pool.search(cr, uid, [('dts_id', '=', data.dts_id.id)]) or []
184 for route in route_pool.browse(cr, uid, route_ids):
185 route_tmp_id = route_tmp_pool.create(cr, uid, {'dts_id': data.dts_id.id, 'route_id': route.id, 'name': route.name})
186 if route.driver_id:
187 driver_pool.write(cr, uid, [route.driver_id.id], {'tmp_route_id': route_tmp_id})
188 if route.picker_id:
189 driver_pool.write(cr, uid, [route.picker_id.id], {'tmp_route_id': route_tmp_id})
190
191 return {
192 'type': 'ir.actions.act_window',
193 'res_model':'delivery.driver',
194 'view_type':'tree',
195 'view_mode':'kanban',
196 'context':"{'force_dts_id': %s}" % (data.dts_id.id),
197 }
198delivery_driver_for_routes()
199
200
201class delivery_change_dts(osv.osv_memory):
202 _name = 'delivery.change.dts'
203 _description = 'Change DTS / PTS'
204
205 _columns = {
206 'action': fields.selection([('cleanup', 'Blank DTS/PTS'), ('change', 'Change DTS/PTS')], string='Action', required=True),
207 'dts_id': fields.many2one('delivery.time', 'Delivery Time', domain=[('type', '=', 'dts')]),
208 'pts_id': fields.many2one('delivery.time', 'Preparation Time', domain=[('type', '=', 'pts')]),
209 }
210 _defaults = {
211 'action': 'change',
212 }
213
214
215 def dts_id_change(self, cr, uid, ids, dts_id, pts_id, context=None):
216 context = context or {}
217 new_pts_id = False
218
219 if pts_id and dts_id:
220 pts_pool = self.pool.get('delivery.time')
221 pts = pts_pool.browse(cr, uid, [pts_id])[0]
222 if pts.dts_id.id == dts_id:
223 new_pts_id = pts_id
224 return {'value': {'pts_id': new_pts_id}}
225
226
227 def change_dts(self, cr, uid, ids, context=None):
228 context = context or {}
229 context.update({'update_pts':1})
230 pick_ids = context.get('active_ids', False) or context.get('active_id', False) or []
231 if pick_ids and type(pick_ids) != type([]):
232 pick_ids = [pick_ids]
233
234 if pick_ids:
235 move_pool = self.pool.get('stock.move')
236 pick_pool = self.pool.get('stock.picking')
237 this = self.browse(cr, uid, ids[0], context=context)
238
239 if this.action == 'cleanup':
240 pts_id = False
241 dts_id = False
242 else:
243 dts_id = this.dts_id and this.dts_id.id or False
244 if dts_id:
245 pts_id = this.pts_id and this.pts_id.id or False
246 else:
247 pts_id = False
248
249 for pick in pick_pool.browse(cr, uid, pick_ids):
250 if pick.state not in ['cancel'] and pick.delivery_state in ["not_planned", "del_rt", ""]:
251 pick_pool.write(cr, uid, [pick.id], {'pts_id':pts_id, 'dts_id':dts_id}, context=context)
252 return {'type': 'ir.actions.act_window_close'}
253
254delivery_change_dts()
255
256
257
258########## TO BE DELETED ASAP ###############
259class dts_reset(osv.osv):
260 _name = 'dts.reset'
261
262 def resetall(self, cursor, uid, context=None):
263 logger.warning('################ START ################')
264 picking_obj = self.pool.get('stock.picking')
265 delivery_obj = self.pool.get('delivery.route.line')
266
267 cr2 = pooler.get_db(cursor.dbname).cursor()
268 cr2.execute("SELECT DISTINCT picking_id FROM delivery_route_line WHERE picking_id is not null")
269 pick_ids = map(lambda x: x[0], cr2.fetchall())
270 picking_ids = picking_obj.search(cr2, uid, [('id','not in',pick_ids),('state','not in',['cancel']),('type','in',['in','out'])])
271 for sp in picking_ids:
272 delivery_obj.create(cr2, uid, {'picking_id':sp, })
273 cr2.commit()
274 logger.warning('#### %s done #### '%sp)
275 #cancel picking canceled
276 logger.warning('################ DONE ################')
277 cr2.close()
278
279 """
280 logger.warning('################ START ################')
281 tz = pytz.timezone('Asia/Shanghai')
282 tz2 = pytz.timezone('America/Anchorage')
283 move_obj = self.pool.get('stock.move')
284 picking_obj = self.pool.get('stock.picking')
285 procurement_obj = self.pool.get('procurement.order')
286 delivery_time_obj = self.pool.get('delivery.time')
287 time_slot_obj = self.pool.get('delivery.time.slot')
288 so_pool = self.pool.get('sale.order')
289
290 use_new_cursor = cursor.dbname
291 cr = pooler.get_db(use_new_cursor).cursor()
292 cr2 = pooler.get_db(use_new_cursor).cursor()
293 cr3 = pooler.get_db(use_new_cursor).cursor()
294
295 cr2.execute("SELECT DISTINCT sale_id FROM stock_picking WHERE sale_id is not null AND sale_id > 0")
296 ids_from_pick = map(lambda x: x[0], cr2.fetchall())
297 so_ids = so_pool.search(cr3, uid, [('id','not in',ids_from_pick)])
298
299 cpt_commit = 1
300 for order in so_pool.browse(cr3, uid, so_ids):
301 val = {}
302 dts = False
303 pts = False
304 pt_id = False
305 dt_id = False
306 min_date = False
307 slot_id = False
308
309 try:
310 now = datetime.now()
311 address = order.partner_shipping_id or order.partner_id or False
312
313 if order.start_date:
314 min_date = order.start_date
315 dts = order.start_date
316 dts = datetime.strptime(dts, '%Y-%m-%d %H:%M:%S')
317 dts = pytz.utc.localize(dts).astimezone(tz)
318 if order.cdate:
319 pts = datetime.strptime(order.cdate, '%Y-%m-%d %H:%M:%S')
320 pts = pytz.utc.localize(pts).astimezone(tz)
321 elif order.date_order:
322 pts = datetime.strptime(order.date_order, '%Y-%m-%d')
323 pts = pytz.utc.localize(pts).astimezone(tz)
324 if not pts:
325 pts = dts
326
327 if dts:
328 start_date = datetime.strftime(dts, '%Y-%m-%d')
329 if address and (not address.city or address.city.lower() in ['shanghai']):
330 from_time = datetime.strftime(dts, '%H:%M')
331 else:#eg: in Nanjing
332 from_time = '09:30'
333 name = datetime.strftime(dts, '%y%m%d')
334 name_pts = name
335 start_date_pts = start_date
336
337 slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'dts')], order='max_time')
338 if slot_ids:
339 slot = time_slot_obj.browse(cr, uid, slot_ids[0])
340 name += slot.name
341 end_date = start_date + ' ' + slot.end_time
342 start_date += ' ' + slot.start_time
343 start_date = datetime.strptime(start_date, '%Y-%m-%d %H:%M')
344 start_date = pytz.utc.localize(start_date).astimezone(tz2)
345 start_date = datetime.strftime(start_date, '%Y-%m-%d %H:%M')
346 end_date = datetime.strptime(end_date, '%Y-%m-%d %H:%M')
347 end_date = pytz.utc.localize(end_date).astimezone(tz2)
348 end_date = datetime.strftime(end_date, '%Y-%m-%d %H:%M')
349
350 cr2.execute("SELECT id FROM delivery_time WHERE name='" + name + "' AND type='dts' AND slot_id='" + str(slot.id) + "'")
351 dt_ids = map(lambda x: x[0], cr2.fetchall())
352 if dt_ids:
353 dt_id = dt_ids[0]
354 else:
355 dt_id = delivery_time_obj.create(cr3, uid, {
356 'name':name,
357 'start_date': start_date,
358 'end_date': end_date,
359 'active': True,
360 'type': 'dts',
361 'slot_id': slot.id,
362 }, context)
363 cr3.commit()
364 cr2.commit()
365
366 if pts and dt_id:
367 date_pts = datetime.strftime(pts, '%Y-%m-%d')
368 from_time = datetime.strftime(pts, '%H:%M')
369 if date_pts < datetime.strftime(dts, '%Y-%m-%d'):
370 date_pts = datetime.strftime(dts, '%Y-%m-%d')
371 from_time = '00:00'
372
373 pts_slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'pts'), ('dts_id', '=', slot.id)], order='max_time')
374 if pts_slot_ids:
375 pts_slot = time_slot_obj.browse(cr, uid, pts_slot_ids[0])
376 name_pts += pts_slot.name
377 end_date_pts = start_date_pts + ' ' + pts_slot.end_time
378 start_date_pts += ' ' + pts_slot.start_time
379 start_date_pts = datetime.strptime(start_date_pts, '%Y-%m-%d %H:%M')
380 start_date_pts = pytz.utc.localize(start_date_pts).astimezone(tz2)
381 start_date_pts = datetime.strftime(start_date_pts, '%Y-%m-%d %H:%M')
382 end_date_pts = datetime.strptime(end_date_pts, '%Y-%m-%d %H:%M')
383 end_date_pts = pytz.utc.localize(end_date_pts).astimezone(tz2)
384 end_date_pts = datetime.strftime(end_date_pts, '%Y-%m-%d %H:%M')
385
386 cr2.execute("SELECT id FROM delivery_time WHERE name='" + name_pts + "' AND type='pts' AND slot_id='" + str(pts_slot.id) + "'")
387 pt_ids = map(lambda x: x[0], cr2.fetchall())
388 if pt_ids:
389 pt_id = pt_ids[0]
390 else:
391 pt_id = delivery_time_obj.create(cr3, uid, {
392 'name':name_pts,
393 'start_date': start_date_pts,
394 'end_date': end_date_pts,
395 'active': True,
396 'type': 'pts',
397 'slot_id': pts_slot.id,
398 'dts_id': dt_id,
399 }, context)
400 cr3.commit()
401 cr2.commit()
402 val['pts_id'] = pt_id
403 if not pt_id:
404 val['pts_id'] = False
405 if not dt_id:
406 val['dts_id'] = False
407
408 if val:
409 so_pool.write(cr2, 1, [order.id], val)
410
411 ##################################################
412 #cr2.execute("SELECT DISTINCT id FROM stock_picking WHERE sale_id = "+ str(order.id) +"")
413 #pick_ids = map(lambda x: x[0], cr2.fetchall()) or []
414 #if pick_ids and val:
415 # picking_obj.write(cr2, uid, pick_ids, val)
416 ##################################################
417
418 cpt_commit += 1
419 if cpt_commit >= 30:
420 cr2.commit()
421 cr3.commit()
422 cr.commit()
423 cpt_commit = 1
424 except Exception as err:
425 logger.warning('>>> Error during SO %s : %s' % (order.id, err))
426 ##################################################
427 # We update the old wrong start_date and end_date in delivery.time
428 #delivery_time_obj = self.pool.get('delivery.time')
429 #cr.execute("SELECT id FROM delivery_time WHERE id<16613 and start_date is not null and end_date is not null")
430 #delivery_ids = map(lambda x: x[0], cr.fetchall()) or []
431 #for delivery in delivery_time_obj.browse(cr, 1, delivery_ids):
432 # delivery_start = datetime.strptime(delivery.start_date, '%Y-%m-%d %H:%M:%S')
433 # delivery_start = pytz.utc.localize(delivery_start).astimezone(tz2)
434 #
435 # delivery_end = datetime.strptime(delivery.end_date, '%Y-%m-%d %H:%M:%S')
436 # delivery_end = pytz.utc.localize(delivery_end).astimezone(tz2)
437 #
438 # delivery_time_obj.write(cr2, 1, [delivery.id], {'start_date':delivery_start,'end_date':delivery_end})
439 # cr2.commit()
440 ##################################################
441 cr.close()
442 cr2.close()
443 cr3.close()
444 logger.warning('################ DONE ################')
445 """
446 return
447dts_reset()
448
449class delivery_reset(osv.osv_memory):
450 _name = 'delivery.reset'
451
452 def go(self, cr, uid, ids, context=None):
453 context = context or {}
454 use_new_cursor = cr.dbname
455 threaded_calculation = threading.Thread(target=self.pool.get('dts.reset').resetall, args=(cr, uid, context))
456 threaded_calculation.start()
457 return {'type': 'ir.actions.act_window_close'}
458delivery_reset()
459
460#class add_picking_pack(osv.osv_memory):
461# _name='add.picking.pack'
462#
463# _columns = {
464# }
465#
466# def confirm_add(self, cr, uid, ids, context=None):
467# picking_ids = context['active_ids']
468#
469# sequence_obj = self.pool.get('ir.sequence')
470# picking_obj = self.pool.get('stock.picking')
471# move_obj = self.pool.get('stock.move')
472# ul_obj = self.pool.get('product.ul')
473# batch_obj = self.pool.get('picking.batch')
474# tracking_obj = self.pool.get('stock.tracking')
475#
476# batch_id = batch_obj.create(cr, uid, {
477# 'name': sequence_obj.get(cr, uid, 'picking.batch')
478# },context=context)
479#
480# for picking in picking_obj.browse(cr, uid, picking_ids, context):
481# picking_obj.write(cr, uid, [picking.id,], {'batch_id':batch_id})
482# for line in picking.move_lines :
483# tracking_ids = tracking_obj.search(cr, uid, [
484# ('picking_id','=',picking.id),
485# ('ul_id','=',line.product_id.ul_id and line.product_id.ul_id.id or False)],context=context)
486# if tracking_ids :
487# tracking_id = tracking_ids[0]
488# else:
489# tracking_id = tracking_obj.create(cr, uid, {
490# 'name':'%s_%s' % (picking.name,line.product_id.ul_id.name),
491# 'picking_id':picking.id,
492# 'ul_id':line.product_id.ul_id and line.product_id.ul_id.id or False,
493# },
494# context=context)
495# move_obj.write(cr, uid,[line.id], {'tracking_id':tracking_id},context=context)
496#
497# return {
498# 'type': 'ir.actions.act_window_close',
499# }
500#
501#add_picking_pack()
502
503# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file504\ No newline at end of file
1505
=== added file 'delivery_plan/wizard/stock_view.xml'
--- delivery_plan/wizard/stock_view.xml 1970-01-01 00:00:00 +0000
+++ delivery_plan/wizard/stock_view.xml 2013-09-09 08:37:27 +0000
@@ -0,0 +1,463 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="view_dts_to_routes" model="ir.ui.view">
5 <field name="name">Prepare Routes for DTS</field>
6 <field name="model">delivery.dts_to_routes</field>
7 <field name="arch" type="xml">
8 <form string="Prepare Routes for DTS" version="7.0">
9 <field name="dts_id"/>
10 <footer>
11 <button name="generate_routes" string="Confirm" type="object" class="oe_highlight"/>
12 or
13 <button string="Cancel" class="oe_link" special="cancel"/>
14 </footer>
15 </form>
16 </field>
17 </record>
18 <record id="view_dts_to_vans" model="ir.ui.view">
19 <field name="name">Prepare Vans for DTS</field>
20 <field name="model">delivery.dts_to_vans</field>
21 <field name="arch" type="xml">
22 <form string="Prepare Vans for DTS" version="7.0">
23 <field name="dts_id"/>
24 <footer>
25 <button name="open_kanban" string="Confirm" type="object" class="oe_highlight"/>
26 or
27 <button string="Cancel" class="oe_link" special="cancel"/>
28 </footer>
29 </form>
30 </field>
31 </record>
32
33 <act_window name="Prepare Routes for DTS"
34 res_model="delivery.dts_to_routes"
35 view_mode="form"
36 target="new"
37 id="action_dts_to_routes"/>
38
39 <act_window name="Prepare Vans for DTS"
40 res_model="delivery.dts_to_vans"
41 view_mode="form"
42 target="new"
43 id="action_dts_to_vans"/>
44
45 <menuitem name="Prepare Delivery Routes" id="menu_delivery_wizard" parent="delivery_routes.menu_delivery_root" sequence="0"/>
46 <menuitem action="action_dts_to_vans" name="Prepare Vans for DTS" id="menu_action_dts_to_vans" parent="menu_delivery_wizard" sequence="10"/>
47 <menuitem action="action_dts_to_routes" name="Prepare Routes for DTS" id="menu_action_dts_to_routes" parent="menu_delivery_wizard" sequence="15"/>
48
49
50
51 <record id="view_driver_for_routes" model="ir.ui.view">
52 <field name="name">Choose Driver / Deliver for DTS</field>
53 <field name="model">delivery.driver_for_routes</field>
54 <field name="arch" type="xml">
55 <form string="Choose Driver / Deliver for DTS" version="7.0">
56 <group colspan="2" col="4">
57 <field name="dts_id"/>
58 <!--field name="action"/-->
59 </group>
60 <footer>
61 <button name="open_kanban" string="Confirm" type="object" class="oe_highlight"/>
62 or
63 <button string="Cancel" class="oe_link" special="cancel"/>
64 </footer>
65 </form>
66 </field>
67 </record>
68
69 <act_window name="Choose Driver / Deliver for DTS"
70 res_model="delivery.driver_for_routes"
71 view_mode="form"
72 target="new"
73 id="action_driver_for_routes"/>
74 <menuitem action="action_driver_for_routes" name="Choose Driver / Deliver for DTS" id="menu_action_driver_for_routes" parent="menu_delivery_wizard" sequence="25"/>
75
76
77
78 <record model="ir.ui.view" id="delivery_route_driver_kanban_view">
79 <field name="name">delivery.route.driver.kanban</field>
80 <field name="model">delivery.route</field>
81 <field name="arch" type="xml">
82 <kanban version="7.0">
83 <field name="dts_id"/>
84 <field name="driver_id"/>
85 <field name="picker_id"/>
86 <field name="state"/>
87 <templates>
88 <t t-name="kanban-box">
89 <div t-attf-class="oe_kanban_card oe_kanban_global_click">
90 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
91 <span class="oe_e">í</span>
92 <ul class="oe_dropdown_menu">
93 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
94 </ul>
95 </div>
96 <div class="oe_kanban_content">
97 <div><b><field name="name"/></b></div>
98 <div>
99 <field name="date"/><br />
100 <field name="state"/>
101 </div>
102 </div>
103 <div class="oe_clear"></div>
104 </div>
105 </t>
106 </templates>
107 </kanban>
108 </field>
109 </record>
110 <record id="action_delivery_route_driver_kanban" model="ir.actions.act_window">
111 <field name="name">Delivery Route Driver Kanban</field>
112 <field name="type">ir.actions.act_window</field>
113 <field name="res_model">delivery.route</field>
114 <field name="view_type">tree</field>
115 <field name="view_mode">kanban,form</field>
116 </record>
117
118
119 <record model="ir.ui.view" id="delivery_route_line_kanban_view_fc">
120 <field name="name">delivery.route.line.kanban_fc</field>
121 <field name="model">delivery.route.line</field>
122 <field name="arch" type="xml">
123 <kanban version="7.0">
124 <field name="picking_id"/>
125 <field name="route_id"/>
126 <field name="address_id"/>
127 <field name="note"/>
128 <field name="sequence"/>
129 <field name="color"/>
130 <field name="neighborhood"/>
131 <field name="state"/>
132 <field name="customer_date"/>
133 <templates>
134 <t t-name="kanban-box">
135 <div style="width:175px;" t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click oe_kanban_no_auto_height">
136 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
137 <span class="oe_e">í</span>
138 <ul class="oe_dropdown_menu">
139 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
140 <t t-if="record.state.raw_value == 'draft'"><li><ul class="oe_kanban_colorpicker" data-field="color"/></li></t>
141 </ul>
142 </div>
143 <div class="oe_kanban_content">
144 <div>
145 <field name="color"/> -
146 <span t-if="record.neighborhood.raw_value != null"><field name="neighborhood"/> - </span>
147 <field name="street"/>
148 <div t-if="record.customer_date.raw_value != null"><field name="customer_date"/></div>
149 </div>
150 <!--div class="oe_kanban_bottom_right">
151 <a name="set_van_0" type="object" class="oe_kanban_color_0 oe_kanban_button">No</a>
152 <a name="set_van_1" type="object" class="oe_kanban_color_1 oe_kanban_button">1</a>
153 <a name="set_van_2" type="object" class="oe_kanban_color_2 oe_kanban_button">2</a>
154 <a name="set_van_3" type="object" class="oe_kanban_color_3 oe_kanban_button">3</a>
155 <a name="set_van_4" type="object" class="oe_kanban_color_4 oe_kanban_button">4</a>
156 <a name="set_van_5" type="object" class="oe_kanban_color_5 oe_kanban_button">5</a>
157 <a name="set_van_6" type="object" class="oe_kanban_color_6 oe_kanban_button">6</a>
158 <a name="set_van_7" type="object" class="oe_kanban_color_7 oe_kanban_button">7</a>
159 <a name="set_van_8" type="object" class="oe_kanban_color_8 oe_kanban_button">8</a>
160 <a name="set_van_9" type="object" class="oe_kanban_color_9 oe_kanban_button">9</a>
161 </div-->
162 <div class="oe_clear"></div>
163 </div>
164 <div class="oe_clear"></div>
165 </div>
166 </t>
167 </templates>
168 </kanban>
169 </field>
170 </record>
171
172
173 <record id="view_stock_change_dts_wizard" model="ir.ui.view">
174 <field name="name">Change DTS / PTS</field>
175 <field name="model">delivery.change.dts</field>
176 <field name="arch" type="xml">
177 <form string="Change DTS / PTS" version="7.0">
178 <group>
179 <field name="action"/>
180 <field name="dts_id" on_change="dts_id_change(dts_id, pts_id, context)" attrs="{'invisible':[('action','=','cleanup')]}"/>
181 <field name="pts_id" domain="[('dts_id','=',dts_id)]" attrs="{'invisible':[('action','=','cleanup')]}"/>
182 </group>
183 <footer>
184 <button name="change_dts" string="Update" type="object" class="oe_highlight"/>
185 or
186 <button string="Cancel" class="oe_link" special="cancel" />
187 </footer>
188 </form>
189 </field>
190 </record>
191
192 <act_window name="Change DTS / PTS"
193 res_model="delivery.change.dts"
194 src_model="stock.picking"
195 view_mode="form"
196 target="new"
197 key2="client_action_multi"
198 multi="True"
199 id="action_stock_change_dts_wizard"/>
200
201
202
203 <record model="ir.ui.view" id="delivery_driver_kanban_view">
204 <field name="name">delivery.driver.kanban</field>
205 <field name="model">delivery.driver</field>
206 <field name="arch" type="xml">
207 <kanban version="7.0" default_group_by="tmp_route_id">
208 <field name="tmp_route_id"/>
209 <field name="is_driver"/>
210 <field name="is_picker"/>
211 <field name="color"/>
212 <templates>
213 <t t-name="kanban-box">
214 <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click oe_kanban_no_auto_height">
215 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
216 <span class="oe_e">í</span>
217 <ul class="oe_dropdown_menu">
218 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
219 </ul>
220 </div>
221 <div class="oe_kanban_content">
222 <div><b><field name="name"/></b></div>
223 </div>
224 <div class="oe_clear"></div>
225 </div>
226 </t>
227 </templates>
228 </kanban>
229 </field>
230 </record>
231
232 <!--record id="view_add_picking_pack" model="ir.ui.view">
233 <field name="name">Add Picking to Pack</field>
234 <field name="model">add.picking.pack</field>
235 <field name="type">form</field>
236 <field name="arch" type="xml">
237 <form string="Pack Delivery notes">
238 <separator string="Pack the selected Delivery notes ?"/>
239 <newline/>
240 <button special="cancel" string="Cancel"/>
241 <button name="confirm_add" string="Confirm" type="object"/>
242 </form>
243 </field>
244 </record>
245
246 <act_window name="Add Picking to Pack"
247 src_model="stock.picking"
248 res_model="add.picking.pack"
249 id="action_add_picking_pack_wizard"
250 view_mode="form"
251 multi="True"
252 key2="client_action_multi"
253 target="new"/-->
254
255 <record id="view_to_be_deleted_soon" model="ir.ui.view">
256 <field name="name">TO BE DELETED SOON</field>
257 <field name="model">delivery.reset</field>
258 <field name="arch" type="xml">
259 <form string="RESET ALL DELIVERY" version="7.0">
260 <footer>
261 <button name="go" string="Confirm" type="object" class="oe_highlight"/>
262 or
263 <button string="Cancel" class="oe_link" special="cancel"/>
264 </footer>
265 </form>
266 </field>
267 </record>
268 <act_window name="RESET ALL DELIVERY"
269 res_model="delivery.reset"
270 view_mode="form"
271 target="new"
272 id="action_resetall"/>
273 <menuitem action="action_resetall" name="RESET ALL DELIVERY" id="menu_action_resetall" parent="delivery_routes.menu_delivery_config" sequence="125"/>
274
275
276
277 <!-- kanban view for stock picking with delivery-->
278 <record model="ir.ui.view" id="stock_picking_inout_kanban_elico">
279 <field name="name">stock.picking.out.kanban</field>
280 <field name="model">stock.picking</field>
281 <field name="arch" type="xml">
282 <kanban version="7.0" default_group_by="dts_id">
283 <field name="dts_id"/>
284 <field name="min_date"/>
285 <field name="origin"/>
286 <field name="partner_id"/>
287 <templates>
288 <t t-name="kanban-box">
289 <div t-attf-class="oe_kanban_card oe_kanban_global_click">
290 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
291 <span class="oe_e">í</span>
292 <ul class="oe_dropdown_menu">
293 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
294 <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
295 </ul>
296 </div>
297 <div class="oe_kanban_content">
298 <div><b><field name="origin"/></b></div>
299 <div>
300 <field name="street"/><br />
301 <field name="min_date"/>
302 </div>
303 </div>
304 <div class="oe_clear"></div>
305 </div>
306 </t>
307 </templates>
308 </kanban>
309 </field>
310 </record>
311
312 <record id="view_picking_search_kanban" model="ir.ui.view">
313 <field name="name">stock.picking.search.kanban</field>
314 <field name="model">stock.picking</field>
315 <field name="arch" type="xml">
316 <search string="PO + SO">
317 <field name="name" string="Incoming Shipments" filter_domain="['|',('name','ilike',self),('origin','ilike',self)]"/>
318 <filter icon="terp-check" name="available" string="Ready to Process" domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
319 <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Incoming Shipments already processed"/>
320 <separator/>
321 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
322 <separator/>
323 <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>
324 <field name="stock_journal_id"/>
325 <field name="product_id"/>
326 <group expand="0" string="Group By...">
327 <filter icon="terp-stock_effects-object-colorize" name="state" string="Status" domain="[]" context="{'group_by':'state'}"/>
328 <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
329 <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
330 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
331 <filter icon="terp-go-today" string="DTS Today" name="dts_today" domain="[('dts_id.start_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('dts_id.start_date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="DTS planned for Today"/>
332 <filter icon="terp-go-today" string="DTS Today+Past" name="dts_min_today" domain="['|',('dts_id.start_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('dts_id','=',None)]" help="DTS planned Today or before"/>
333 <filter icon="terp-go-today" string="Today" domain="[('min_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('min_date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/>
334 </group>
335 </search>
336 </field>
337 </record>
338 <record id="action_picking_inout_kanban" model="ir.actions.act_window">
339 <field name="name">PO + SO / DTS</field>
340 <field name="res_model">stock.picking</field>
341 <field name="type">ir.actions.act_window</field>
342 <field name="view_type">tree</field>
343 <field name="view_mode">kanban,form</field>
344 <field name="domain">['&amp;','|','&amp;',('type','=','in'),'&amp;',('state','=','assigned'),("is_collected","=",True),'&amp;',('type','=','out'),("state","not in",["cancel"]),("delivery_state","in",['','not_planned','del_rt'])]</field>
345 <field name="context">{'contact_display': 'partner_address', 'update_pts':1, 'search_default_dts_min_today': 1}</field>
346 <field name="search_view_id" ref="view_picking_search_kanban"/>
347 </record>
348 <menuitem action="action_picking_inout_kanban" id="menu_action_picking_inout_kanban" parent="delivery_plan.menu_delivery_wizard" sequence="1"/>
349 <!-- stock picking with delivery end -->
350
351
352
353
354 <!-- kanban view for stock picking with delivery-->
355 <record model="ir.ui.view" id="stock_picking_inout_kanban_elico">
356 <field name="name">stock.picking.out.kanban</field>
357 <field name="model">stock.picking</field>
358 <field name="arch" type="xml">
359 <kanban version="7.0" default_group_by="dts_id">
360 <field name="dts_id"/>
361 <field name="min_date"/>
362 <field name="origin"/>
363 <field name="partner_id"/>
364 <templates>
365 <t t-name="kanban-box">
366 <div t-attf-class="oe_kanban_card oe_kanban_global_click">
367 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
368 <span class="oe_e">í</span>
369 <ul class="oe_dropdown_menu">
370 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
371 <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
372 </ul>
373 </div>
374 <div class="oe_kanban_content">
375 <div><b><field name="origin"/></b></div>
376 <div>
377 <field name="street"/><br />
378 <field name="min_date"/>
379 </div>
380 </div>
381 <div class="oe_clear"></div>
382 </div>
383 </t>
384 </templates>
385 </kanban>
386 </field>
387 </record>
388 <!--record model="ir.ui.view" id="stock_picking_in_kanban_elico">
389 <field name="name">stock.picking.in.kanban</field>
390 <field name="model">stock.picking.in</field>
391 <field name="arch" type="xml">
392 <kanban version="7.0" default_group_by="dts_id">
393 <field name="dts_id"/>
394 <field name="min_date"/>
395 <field name="origin"/>
396 <field name="partner_id"/>
397 <templates>
398 <t t-name="kanban-box">
399 <div t-attf-class="oe_kanban_card oe_kanban_global_click">
400 <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
401 <span class="oe_e">í</span>
402 <ul class="oe_dropdown_menu">
403 <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
404 <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
405 </ul>
406 </div>
407 <div class="oe_kanban_content">
408 <div><b><field name="origin"/></b></div>
409 <div>
410 (<field name="name"/>)<br />
411 <field name="partner_id"/><br />
412 <field name="min_date"/>
413 </div>
414 </div>
415 <div class="oe_clear"></div>
416 </div>
417 </t>
418 </templates>
419 </kanban>
420 </field>
421 </record-->
422
423 <record id="view_picking_search_kanban" model="ir.ui.view">
424 <field name="name">stock.picking.search.kanban</field>
425 <field name="model">stock.picking</field>
426 <field name="arch" type="xml">
427 <search string="PO + SO">
428 <field name="name" string="Incoming Shipments" filter_domain="['|',('name','ilike',self),('origin','ilike',self)]"/>
429 <filter icon="terp-check" name="available" string="Ready to Process" domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
430 <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Incoming Shipments already processed"/>
431 <separator/>
432 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
433 <separator/>
434 <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>
435 <field name="stock_journal_id"/>
436 <field name="product_id"/>
437 <group expand="0" string="Group By...">
438 <filter icon="terp-stock_effects-object-colorize" name="state" string="Status" domain="[]" context="{'group_by':'state'}"/>
439 <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
440 <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
441 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
442 <filter icon="terp-go-today" string="DTS Today" name="dts_today" domain="[('dts_id.start_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('dts_id.start_date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="DTS planned for Today"/>
443 <filter icon="terp-go-today" string="DTS Today+Past" name="dts_min_today" domain="['|',('dts_id.start_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('dts_id','=',None)]" help="DTS planned Today or before"/>
444 <filter icon="terp-go-today" string="Today" domain="[('min_date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('min_date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/>
445 </group>
446 </search>
447 </field>
448 </record>
449 <record id="action_picking_inout_kanban" model="ir.actions.act_window">
450 <field name="name">PO + SO / DTS</field>
451 <field name="res_model">stock.picking</field>
452 <field name="type">ir.actions.act_window</field>
453 <field name="view_type">tree</field>
454 <field name="view_mode">kanban,form</field>
455 <field name="domain">['&amp;','|','&amp;',('type','=','in'),'&amp;',('state','=','assigned'),("is_collected","=",True),'&amp;',('type','=','out'),("state","not in",["cancel"]),("delivery_state","in",['','not_planned','del_rt'])]</field>
456 <field name="context">{'contact_display': 'partner_address', 'update_pts':1, 'search_default_dts_min_today': 1}</field>
457 <field name="search_view_id" ref="view_picking_search_kanban"/>
458 </record>
459 <menuitem action="action_picking_inout_kanban" id="menu_action_picking_inout_kanban" parent="delivery_plan.menu_delivery_wizard" sequence="1"/>
460 <!-- stock picking with delivery end -->
461
462 </data>
463</openerp>
0\ No newline at end of file464\ No newline at end of file
1465
=== added directory 'delivery_routes'
=== added file 'delivery_routes/__init__.py'
--- delivery_routes/__init__.py 1970-01-01 00:00:00 +0000
+++ delivery_routes/__init__.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,34 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
6#
7# WARNING: This program as such is intended to be used by professional
8# programmers who take the whole responsability of assessing all potential
9# consequences resulting from its eventual inadequacies and bugs
10# End users who are looking for a ready-to-use solution with commercial
11# garantees and support are strongly adviced to contract a Free Software
12# Service Company
13#
14# This program is Free Software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License
16# as published by the Free Software Foundation; either version 2
17# of the License, or (at your option) any later version.
18#
19# This program is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with this program; if not, write to the Free Software
26# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27#
28##############################################################################
29import stock
30import delivery
31import purchase
32import wizard
33
34# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
035
=== added file 'delivery_routes/__openerp__.py'
--- delivery_routes/__openerp__.py 1970-01-01 00:00:00 +0000
+++ delivery_routes/__openerp__.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,63 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011 Cubic ERP - Teradata SAC (<http://cubicerp.com>).
6# Copyright (C) 2013 Elico Corp (<http://www.elico-corp.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 "name": "Delivery Routes",
24 "version": "1",
25 "description": """
26Manage delivery routes.
27=======================
28Based on Cubic ERP's Delivery Routes Module\n
29it add the following features:\n
30* Add group Customer Service
31* Add dts_id in purchase order, A purchase order with flag is_collected can have a delivery_route_line
32* Improve DTS , PTS.
33* Improve Delivery carrier and driver, picker. Add color for delivery driver and picker.
34* Add interface functions with other modules sales, purchase, stock
35* use 3-seg daily dts/pts to arrange delivery.
36""",
37 "author": "Elico Corp",
38 "website": "http://www.elico-corp.com",
39 "category": "Stock Management",
40 "depends": [
41 "delivery",
42 "stock",
43 "hr",
44 #'quality_control_elico',
45 ],
46 "data":[
47 "security/delivery_security.xml",
48 "security/ir.model.access.csv",
49 "wizard/fill_picking.xml",
50 "wizard/select_range_view.xml",
51 "delivery_view.xml",
52 "delivery_sequence.xml",
53 "stock_view.xml",
54 "purchase_view.xml",
55 "wizard/stock_view.xml",
56 ],
57 "demo_xml": [ ],
58 "active": False,
59 "installable": True,
60 "certificate" : "",
61 'images': [],
62}
63# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
064
=== added file 'delivery_routes/delivery.py'
--- delivery_routes/delivery.py 1970-01-01 00:00:00 +0000
+++ delivery_routes/delivery.py 2013-09-09 08:37:27 +0000
@@ -0,0 +1,660 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2012 Cubic ERP - Teradata SAC. (http://cubicerp.com).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from osv import fields, osv
23import time
24from datetime import datetime
25import pytz
26from tools.translate import _
27from tools import ustr
28import logging
29_logger = logging.getLogger(__name__)
30
31
32class sale_order(osv.osv):
33 _inherit = "sale.order"
34
35 _columns = {
36 'so_payment_method': fields.char('Payment Method', size=32),
37 }
38sale_order()
39
40class delivery_driver(osv.osv):
41 _name='delivery.driver'
42
43 _columns = {
44 'partner_id': fields.many2one('res.partner','Partner',help='Fill this field if the driver is a outsourcing of the company'),
45 'employee_id': fields.many2one('hr.employee','Employee',help='Fill this if the driver is a employee of the company'),
46 'name': fields.char('Name', size=64, required=True),
47 'carrier_id': fields.many2one('delivery.carrier','Carrier'),
48 'outsourcing': fields.boolean('Outsourcing ?'),
49 'route_ids': fields.one2many('delivery.route','driver_id','Delivery Routes'),
50 'is_driver': fields.boolean('Is Driver ?'),
51 'is_picker': fields.boolean('Is Picker ?'),
52 'active': fields.boolean('Active ?'),
53 'color': fields.integer('Color Index'),
54 'tmp_route_id': fields.many2one('delivery.route_tmp','Temporary Delivery Route'),
55 }
56 _defaults = {
57 'outsourcing': False,
58 'is_driver': True,
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches