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
1=== added directory 'account_prepayment/static'
2=== added directory 'account_prepayment/static/description'
3=== added file 'account_prepayment/static/description/account_invoice_line1.png'
4Binary 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
5=== added file 'account_prepayment/static/description/account_invoice_line2.png'
6Binary 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
7=== added file 'account_prepayment/static/description/index.html'
8--- account_prepayment/static/description/index.html 1970-01-01 00:00:00 +0000
9+++ account_prepayment/static/description/index.html 2013-09-09 08:37:27 +0000
10@@ -0,0 +1,16 @@
11+<section class="oe_container">
12+ <div class="oe_row">
13+ <h2 class="oe_slogan">account_prepayment Module</h2>
14+ <h3 class="oe_slogan">Prepayment Account for Customers and <br>Usage of Prepayment Account for Payments in Purchase Order</h3>
15+ <h4 class="oe_slogan"><a href="http://www.openerp.com.cn">By Elico Corp</a></h4>
16+ <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>
17+ <div class="oe_row_img oe_centered oe_mt32">
18+ <img class="oe_picture oe_screenshot" src="account_invoice_line1.png">
19+ <img class="oe_picture oe_screenshot" src="account_invoice_line2.png">
20+ </div>
21+ </div>
22+ <div class="oe_row oe_centeralign oe_more_space">
23+ <a href="http://www.elico-corp.com" class="oe_button oe_big">Start your <span class="oe_emph">free</span> trial</a>
24+ </div>
25+ <h4 class="oe_slogan">or</h4>
26+</section>
27\ No newline at end of file
28
29=== added directory 'delivery_plan'
30=== added file 'delivery_plan/__init__.py'
31--- delivery_plan/__init__.py 1970-01-01 00:00:00 +0000
32+++ delivery_plan/__init__.py 2013-09-09 08:37:27 +0000
33@@ -0,0 +1,27 @@
34+# -*- coding: utf-8 -*-
35+##############################################################################
36+#
37+# OpenERP, Open Source Management Solution
38+# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
39+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as
43+# published by the Free Software Foundation, either version 3 of the
44+# License, or (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+
56+import sale
57+import wizard
58+import partner
59+
60+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
61
62=== added file 'delivery_plan/__openerp__.py'
63--- delivery_plan/__openerp__.py 1970-01-01 00:00:00 +0000
64+++ delivery_plan/__openerp__.py 2013-09-09 08:37:27 +0000
65@@ -0,0 +1,58 @@
66+# -*- coding: utf-8 -*-
67+##############################################################################
68+#
69+# OpenERP, Open Source Management Solution
70+# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
71+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
72+#
73+# This program is free software: you can redistribute it and/or modify
74+# it under the terms of the GNU Affero General Public License as
75+# published by the Free Software Foundation, either version 3 of the
76+# License, or (at your option) any later version.
77+#
78+# This program is distributed in the hope that it will be useful,
79+# but WITHOUT ANY WARRANTY; without even the implied warranty of
80+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81+# GNU Affero General Public License for more details.
82+#
83+# You should have received a copy of the GNU Affero General Public License
84+# along with this program. If not, see <http://www.gnu.org/licenses/>.
85+#
86+##############################################################################
87+
88+{
89+ 'name': 'Delivery Time Plan',
90+ 'version': '1',
91+ 'category': 'Delivery',
92+ 'sequence': 19,
93+ 'summary': 'Plan delivery time for sale order',
94+ 'description': """
95+Delivery Time Plan
96+=================================
97+* Plan delivery time for sale order
98+* Add delivery return reason,
99+* Calculate sale order dts, pts based on order start_date, enddate,
100+* Compute dts,pts of delivery order based on start_date and end date of sale order, delivery zone of partner.
101+ """,
102+ 'author': 'Elico Corp',
103+ 'website': 'http://www.elico-corp.com',
104+ 'images' : [],
105+ 'depends': ['sale_stock', 'delivery_routes',
106+ 'mrp',
107+ "report_webkit", 'stock_extra'],
108+ 'data': [
109+ #'security/security.xml',
110+ 'security/ir.model.access.csv',
111+ 'stock_view.xml',
112+ "delivery_report.xml",
113+ 'wizard/stock_view.xml',
114+ 'sequence.xml',
115+ ],
116+ 'test': [],
117+ 'demo': [],
118+ 'installable': True,
119+ 'auto_install': False,
120+ 'application': False,
121+}
122+
123+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
124
125=== added file 'delivery_plan/delivery_report.xml'
126--- delivery_plan/delivery_report.xml 1970-01-01 00:00:00 +0000
127+++ delivery_plan/delivery_report.xml 2013-09-09 08:37:27 +0000
128@@ -0,0 +1,73 @@
129+<?xml version="1.0"?>
130+<openerp>
131+ <data>
132+ <record id="ir_header_webkit_delivery_routes" model="ir.header_webkit">
133+ <field eval="&quot;&quot;&quot;Portrait&quot;&quot;&quot;" name="orientation"/>
134+ <field eval="&quot;&quot;&quot;A4&quot;&quot;&quot;" name="format"/>
135+ <field eval="&quot;&quot;&quot;DeliveryRoutes&quot;&quot;&quot;" name="name"/>
136+ <field eval="15.0" name="margin_top"/>
137+ <field name="footer_html"><![CDATA[<html>
138+ <head>
139+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
140+ <script>
141+ function subst() {
142+ var vars={};
143+ var x=document.location.search.substring(1).split('&');
144+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
145+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
146+ for(var i in x) {
147+ var y = document.getElementsByClassName(x[i]);
148+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
149+ }
150+ }
151+ </script>
152+ </head>
153+ <body style="border:0; margin: 0;" onload="subst()">
154+ <table style="border-top: 1px solid black; font-size:8px; width: 100%; position:absolute;">
155+ <tr>
156+ <td width="10%"><b>备注</b></td><td width="80%">1.拿货前请先确认是否有以下货物并勾选(干货蔬果,冰冻货物,熟食,饼房). 2.支付方式简写 现金 C,刷卡 P,不收钱 NC,券 Q(配送结束时填写)</td>
157+ </tr>
158+ <tr>
159+ <td width="10%"></td><td width="80%">3.配送结果有以下几种:1:配送成功。2:没有收钱。3:部分退货.4:改时间送。(配送结束时填写)</td>
160+ </tr>
161+ </table>
162+ </body>
163+</html>]]></field>
164+ <field name="html"><![CDATA[<html>
165+ <head>
166+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
167+ <script>
168+ function subst() {
169+ var vars={};
170+ var x=document.location.search.substring(1).split('&');
171+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
172+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
173+ for(var i in x) {
174+ var y = document.getElementsByClassName(x[i]);
175+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
176+ }
177+ }
178+ </script>
179+ <style type="text/css">
180+ ${css}
181+ </style>
182+ </head>
183+ <body style="border:0; margin: 0;" onload="subst()">
184+ ${_debug or ''|n} </body>
185+</html>]]>
186+</field>
187+
188+ <field name="css" ><![CDATA[
189+body { font-family:Helvetica; font-size:12px; }
190+.title { font-size:16px; font-weight: bold; text-align: center; }
191+.basic_table{ text-align:center; border-collapse: collapse; }
192+.basic_table td { border:1px solid lightGrey; font-size:12px; }
193+td { padding: 0 3px; text-align:left; font-size: 12px; }
194+table.noborder, table.noborder tr, table.noborder tr td, tr.noborder, tr.noborder td, td.noborder { border: none; }
195+.dontcutme { page-break-inside: avoid; }]]> </field>
196+ </record>
197+
198+ <report id="report_delivery_route_print" name="delivery.route.print" string="Delivery Route" model="delivery.route"
199+ 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"/>
200+ </data>
201+</openerp>
202\ No newline at end of file
203
204=== added directory 'delivery_plan/i18n'
205=== added file 'delivery_plan/i18n/zh_CN.po'
206--- delivery_plan/i18n/zh_CN.po 1970-01-01 00:00:00 +0000
207+++ delivery_plan/i18n/zh_CN.po 2013-09-09 08:37:27 +0000
208@@ -0,0 +1,703 @@
209+# Translation of OpenERP Server.
210+# This file contains the translation of the following modules:
211+# * fc_delivery_plan
212+#
213+msgid ""
214+msgstr ""
215+"Project-Id-Version: OpenERP Server 7.0\n"
216+"Report-Msgid-Bugs-To: \n"
217+"POT-Creation-Date: 2013-03-11 10:05+0000\n"
218+"PO-Revision-Date: 2013-03-11 10:05+0000\n"
219+"Last-Translator: <>\n"
220+"Language-Team: \n"
221+"MIME-Version: 1.0\n"
222+"Content-Type: text/plain; charset=UTF-8\n"
223+"Content-Transfer-Encoding: \n"
224+"Plural-Forms: \n"
225+
226+#. module: fc_delivery_plan
227+#: field:delivery.route.line,to_be_received:0
228+msgid "To be Received"
229+msgstr "待收"
230+
231+#. module: fc_delivery_plan
232+#: field:delivery.route.line,account_checked:0
233+msgid "Checked"
234+msgstr "已检查"
235+
236+#. module: fc_delivery_plan
237+#: code:addons/fc_delivery_plan/sale.py:648
238+#: code:addons/fc_delivery_plan/sale.py:657
239+#, python-format
240+msgid "Error"
241+msgstr "错误"
242+
243+#. module: fc_delivery_plan
244+#: view:stock.picking:0
245+msgid "Orders planned for the Past"
246+msgstr "已安排订单"
247+
248+#. module: fc_delivery_plan
249+#: view:delivery.route:0
250+#: view:delivery.route.line:0
251+#: view:stock.picking:0
252+msgid "Group By..."
253+msgstr "分组..."
254+
255+#. module: fc_delivery_plan
256+#: view:delivery.route:0
257+#: view:delivery.route.line:0
258+#: view:stock.picking:0
259+msgid "Today"
260+msgstr "今天"
261+
262+#. module: fc_delivery_plan
263+#: code:addons/fc_delivery_plan/sale.py:799
264+#: field:delivery.route.line,customer_date:0
265+#, python-format
266+msgid "Customer Delivery Time"
267+msgstr "客户发货时间"
268+
269+#. module: fc_delivery_plan
270+#: view:delivery.route.line:0
271+msgid "Delivery for Today"
272+msgstr "今日配送"
273+
274+#. module: fc_delivery_plan
275+#: view:delivery.change.dts:0
276+msgid "Update"
277+msgstr "更新"
278+
279+#. module: fc_delivery_plan
280+#: field:delivery.route.line,cs_remark:0
281+msgid "CS Remark"
282+msgstr "CS备注"
283+
284+#. module: fc_delivery_plan
285+#: view:stock.picking:0
286+msgid "Picking without batch"
287+msgstr "未设分拣批次"
288+
289+#. module: fc_delivery_plan
290+#: view:stock.picking:0
291+msgid "Picking list"
292+msgstr "发货单"
293+
294+#. module: fc_delivery_plan
295+#: code:addons/fc_delivery_plan/sale.py:546
296+#, python-format
297+msgid "Latest error"
298+msgstr "上次错误"
299+
300+#. module: fc_delivery_plan
301+#: field:delivery.route.line,picking_note:0
302+msgid "DO Notes"
303+msgstr "发货单备注"
304+
305+#. module: fc_delivery_plan
306+#: field:delivery.route.line,delivered_cpt:0
307+msgid "Delivered x times"
308+msgstr "已发货 x 次"
309+
310+#. module: fc_delivery_plan
311+#: selection:delivery.change.dts,action:0
312+msgid "Blank DTS/PTS"
313+msgstr "未设DTS/PTS"
314+
315+#. module: fc_delivery_plan
316+#: view:stock.picking:0
317+msgid "Batch"
318+msgstr "批次"
319+
320+#. module: fc_delivery_plan
321+#: code:addons/fc_delivery_plan/sale.py:657
322+#, python-format
323+msgid "The Route Line %s (origin: %s) is confirmed. You can not change it."
324+msgstr "路线 %s (来源: %s) 已经确认. 不可修改."
325+
326+#. module: fc_delivery_plan
327+#: field:stock.tracking,ul_id:0
328+msgid "Picking Box"
329+msgstr "移库单Box"
330+
331+#. module: fc_delivery_plan
332+#: field:delivery.route.line,origin:0
333+#: view:stock.picking:0
334+msgid "Origin"
335+msgstr "来源"
336+
337+#. module: fc_delivery_plan
338+#: help:stock.picking.in,dts_id:0
339+msgid "Delivery time or turn to receive"
340+msgstr "配送时间(收货)"
341+
342+#. module: fc_delivery_plan
343+#: field:delivery.route.line,exceptions:0
344+msgid "Received with exceptions"
345+msgstr "收货例外"
346+
347+#. module: fc_delivery_plan
348+#: model:ir.model,name:fc_delivery_plan.model_stock_move
349+msgid "Stock Move"
350+msgstr "库存调拨"
351+
352+#. module: fc_delivery_plan
353+#: model:ir.model,name:fc_delivery_plan.model_delivery_dts_to_vans
354+msgid "delivery.dts_to_vans"
355+msgstr "delivery.dts_to_vans"
356+
357+#. module: fc_delivery_plan
358+#: field:delivery.change.dts,dts_id:0
359+#: field:delivery.driver_for_routes,dts_id:0
360+#: field:delivery.dts_to_routes,dts_id:0
361+#: field:delivery.dts_to_vans,dts_id:0
362+#: view:delivery.route:0
363+#: view:delivery.route.line:0
364+#: field:delivery.route.line,dts_id:0
365+#: view:sale.order:0
366+#: field:sale.order,dts_id:0
367+#: field:stock.move,dts_id:0
368+#: view:stock.picking:0
369+#: field:stock.picking.in,dts_id:0
370+#: field:stock.picking.in,route_line_id:0
371+#: field:stock.picking.out,route_line_id:0
372+msgid "Delivery Time"
373+msgstr "发货时间"
374+
375+#. module: fc_delivery_plan
376+#: view:stock.picking:0
377+msgid "Ready"
378+msgstr "就绪"
379+
380+#. module: fc_delivery_plan
381+#: view:delivery.driver:0
382+#: view:delivery.route:0
383+#: view:delivery.route.line:0
384+msgid "Edit..."
385+msgstr "编辑..."
386+
387+#. module: fc_delivery_plan
388+#: field:delivery.route.line,adjustment:0
389+msgid "Adjustment"
390+msgstr "调整"
391+
392+#. module: fc_delivery_plan
393+#: model:ir.model,name:fc_delivery_plan.model_stock_picking_out
394+msgid "Delivery Orders"
395+msgstr "送货单"
396+
397+#. module: fc_delivery_plan
398+#: field:delivery.change.dts,pts_id:0
399+#: field:mrp.production,pts_id:0
400+#: field:procurement.order,pts_id:0
401+#: view:sale.order:0
402+#: view:stock.picking:0
403+#: field:stock.picking.in,pts_id:0
404+msgid "Preparation Time"
405+msgstr "拣货时间"
406+
407+#. module: fc_delivery_plan
408+#: model:ir.ui.menu,name:fc_delivery_plan.menu_delivery_delivery_payment
409+msgid "Delivery Payments"
410+msgstr "发货支付"
411+
412+#. module: fc_delivery_plan
413+#: field:delivery.route.line,vip:0
414+msgid "is VIP ?"
415+msgstr "是否 VIP ?"
416+
417+#. module: fc_delivery_plan
418+#: view:delivery.driver_for_routes:0
419+#: view:delivery.dts_to_routes:0
420+#: view:delivery.dts_to_vans:0
421+msgid "Confirm"
422+msgstr "确认"
423+
424+#. module: fc_delivery_plan
425+#: view:stock.picking:0
426+msgid "Internal Picking List"
427+msgstr "内部分拣单"
428+
429+#. module: fc_delivery_plan
430+#: view:delivery.route.line:0
431+msgid "State"
432+msgstr "状态"
433+
434+#. module: fc_delivery_plan
435+#: model:ir.model,name:fc_delivery_plan.model_stock_picking
436+msgid "Picking List"
437+msgstr "发货单"
438+
439+#. module: fc_delivery_plan
440+#: model:ir.model,name:fc_delivery_plan.model_delivery_dts_to_routes
441+msgid "delivery.dts_to_routes"
442+msgstr "delivery.dts_to_routes"
443+
444+#. module: fc_delivery_plan
445+#: field:delivery.return.reason,type:0
446+#: field:delivery.time,type:0
447+msgid "Type"
448+msgstr "类型"
449+
450+#. module: fc_delivery_plan
451+#: view:stock.picking:0
452+msgid "Expected Date"
453+msgstr "预计日期"
454+
455+#. module: fc_delivery_plan
456+#: selection:stock.picking.in,delivery_state:0
457+msgid "Delivered with exception"
458+msgstr "发货例外"
459+
460+#. module: fc_delivery_plan
461+#: model:ir.model,name:fc_delivery_plan.model_delivery_route_line
462+msgid "delivery.route.line"
463+msgstr "delivery.route.line"
464+
465+#. module: fc_delivery_plan
466+#: selection:delivery.route.line,complete_state:0
467+msgid "Not planned"
468+msgstr "未计划"
469+
470+#. module: fc_delivery_plan
471+#: field:delivery.route.line,partner_phone:0
472+msgid "Partner Phone"
473+msgstr "客户电话"
474+
475+#. module: fc_delivery_plan
476+#: view:stock.picking:0
477+msgid "Related Order"
478+msgstr "相关单据"
479+
480+#. module: fc_delivery_plan
481+#: view:stock.picking:0
482+msgid "Confirmed Internal Moves"
483+msgstr "确认内部调拨"
484+
485+#. module: fc_delivery_plan
486+#: selection:delivery.route.line,complete_state:0
487+msgid "No redelivery"
488+msgstr "未重新发货"
489+
490+#. module: fc_delivery_plan
491+#: view:stock.picking:0
492+msgid "Order Date"
493+msgstr "订单日期"
494+
495+#. module: fc_delivery_plan
496+#: model:ir.model,name:fc_delivery_plan.model_procurement_order
497+msgid "Procurement"
498+msgstr "需求单"
499+
500+#. module: fc_delivery_plan
501+#: view:stock.picking:0
502+msgid "Orders planned for the Future"
503+msgstr "已计划订单"
504+
505+#. module: fc_delivery_plan
506+#: selection:delivery.route.line,complete_state:0
507+msgid "Planned"
508+msgstr "已计划"
509+
510+#. module: fc_delivery_plan
511+#: view:delivery.route:0
512+msgid "Delivery Routes"
513+msgstr "配送车次"
514+
515+#. module: fc_delivery_plan
516+#: view:delivery.driver:0
517+#: view:delivery.route:0
518+#: view:delivery.route.line:0
519+msgid "Delete"
520+msgstr "删除"
521+
522+#. module: fc_delivery_plan
523+#: field:delivery.route.line,return_reasons:0
524+msgid "Return Reasons"
525+msgstr "退货原因"
526+
527+#. module: fc_delivery_plan
528+#: code:addons/fc_delivery_plan/sale.py:800
529+#: field:delivery.route.line,neighborhood:0
530+#, python-format
531+msgid "Neighborhood"
532+msgstr "邻居"
533+
534+#. module: fc_delivery_plan
535+#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_route_form_cs
536+#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_route_form_cs
537+msgid "Delivery Route CS"
538+msgstr "发送路线 CS"
539+
540+#. module: fc_delivery_plan
541+#: model:ir.model,name:fc_delivery_plan.model_delivery_time
542+msgid "delivery.time"
543+msgstr "delivery.time"
544+
545+#. module: fc_delivery_plan
546+#: view:stock.picking:0
547+msgid "Past"
548+msgstr "过去"
549+
550+#. module: fc_delivery_plan
551+#: view:stock.picking:0
552+msgid "Future"
553+msgstr "未来"
554+
555+#. module: fc_delivery_plan
556+#: selection:stock.picking.in,delivery_state:0
557+msgid "Returned, no delivery"
558+msgstr "退回, 未发货"
559+
560+#. module: fc_delivery_plan
561+#: field:delivery.route.line,amount_received:0
562+msgid "Received"
563+msgstr "已收"
564+
565+#. module: fc_delivery_plan
566+#: view:delivery.route:0
567+#: view:delivery.route.line:0
568+#: model:ir.actions.report.xml,name:fc_delivery_plan.report_delivery_route_print
569+msgid "Delivery Route"
570+msgstr "配送车次"
571+
572+#. module: fc_delivery_plan
573+#: view:delivery.change.dts:0
574+#: view:delivery.driver_for_routes:0
575+#: view:delivery.dts_to_routes:0
576+#: view:delivery.dts_to_vans:0
577+msgid "or"
578+msgstr "或者"
579+
580+#. module: fc_delivery_plan
581+#: view:stock.picking:0
582+msgid "Picking already processed"
583+msgstr "分拣已处理"
584+
585+#. module: fc_delivery_plan
586+#: field:res.users,dts_id:0
587+msgid "Last Used Delivery Time"
588+msgstr "上次配送时间"
589+
590+#. module: fc_delivery_plan
591+#: code:addons/fc_delivery_plan/sale.py:648
592+#, python-format
593+msgid "The Route %s is confirmed, you can not add lines to it."
594+msgstr "路线 %s 已经确认, 不可增加新的明细."
595+
596+#. module: fc_delivery_plan
597+#: model:ir.model,name:fc_delivery_plan.model_mrp_production
598+msgid "Manufacturing Order"
599+msgstr "生产订单"
600+
601+#. module: fc_delivery_plan
602+#: model:ir.ui.menu,name:fc_delivery_plan.menu_delivery_wizard
603+msgid "Prepare Delivery Routes"
604+msgstr "准备配送路线"
605+
606+#. module: fc_delivery_plan
607+#: view:stock.picking:0
608+msgid "Status"
609+msgstr "状态"
610+
611+#. module: fc_delivery_plan
612+#: model:ir.model,name:fc_delivery_plan.model_sale_order
613+msgid "Sales Order"
614+msgstr "销售订单"
615+
616+#. module: fc_delivery_plan
617+#: view:delivery.driver:0
618+#: view:delivery.route:0
619+#: view:delivery.route.line:0
620+msgid "í"
621+msgstr "í"
622+
623+#. module: fc_delivery_plan
624+#: model:ir.model,name:fc_delivery_plan.model_stock_tracking
625+msgid "Packs"
626+msgstr "包装"
627+
628+#. module: fc_delivery_plan
629+#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_line_form_cs
630+#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_line_form_cs
631+msgid "Delivery Route Line CS"
632+msgstr "路线明细 CS"
633+
634+#. module: fc_delivery_plan
635+#: code:addons/fc_delivery_plan/sale.py:824
636+#: view:delivery.dts_to_vans:0
637+#: model:ir.actions.act_window,name:fc_delivery_plan.action_dts_to_vans
638+#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_dts_to_vans
639+#, python-format
640+msgid "Prepare Vans for DTS"
641+msgstr "根据配送时间 Vans拣货"
642+
643+#. module: fc_delivery_plan
644+#: selection:delivery.route.line,complete_state:0
645+#: view:stock.picking:0
646+#: selection:stock.picking.in,delivery_state:0
647+msgid "In delivery"
648+msgstr "配送中"
649+
650+#. module: fc_delivery_plan
651+#: field:picking.batch,active:0
652+msgid "Active"
653+msgstr "可用"
654+
655+#. module: fc_delivery_plan
656+#: model:ir.actions.act_window,name:fc_delivery_plan.action_picking_batch
657+#: view:picking.batch:0
658+#: field:stock.picking,batch_id:0
659+#: field:stock.picking.in,batch_id:0
660+#: field:stock.picking.out,batch_id:0
661+msgid "Picking Batch"
662+msgstr "拣货批次"
663+
664+#. module: fc_delivery_plan
665+#: selection:stock.picking.in,delivery_state:0
666+msgid "Not yet planned for delivery"
667+msgstr "还未计划配送"
668+
669+#. module: fc_delivery_plan
670+#: selection:delivery.route.line,complete_state:0
671+msgid "Exception"
672+msgstr "例外"
673+
674+#. module: fc_delivery_plan
675+#: view:delivery.route.line:0
676+msgid "Delivery Route Lines"
677+msgstr "配送车次清单"
678+
679+#. module: fc_delivery_plan
680+#: selection:delivery.time,type:0
681+msgid "Preparation"
682+msgstr "拣货"
683+
684+#. module: fc_delivery_plan
685+#: field:delivery.route.line,amount_unpaid:0
686+msgid "Unpaid"
687+msgstr "未付"
688+
689+#. module: fc_delivery_plan
690+#: field:stock.tracking,picking_id:0
691+msgid "Picking Related"
692+msgstr "相关分拣"
693+
694+#. module: fc_delivery_plan
695+#: field:delivery.change.dts,action:0
696+msgid "Action"
697+msgstr "动作"
698+
699+#. module: fc_delivery_plan
700+#: field:delivery.route.line,box_type:0
701+msgid "Box Type"
702+msgstr "Box 类型"
703+
704+#. module: fc_delivery_plan
705+#: view:delivery.route:0
706+#: view:delivery.route.line:0
707+msgid "Delivery Route for Today"
708+msgstr "今日配送路线"
709+
710+#. module: fc_delivery_plan
711+#: code:addons/fc_delivery_plan/sale.py:840
712+#: view:delivery.dts_to_routes:0
713+#: model:ir.actions.act_window,name:fc_delivery_plan.action_dts_to_routes
714+#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_dts_to_routes
715+#, python-format
716+msgid "Prepare Routes for DTS"
717+msgstr "根据配送时间 预备路线"
718+
719+#. module: fc_delivery_plan
720+#: field:delivery.route.line,driver_phone:0
721+msgid "Driver Phone"
722+msgstr "司机电话"
723+
724+#. module: fc_delivery_plan
725+#: view:stock.picking:0
726+msgid "Orders planned for Today"
727+msgstr "今日安排订单"
728+
729+#. module: fc_delivery_plan
730+#: view:delivery.route:0
731+#: view:stock.picking:0
732+msgid "Done"
733+msgstr "完成"
734+
735+#. module: fc_delivery_plan
736+#: view:delivery.change.dts:0
737+#: view:delivery.driver_for_routes:0
738+#: view:delivery.dts_to_routes:0
739+#: view:delivery.dts_to_vans:0
740+#: selection:delivery.route.line,complete_state:0
741+msgid "Cancel"
742+msgstr "取消"
743+
744+#. module: fc_delivery_plan
745+#: selection:stock.picking.in,delivery_state:0
746+msgid "Planned for delivery"
747+msgstr "配送计划"
748+
749+#. module: fc_delivery_plan
750+#: selection:delivery.route.line,complete_state:0
751+#: view:stock.picking:0
752+#: selection:stock.picking.in,delivery_state:0
753+msgid "Delivered"
754+msgstr "已配送"
755+
756+#. module: fc_delivery_plan
757+#: code:addons/fc_delivery_plan/sale.py:856
758+#: view:delivery.driver_for_routes:0
759+#: model:ir.actions.act_window,name:fc_delivery_plan.action_driver_for_routes
760+#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_driver_for_routes
761+#, python-format
762+msgid "Choose Driver / Deliver for DTS"
763+msgstr "根据配送时间 选择司机 / 送货"
764+
765+#. module: fc_delivery_plan
766+#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_return_type
767+#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_return_type
768+msgid "Return Reason Type"
769+msgstr "退货原因类型"
770+
771+#. module: fc_delivery_plan
772+#: model:ir.model,name:fc_delivery_plan.model_stock_picking_in
773+msgid "Incoming Shipments"
774+msgstr "入库"
775+
776+#. module: fc_delivery_plan
777+#: field:picking.batch,picking_ids:0
778+msgid "Contains"
779+msgstr "包含"
780+
781+#. module: fc_delivery_plan
782+#: field:delivery.route.line,complete_state:0
783+#: view:stock.picking:0
784+#: field:stock.picking.in,delivery_state:0
785+msgid "Delivery State"
786+msgstr "配送状态"
787+
788+#. module: fc_delivery_plan
789+#: model:ir.model,name:fc_delivery_plan.model_picking_batch
790+msgid "picking.batch"
791+msgstr "拣货批次"
792+
793+#. module: fc_delivery_plan
794+#: field:delivery.route.line,so_payment_method:0
795+msgid "Payment Method"
796+msgstr "付款方式"
797+
798+#. module: fc_delivery_plan
799+#: selection:delivery.route.line,complete_state:0
800+msgid "Returned"
801+msgstr "已退货"
802+
803+#. module: fc_delivery_plan
804+#: view:stock.picking:0
805+msgid "Assigned Internal Moves"
806+msgstr "指定的内部调拨"
807+
808+#. module: fc_delivery_plan
809+#: view:stock.picking:0
810+msgid "Journal"
811+msgstr "账簿"
812+
813+#. module: fc_delivery_plan
814+#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_route_driver_kanban
815+msgid "Delivery Route Driver Kanban"
816+msgstr "配送路线司机看板"
817+
818+#. module: fc_delivery_plan
819+#: selection:delivery.time,type:0
820+msgid "Delivery"
821+msgstr "配送"
822+
823+#. module: fc_delivery_plan
824+#: model:ir.model,name:fc_delivery_plan.model_delivery_driver_for_routes
825+msgid "delivery.driver_for_routes"
826+msgstr "delivery.driver_for_routes"
827+
828+#. module: fc_delivery_plan
829+#: view:stock.picking:0
830+msgid "Waiting"
831+msgstr "正在等待"
832+
833+#. module: fc_delivery_plan
834+#: selection:delivery.change.dts,action:0
835+msgid "Change DTS/PTS"
836+msgstr "变更 DTS/PTS"
837+
838+#. module: fc_delivery_plan
839+#: field:delivery.return.reason,reason:0
840+#: field:delivery.return.type,name:0
841+#: field:picking.batch,name:0
842+msgid "Name"
843+msgstr "名称"
844+
845+#. module: fc_delivery_plan
846+#: view:stock.picking:0
847+msgid "Not Planned"
848+msgstr "未计划"
849+
850+#. module: fc_delivery_plan
851+#: view:delivery.route.line:0
852+msgid "Route"
853+msgstr "路线"
854+
855+#. module: fc_delivery_plan
856+#: selection:stock.picking.in,delivery_state:0
857+msgid "Delivered and returned"
858+msgstr "已配送和已退回"
859+
860+#. module: fc_delivery_plan
861+#: field:stock.picking.in,carrier_id:0
862+msgid "Carrier"
863+msgstr "运输工具"
864+
865+#. module: fc_delivery_plan
866+#: view:delivery.change.dts:0
867+#: model:ir.actions.act_window,name:fc_delivery_plan.action_stock_change_dts_wizard
868+#: model:ir.model,name:fc_delivery_plan.model_delivery_change_dts
869+msgid "Change DTS / PTS"
870+msgstr "变更 DTS / PTS"
871+
872+#. module: fc_delivery_plan
873+#: field:delivery.return.reason,route_line_id:0
874+msgid "Delivery Route Line"
875+msgstr "配送路线明细"
876+
877+#. module: fc_delivery_plan
878+#: model:ir.model,name:fc_delivery_plan.model_res_users
879+msgid "Users"
880+msgstr "用户"
881+
882+#. module: fc_delivery_plan
883+#: model:ir.model,name:fc_delivery_plan.model_delivery_return_reason
884+msgid "delivery.return.reason"
885+msgstr "delivery.return.reason"
886+
887+#. module: fc_delivery_plan
888+#: field:delivery.return.type,sequence:0
889+msgid "Sequence"
890+msgstr "序号"
891+
892+#. module: fc_delivery_plan
893+#: model:ir.model,name:fc_delivery_plan.model_delivery_return_type
894+msgid "delivery.return.type"
895+msgstr "delivery.return.type"
896+
897+#. module: fc_delivery_plan
898+#: view:stock.picking:0
899+msgid "No batch"
900+msgstr "未设批次"
901+
902+#. module: fc_delivery_plan
903+#: field:delivery.route.line,amount_total:0
904+msgid "Total"
905+msgstr "合计"
906+
907+#. module: fc_delivery_plan
908+#: field:delivery.route.line,account_remark:0
909+msgid "Remark Accounting"
910+msgstr "财务备注"
911+
912
913=== added file 'delivery_plan/partner.py'
914--- delivery_plan/partner.py 1970-01-01 00:00:00 +0000
915+++ delivery_plan/partner.py 2013-09-09 08:37:27 +0000
916@@ -0,0 +1,33 @@
917+# -*- coding: utf-8 -*-
918+##############################################################################
919+#
920+# OpenERP, Open Source Management Solution
921+# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
922+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
923+#
924+# This program is free software: you can redistribute it and/or modify
925+# it under the terms of the GNU Affero General Public License as
926+# published by the Free Software Foundation, either version 3 of the
927+# License, or (at your option) any later version.
928+#
929+# This program is distributed in the hope that it will be useful,
930+# but WITHOUT ANY WARRANTY; without even the implied warranty of
931+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
932+# GNU Affero General Public License for more details.
933+#
934+# You should have received a copy of the GNU Affero General Public License
935+# along with this program. If not, see <http://www.gnu.org/licenses/>.
936+#
937+##############################################################################
938+
939+from openerp.osv import osv, fields
940+
941+
942+class res_partner(osv.osv):
943+ _inherit = "res.partner"
944+
945+ _columns = {
946+ 'deliver_zone': fields.char('Delivery Zone', size= 64),
947+ }
948+
949+res_partner()
950\ No newline at end of file
951
952=== added directory 'delivery_plan/report'
953=== added file 'delivery_plan/report/__init__.py'
954--- delivery_plan/report/__init__.py 1970-01-01 00:00:00 +0000
955+++ delivery_plan/report/__init__.py 2013-09-09 08:37:27 +0000
956@@ -0,0 +1,32 @@
957+# -*- encoding: utf-8 -*-
958+##############################################################################
959+#
960+# OpenERP, Open Source Management Solution
961+# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
962+#
963+# WARNING: This program as such is intended to be used by professional
964+# programmers who take the whole responsability of assessing all potential
965+# consequences resulting from its eventual inadequacies and bugs
966+# End users who are looking for a ready-to-use solution with commercial
967+# garantees and support are strongly adviced to contract a Free Software
968+# Service Company
969+#
970+# This program is Free Software; you can redistribute it and/or
971+# modify it under the terms of the GNU General Public License
972+# as published by the Free Software Foundation; either version 2
973+# of the License, or (at your option) any later version.
974+#
975+# This program is distributed in the hope that it will be useful,
976+# but WITHOUT ANY WARRANTY; without even the implied warranty of
977+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
978+# GNU General Public License for more details.
979+#
980+# You should have received a copy of the GNU General Public License
981+# along with this program; if not, write to the Free Software
982+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
983+#
984+##############################################################################
985+
986+import delivery_route_print
987+
988+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
989\ No newline at end of file
990
991=== added file 'delivery_plan/report/delivery_route_print.mako'
992--- delivery_plan/report/delivery_route_print.mako 1970-01-01 00:00:00 +0000
993+++ delivery_plan/report/delivery_route_print.mako 2013-09-09 08:37:27 +0000
994@@ -0,0 +1,110 @@
995+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
996+<html>
997+ <head>
998+ <meta content="text/html; charset=UTF-8" http-equiv="content-type">
999+ <style type="text/css">
1000+ ${css}
1001+ </style>
1002+ </head>
1003+ <body>
1004+ <% cpt = 0 %>
1005+ %for delivery_route in objects :
1006+%if cpt > 0:
1007+<div style="page-break-after: always;"><span style="display: none;"> </span></div>
1008+%endif
1009+ <div class="title">Delivery Distribution Control Sheet (配送交接控制表)</div>
1010+ <div style="font-size:12px;font-style:italic;text-align:center;">Ref / 编号 : ${delivery_route.name}</div>
1011+ <td><b></b></td><td></td>
1012+ <br />
1013+ <table class="basic_table" width="100%">
1014+ <tr>
1015+ <td width="17%"><b>Date<br />日期</b></td><td width="33%">${delivery_route.date}</td>
1016+ <td width="17%"><b>Time Slot<br />时间段</b></td><td>${delivery_route.dts_id.name or '&nbsp;'}</td>
1017+ </tr>
1018+ <tr>
1019+ <td><b>Driver<br />驾驶员</b></td><td>${delivery_route.driver_id.name or '&nbsp;'}</td>
1020+ <td><b>Deliver<br />送货员</b></td><td>${delivery_route.picker_id.name or '&nbsp;'}</td>
1021+ </tr>
1022+ <tr>
1023+ <td><b>Departure Time<br />出发时间</b></td><td>${delivery_route.departure_date or '&nbsp;'}</td>
1024+ <td><b>Operation Rep<br />运营人员</b></td><td></td>
1025+ </tr>
1026+ </table>
1027+ <br />
1028+ <div class="main">
1029+ <table width="100%" class="basic_table">
1030+ <tbody>
1031+ <tr style="font-weight:bold;">
1032+ <td style="height:26px;" colspan="4">Reason for delayed/Early departure 延迟的原因</td>
1033+ <td colspan="2">出库公里数: </td>
1034+ <td colspan="2">回库公里数: </td>
1035+ </tr>
1036+ <tr style="font-weight:bold;">
1037+ <td style="vertical-align:top; height:30px;" colspan="8">&nbsp;</td>
1038+ </tr>
1039+ <tr style="font-weight:bold;">
1040+ <td style="text-align:center; height:16px;" colspan="8">List of deliveries / 交货清单</td>
1041+ </tr>
1042+ <tr style="font-weight:bold;">
1043+ <td style="vertical-align:top; width:15px;">No</td>
1044+ <td style="vertical-align:top; width:70px;">Order <br /> 单号</td>
1045+ <td style="vertical-align:top; width:48px;">T<br />装箱</td>
1046+ <td style="vertical-align:top; width:175px;">Address<br />地址</td>
1047+ <td style="vertical-align:top;">Time<br />时间要求</td>
1048+ <td style="vertical-align:top;">Payment<br />支付方式</td>
1049+ <td style="vertical-align:top; width:75px;">Arrive Time<br />到达时间</td>
1050+ <td style="vertical-align:top; width:75px;">Observation<br />结果</td>
1051+ </tr>
1052+ <% cpt=0 %>
1053+ %for line in delivery_route.line_ids:
1054+ <% cpt+=1 %>
1055+ <% iced = False %>
1056+ <% warm = False %>
1057+ <% other = False %>
1058+ %if line.vip:
1059+ <tr style="font-style:italic;">
1060+ %else:
1061+ <tr>
1062+ %endif
1063+ <td style="vertical-align: top;"><div class="dontcutme">${cpt}</div></td>
1064+ <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>
1065+ <td style="vertical-align: top;"><div class="dontcutme"><%
1066+ pack_set = set([ move.product_id.joomla_deliver_in for move in line.picking_id.move_lines ])
1067+ %>
1068+ % for pack in pack_set:
1069+ %if pack in ['warm', 'iced', 'iced_n_warm','cold']:
1070+ %if pack in ['iced', 'iced_n_warm'] and not iced:
1071+ <input type="checkbox" /> 冻F<br />
1072+ <% iced = True %>
1073+ %endif
1074+ %if pack in ['warm', 'iced_n_warm'] and not warm:
1075+ <input type="checkbox" /> 热W<br />
1076+ <% warm = True %>
1077+ %endif
1078+ %if pack in ['cold']:
1079+ <input type="checkbox" /> 冷C<br />
1080+ <% warm = True %>
1081+ %endif
1082+ %else:
1083+ %if not other:
1084+ <input type="checkbox" /> 常温<br />
1085+ <% other = True %>
1086+ %endif
1087+ %endif
1088+ %endfor
1089+ </div></td>
1090+ <td style="vertical-align: top;"><div class="dontcutme">${line.address_id.name or ''}<br />${line.street or line.address_id.street or ''}</div></td>
1091+ <td style="vertical-align: top;"><div class="dontcutme">${line.customer_date or ''}</div></td>
1092+ <td style="vertical-align: top;"><div class="dontcutme">${line.so_payment_method or ''}</div></td>
1093+ <td style="vertical-align: top;">&nbsp;</td>
1094+ <td style="vertical-align: top;">&nbsp;</td>
1095+ </tr>
1096+ %endfor
1097+ </tbody>
1098+ </table>
1099+ </div>
1100+ <div style="page-break-after: auto;"><span style="display: none;"> </span></div>
1101+ <% cpt+=1 %>
1102+ %endfor
1103+ </body>
1104+</html>
1105\ No newline at end of file
1106
1107=== added file 'delivery_plan/report/delivery_route_print.mako.1'
1108--- delivery_plan/report/delivery_route_print.mako.1 1970-01-01 00:00:00 +0000
1109+++ delivery_plan/report/delivery_route_print.mako.1 2013-09-09 08:37:27 +0000
1110@@ -0,0 +1,111 @@
1111+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1112+<html>
1113+ <head>
1114+ <meta content="text/html; charset=UTF-8" http-equiv="content-type">
1115+ <style type="text/css">
1116+ ${css}
1117+ </style>
1118+ </head>
1119+ <body>
1120+ <% cpt = 0 %>
1121+ %for delivery_route in objects :
1122+%if cpt > 0:
1123+<div style="page-break-after: always;"><span style="display: none;"> </span></div>
1124+%endif
1125+ <div class="title">Delivery Distribution Control Sheet (配送交接控制表)</div>
1126+ <div style="font-size:12px;font-style:italic;text-align:center;">Ref / 编号 : ${delivery_route.name}</div>
1127+ <td><b></b></td><td></td>
1128+ <br />
1129+ <table class="basic_table" width="100%">
1130+ <tr>
1131+ <td width="17%"><b>Date<br />日期</b></td><td width="33%">${delivery_route.date}</td>
1132+ <td width="17%"><b>Time Slot<br />时间段</b></td><td>${delivery_route.dts_id.name or '&nbsp;'}</td>
1133+ </tr>
1134+ <tr>
1135+ <td><b>Driver<br />驾驶员</b></td><td>${delivery_route.driver_id.name or '&nbsp;'}</td>
1136+ <td><b>Deliver<br />送货员</b></td><td>${delivery_route.picker_id.name or '&nbsp;'}</td>
1137+ </tr>
1138+ <tr>
1139+ <td><b>Departure Time<br />出发时间</b></td><td>${delivery_route.departure_date or '&nbsp;'}</td>
1140+ <td><b>Operation Rep<br />运营人员</b></td><td></td>
1141+ </tr>
1142+ </table>
1143+ <br />
1144+ <div class="main">
1145+ <table width="100%" class="basic_table">
1146+ <tbody>
1147+ <tr style="font-weight:bold;">
1148+ <td style="border:0; padding-left:15px;vertical-align:top; height:16px;" colspan="8">Reason for delayed/Early departure 延迟的原因
1149+ /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1150+ &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>
1151+ /&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>
1152+ </tr>
1153+ <tr style="font-weight:bold;">
1154+ <td style="vertical-align:top; height:30px;" colspan="8">&nbsp;</td>
1155+ </tr>
1156+ <tr style="font-weight:bold;">
1157+ <td style="text-align:center; height:16px;" colspan="8">List of deliveries / 交货清单</td>
1158+ </tr>
1159+ <tr style="font-weight:bold;">
1160+ <td style="vertical-align:top; width:15px;">No</td>
1161+ <td style="vertical-align:top; width:70px;">Order <br /> 单号</td>
1162+ <td style="vertical-align:top; width:48px;">T<br />装箱</td>
1163+ <td style="vertical-align:top; width:175px;">Address<br />地址</td>
1164+ <td style="vertical-align:top;">Time<br />时间要求</td>
1165+ <td style="vertical-align:top;">Payment<br />支付方式</td>
1166+ <td style="vertical-align:top; width:75px;">Arrive Time<br />到达时间</td>
1167+ <td style="vertical-align:top; width:75px;">Observation<br />结果</td>
1168+ </tr>
1169+ <% cpt=0 %>
1170+ %for line in delivery_route.line_ids:
1171+ <% cpt+=1 %>
1172+ <% iced = False %>
1173+ <% warm = False %>
1174+ <% other = False %>
1175+ %if line.vip:
1176+ <tr style="font-style:italic;">
1177+ %else:
1178+ <tr>
1179+ %endif
1180+ <td style="vertical-align: top;"><div class="dontcutme">${cpt}</div></td>
1181+ <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>
1182+ <td style="vertical-align: top;"><div class="dontcutme"><%
1183+ pack_set = set([ move.product_id.joomla_deliver_in for move in line.picking_id.move_lines ])
1184+ %>
1185+ % for pack in pack_set:
1186+ %if pack in ['warm', 'iced', 'iced_n_warm']:
1187+ %if pack in ['iced', 'iced_n_warm'] and not iced:
1188+ <input type="checkbox" /> 冻F<br />
1189+ <% iced = True %>
1190+ %endif
1191+ %if pack in ['warm', 'iced_n_warm'] and not warm:
1192+ <input type="checkbox" /> 热W<br />
1193+ <% warm = True %>
1194+ %endif
1195+ %if pack in ['cold']:
1196+ <input type="checkbox" /> 冷C<br />
1197+ <% warm = True %>
1198+ %endif
1199+ %else:
1200+ %if not other:
1201+ <input type="checkbox" /> 常温<br />
1202+ <% other = True %>
1203+ %endif
1204+ %endif
1205+ %endfor
1206+ </div></td>
1207+ <td style="vertical-align: top;"><div class="dontcutme">${line.address_id.name or ''}<br />${line.street or line.address_id.street or ''}</div></td>
1208+ <td style="vertical-align: top;"><div class="dontcutme">${line.customer_date or ''}</div></td>
1209+ <td style="vertical-align: top;"><div class="dontcutme">${line.so_payment_method or ''}</div></td>
1210+ <td style="vertical-align: top;">&nbsp;</td>
1211+ <td style="vertical-align: top;">&nbsp;</td>
1212+ </tr>
1213+ %endfor
1214+ </tbody>
1215+ </table>
1216+ </div>
1217+ <div style="page-break-after: auto;"><span style="display: none;"> </span></div>
1218+ <% cpt+=1 %>
1219+ %endfor
1220+ </body>
1221+</html>
1222\ No newline at end of file
1223
1224=== added file 'delivery_plan/report/delivery_route_print.py'
1225--- delivery_plan/report/delivery_route_print.py 1970-01-01 00:00:00 +0000
1226+++ delivery_plan/report/delivery_route_print.py 2013-09-09 08:37:27 +0000
1227@@ -0,0 +1,39 @@
1228+# -*- encoding: utf-8 -*-
1229+##############################################################################
1230+#
1231+# OpenERP, Open Source Management Solution
1232+# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
1233+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
1234+# $Id$
1235+#
1236+# This program is free software: you can redistribute it and/or modify
1237+# it under the terms of the GNU General Public License as published by
1238+# the Free Software Foundation, either version 3 of the License, or
1239+# (at your option) any later version.
1240+#
1241+# This program is distributed in the hope that it will be useful,
1242+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1243+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1244+# GNU General Public License for more details.
1245+#
1246+# You should have received a copy of the GNU General Public License
1247+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1248+#
1249+##############################################################################
1250+
1251+import time
1252+
1253+from report import report_sxw
1254+import pooler
1255+
1256+class report_delivery_route_print(report_sxw.rml_parse):
1257+ _name = 'report.delivery.route.print'
1258+
1259+ def __init__(self, cr, uid, name, context):
1260+ super(report_delivery_route_print, self).__init__(cr, uid, name, context)
1261+
1262+
1263+report_sxw.report_sxw('delivery.route.print', 'delivery.route',
1264+ 'addons/fc_delivery_plan/report/delivery_route_print.mako', parser=report_delivery_route_print)
1265+
1266+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1267
1268=== added file 'delivery_plan/report/delivery_route_print.py.bak'
1269--- delivery_plan/report/delivery_route_print.py.bak 1970-01-01 00:00:00 +0000
1270+++ delivery_plan/report/delivery_route_print.py.bak 2013-09-09 08:37:27 +0000
1271@@ -0,0 +1,53 @@
1272+# -*- coding: utf-8 -*-
1273+##############################################################################
1274+#
1275+# OpenERP, Open Source Management Solution
1276+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
1277+#
1278+# This program is free software: you can redistribute it and/or modify
1279+# it under the terms of the GNU Affero General Public License as
1280+# published by the Free Software Foundation, either version 3 of the
1281+# License, or (at your option) any later version.
1282+#
1283+# This program is distributed in the hope that it will be useful,
1284+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1285+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1286+# GNU Affero General Public License for more details.
1287+#
1288+# You should have received a copy of the GNU Affero General Public License
1289+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1290+#
1291+##############################################################################
1292+
1293+import time
1294+from report import report_sxw
1295+import netsvc
1296+
1297+class report_delivery_route_print(report_sxw.rml_parse):
1298+ _name = 'report.delivery.route.print'
1299+ def __init__(self, cr, uid, name, context):
1300+ super(report_delivery_route_print, self).__init__(cr, uid, name, context)
1301+ self.localcontext.update({
1302+ 'time': time,
1303+ 'convert': self.convert,
1304+ 'day': self.day,
1305+ 'month': self.month,
1306+ 'year': self.year,
1307+ })
1308+
1309+ def convert(self, amount, currency): return self.pool.get('ir.translation').amount_to_text(amount, 'zh_cn', currency or 'Nuevo Sol')
1310+
1311+ def day(self, date): return self.pool.get('ir.translation').date_part(date, 'day', format='number' ,lang='zh_cn')
1312+
1313+ def month(self, date): return self.pool.get('ir.translation').date_part(date, 'month', format='text' ,lang='zh_cn')
1314+
1315+ def year(self, date): return self.pool.get('ir.translation').date_part(date, 'year', format='number' ,lang='zh_cn')
1316+
1317+report_sxw.report_sxw(
1318+ 'delivery.route.print',
1319+ 'delivery.route',
1320+ 'addons/delivery_routes/report/delivery_route_print.rml',
1321+ parser=report_delivery_route_print,header="external"
1322+)
1323+
1324+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1325
1326=== added file 'delivery_plan/report/delivery_route_print.rml'
1327--- delivery_plan/report/delivery_route_print.rml 1970-01-01 00:00:00 +0000
1328+++ delivery_plan/report/delivery_route_print.rml 2013-09-09 08:37:27 +0000
1329@@ -0,0 +1,243 @@
1330+<?xml version="1.0"?>
1331+<document filename="test.pdf">
1332+ <template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
1333+ <pageTemplate id="first">
1334+ <frame id="first" x1="16.0" y1="20.0" width="808" height="545"/>
1335+ </pageTemplate>
1336+ </template>
1337+ <stylesheet>
1338+ <blockTableStyle id="Standard_Outline">
1339+ <blockAlignment value="LEFT"/>
1340+ <blockValign value="TOP"/>
1341+ </blockTableStyle>
1342+ <blockTableStyle id="Table1">
1343+ <blockAlignment value="LEFT"/>
1344+ <blockValign value="TOP"/>
1345+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
1346+ <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
1347+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
1348+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
1349+ <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
1350+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
1351+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
1352+ <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
1353+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
1354+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
1355+ <lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1"/>
1356+ <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
1357+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
1358+ </blockTableStyle>
1359+ <blockTableStyle id="Table2">
1360+ <blockAlignment value="LEFT"/>
1361+ <blockValign value="TOP"/>
1362+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
1363+ <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
1364+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
1365+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
1366+ <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
1367+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
1368+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
1369+ <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
1370+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
1371+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
1372+ <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
1373+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
1374+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
1375+ <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
1376+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
1377+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
1378+ <lineStyle kind="LINEAFTER" colorName="#000000" start="5,0" stop="5,-1"/>
1379+ <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
1380+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
1381+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/>
1382+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
1383+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/>
1384+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
1385+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,1" stop="2,-1"/>
1386+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
1387+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,1" stop="3,-1"/>
1388+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
1389+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,1" stop="4,-1"/>
1390+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
1391+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,1" stop="5,-1"/>
1392+ <lineStyle kind="LINEAFTER" colorName="#000000" start="5,1" stop="5,-1"/>
1393+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
1394+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,2" stop="0,-1"/>
1395+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
1396+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,2" stop="1,-1"/>
1397+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
1398+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,2" stop="2,-1"/>
1399+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
1400+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,2" stop="3,-1"/>
1401+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
1402+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,2" stop="4,-1"/>
1403+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
1404+ <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,2" stop="5,-1"/>
1405+ <lineStyle kind="LINEAFTER" colorName="#000000" start="5,2" stop="5,-1"/>
1406+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
1407+ </blockTableStyle>
1408+ <initialize>
1409+ <paraStyle name="all" alignment="justify"/>
1410+ </initialize>
1411+ <paraStyle name="P1" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
1412+ <paraStyle name="P2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1413+ <paraStyle name="P3" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1414+ <paraStyle name="P4" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1415+ <paraStyle name="P5" fontName="Helvetica" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
1416+ <paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
1417+ <paraStyle name="Standard" fontName="Helvetica"/>
1418+ <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
1419+ <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
1420+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
1421+ <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
1422+ <paraStyle name="Index" fontName="Helvetica"/>
1423+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
1424+ <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"/>
1425+ <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
1426+ <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"/>
1427+ <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"/>
1428+ <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"/>
1429+ <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"/>
1430+ <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"/>
1431+ <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"/>
1432+ <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"/>
1433+ <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"/>
1434+ <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"/>
1435+ <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"/>
1436+ <images/>
1437+ </stylesheet>
1438+ <story>
1439+ <para style="P3">
1440+ <font color="white"> </font>
1441+ </para>
1442+ <para style="P3">[[repeatIn(objects,'o')]]</para>
1443+ <para style="P3">[[ setLang(o.partner_id.lang) ]]</para>
1444+ <para style="P3">
1445+ <font color="white"> </font>
1446+ </para>
1447+ <para style="P3">Referencia : [[ o.name ]]</para>
1448+ <para style="P3">
1449+ <font color="white"> </font>
1450+ </para>
1451+ <para style="P3">Conductor: [[ o.driver_id.name ]]</para>
1452+ <para style="P3">
1453+ <font color="white"> </font>
1454+ </para>
1455+ <para style="P3">Fecha: [[ o.date ]] - Horario: [[ o.dts_id.name ]]</para>
1456+ <para style="P3">
1457+ <font color="white"> </font>
1458+ </para>
1459+ <blockTable colWidths="85.0,138.0,114.0,138.0" style="Table1">
1460+ <tr>
1461+ <td>
1462+ <para style="P1">Hora de Salida:</para>
1463+ </td>
1464+ <td>
1465+ <para style="P2">[[ (o.departure_date) ]]</para>
1466+ </td>
1467+ <td>
1468+ <para style="P1">Hora de Llegada:</para>
1469+ </td>
1470+ <td>
1471+ <para style="P2">
1472+ <font color="white"> </font>
1473+ </para>
1474+ </td>
1475+ </tr>
1476+ </blockTable>
1477+ <para style="P4">
1478+ <font color="white"> </font>
1479+ </para>
1480+ <blockTable colWidths="27.0,67.0,273.0,146.0,84.0,209.0" style="Table2">
1481+ <tr>
1482+ <td>
1483+ <para style="P6">Seq</para>
1484+ </td>
1485+ <td>
1486+ <para style="P6">POS Order</para>
1487+ </td>
1488+ <td>
1489+ <para style="P6">Dirección de Entrega</para>
1490+ </td>
1491+ <td>
1492+ <para style="P6">Destinatario</para>
1493+ </td>
1494+ <td>
1495+ <para style="P6">Hora de Visita</para>
1496+ </td>
1497+ <td>
1498+ <para style="P6">Detalle de Visita</para>
1499+ </td>
1500+ </tr>
1501+ <tr>
1502+ <td>
1503+ <para style="P2">[[repeatIn(o.line_ids,'line')]] [[line.sequence]]</para>
1504+ </td>
1505+ <td>
1506+ <para style="P5">[[line.pos_order_id.name]]</para>
1507+ </td>
1508+ <td>
1509+ <para style="P5">[[line.address_id.street]] [[line.address_id.street2]], [[line.address_id.district_id.name]] ([[line.address_id.address_ref]])</para>
1510+ </td>
1511+ <td>
1512+ <para style="P5">[[line.address_id.name]] ([[line.address_id.phone]] / [[line.address_id.mobile]])</para>
1513+ </td>
1514+ <td>
1515+ <para style="P5">
1516+ <font color="white"> </font>
1517+ </para>
1518+ </td>
1519+ <td>
1520+ <para style="P5">
1521+ <font color="white"> </font>
1522+ </para>
1523+ </td>
1524+ </tr>
1525+ <tr>
1526+ <td>
1527+ <para style="P2">
1528+ <font color="white"> </font>
1529+ </para>
1530+ </td>
1531+ <td>
1532+ <para style="P5">
1533+ <font color="white"> </font>
1534+ </para>
1535+ </td>
1536+ <td>
1537+ <para style="P5">
1538+ <font color="white"> </font>
1539+ </para>
1540+ </td>
1541+ <td>
1542+ <para style="P5">
1543+ <font color="white"> </font>
1544+ </para>
1545+ </td>
1546+ <td>
1547+ <para style="P5">
1548+ <font color="white"> </font>
1549+ </para>
1550+ </td>
1551+ <td>
1552+ <para style="P5">
1553+ <font color="white"> </font>
1554+ </para>
1555+ </td>
1556+ </tr>
1557+ </blockTable>
1558+ <para style="P3">
1559+ <font color="white"> </font>
1560+ </para>
1561+ <para style="P3">
1562+ <font color="white"> </font>
1563+ </para>
1564+ <para style="P3">
1565+ <font color="white"> </font>
1566+ </para>
1567+ <para style="P3">
1568+ <font color="white"> </font>
1569+ </para>
1570+ </story>
1571+</document>
1572+
1573
1574=== added file 'delivery_plan/report/delivery_route_print.rml.bk'
1575--- delivery_plan/report/delivery_route_print.rml.bk 1970-01-01 00:00:00 +0000
1576+++ delivery_plan/report/delivery_route_print.rml.bk 2013-09-09 08:37:27 +0000
1577@@ -0,0 +1,266 @@
1578+<?xml version="1.0"?>
1579+<document filename="test.pdf">
1580+ <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
1581+ <pageTemplate id="first">
1582+ <frame id="first" x1="1.0" y1="56.0" width="594" height="786"/>
1583+ </pageTemplate>
1584+ </template>
1585+ <stylesheet>
1586+ <blockTableStyle id="Standard_Outline">
1587+ <blockAlignment value="LEFT"/>
1588+ <blockValign value="TOP"/>
1589+ </blockTableStyle>
1590+ <blockTableStyle id="Table_Partner_Address">
1591+ <blockAlignment value="LEFT"/>
1592+ <blockValign value="TOP"/>
1593+ </blockTableStyle>
1594+ <blockTableStyle id="Tabla2">
1595+ <blockAlignment value="LEFT"/>
1596+ <blockValign value="TOP"/>
1597+ </blockTableStyle>
1598+ <blockTableStyle id="Tabla1">
1599+ <blockAlignment value="LEFT"/>
1600+ <blockValign value="TOP"/>
1601+ </blockTableStyle>
1602+ <blockTableStyle id="Tabla4">
1603+ <blockAlignment value="LEFT"/>
1604+ <blockValign value="TOP"/>
1605+ </blockTableStyle>
1606+ <blockTableStyle id="Tabla5">
1607+ <blockAlignment value="LEFT"/>
1608+ <blockValign value="TOP"/>
1609+ </blockTableStyle>
1610+ <blockTableStyle id="Tabla6">
1611+ <blockAlignment value="LEFT"/>
1612+ <blockValign value="TOP"/>
1613+ </blockTableStyle>
1614+ <initialize>
1615+ <paraStyle name="all" alignment="justify"/>
1616+ </initialize>
1617+ <paraStyle name="P1" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1618+ <paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
1619+ <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"/>
1620+ <paraStyle name="P4" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1621+ <paraStyle name="P5" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1622+ <paraStyle name="P6" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1623+ <paraStyle name="P7" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1624+ <paraStyle name="P8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1625+ <paraStyle name="P9" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
1626+ <paraStyle name="P10" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1627+ <paraStyle name="P11" rightIndent="0.0" leftIndent="35.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
1628+ <paraStyle name="Standard" fontName="Helvetica"/>
1629+ <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
1630+ <paraStyle name="Text_20_body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
1631+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
1632+ <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
1633+ <paraStyle name="Index" fontName="Helvetica"/>
1634+ <paraStyle name="terp_5f_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
1635+ <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"/>
1636+ <paraStyle name="Table_20_Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
1637+ <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"/>
1638+ <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"/>
1639+ <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"/>
1640+ <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"/>
1641+ <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"/>
1642+ <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"/>
1643+ <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"/>
1644+ <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"/>
1645+ <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"/>
1646+ <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"/>
1647+ <images/>
1648+ </stylesheet>
1649+ <story>
1650+ <para style="terp_5f_default_5f_8">[[repeatIn(objects,'route')]]</para>
1651+ <para style="terp_5f_default_5f_8">[[ setLang(o.partner_id.lang) ]]</para>
1652+ <para style="terp_5f_default_5f_8">
1653+ <font color="white"> </font>
1654+ </para>
1655+ <blockTable colWidths="393.0,202.0" style="Table_Partner_Address">
1656+ <tr>
1657+ <td>
1658+ <blockTable colWidths="55.0,338.0" style="Tabla2">
1659+ <tr>
1660+ <td>
1661+ <para style="P2">
1662+ <font color="white"> </font>
1663+ </para>
1664+ </td>
1665+ <td>
1666+ <para style="P1">
1667+ <font color="white"> </font>
1668+ </para>
1669+ <para style="P1">[[ route.date ]]</para>
1670+ </td>
1671+ </tr>
1672+ <tr>
1673+ <td>
1674+ <para style="P2">
1675+ <font color="white"> </font>
1676+ </para>
1677+ </td>
1678+ <td>
1679+ <para style="P10">Horario </para>
1680+ </td>
1681+ </tr>
1682+ <tr>
1683+ <td>
1684+ <para style="P2">
1685+ <font color="white"> </font>
1686+ </para>
1687+ </td>
1688+ <td>
1689+ <para style="P10">Conductor</para>
1690+ </td>
1691+ </tr>
1692+ <tr>
1693+ <td>
1694+ <para style="P2">
1695+ <font color="white"> </font>
1696+ </para>
1697+ </td>
1698+ <td>
1699+ <para style="P10">[[ route.dts_id.name ]]</para>
1700+ </td>
1701+ </tr>
1702+ <tr>
1703+ <td>
1704+ <para style="P2">
1705+ <font color="white"> </font>
1706+ </para>
1707+ </td>
1708+ <td>
1709+ <para style="P9">[[ route.driver_id.name ]]</para>
1710+ </td>
1711+ </tr>
1712+ </blockTable>
1713+ </td>
1714+ <td>
1715+ <blockTable colWidths="202.0" style="Tabla1">
1716+ <tr>
1717+ <td>
1718+ <para style="P2">
1719+ <font color="white"> </font>
1720+ </para>
1721+ </td>
1722+ </tr>
1723+ <tr>
1724+ <td>
1725+ <para style="terp_5f_default_5f_9">blabla 1</para>
1726+ <para style="terp_5f_default_5f_9">bla bla 2</para>
1727+ <para style="P8">
1728+ <font color="white"> </font>
1729+ </para>
1730+ </td>
1731+ </tr>
1732+ </blockTable>
1733+ <para style="terp_5f_default_5f_8">
1734+ <font color="white"> </font>
1735+ </para>
1736+ </td>
1737+ </tr>
1738+ <tr>
1739+ <td>
1740+ <para style="terp_5f_default_5f_8">
1741+ <font color="white"> </font>
1742+ </para>
1743+ <blockTable colWidths="35.0,74.0,351.0,68.0,67.0" style="Tabla4">
1744+ <tr>
1745+ <td>
1746+ <para style="P5">
1747+ <font color="white"> </font>
1748+ </para>
1749+ </td>
1750+ <td>
1751+ <para style="P8">[[repeatIn(o.line_ids,'lines')]][[ lines.pos_order_id.name]]</para>
1752+ </td>
1753+ <td>
1754+ <para style="P8">[[ lines.address_id.street]]</para>
1755+ </td>
1756+ <td>
1757+ <para style="P5">[[ lines.address_id.district_id.name]]</para>
1758+ </td>
1759+ <td>
1760+ <para style="P5">[[ day(lines.visit_day) month(lines.visit_day) year(lines.visit_day) ]]</para>
1761+ </td>
1762+ </tr>
1763+ </blockTable>
1764+ <blockTable colWidths="30.0,384.0,182.0" style="Tabla5">
1765+ <tr>
1766+ <td>
1767+ <para style="P2">
1768+ <font color="white"> </font>
1769+ </para>
1770+ </td>
1771+ <td>
1772+ <para style="P4">
1773+ <font color="white"> </font>
1774+ </para>
1775+ </td>
1776+ <td>
1777+ <para style="P2">
1778+ <font color="white"> </font>
1779+ </para>
1780+ </td>
1781+ </tr>
1782+ </blockTable>
1783+ <blockTable colWidths="85.0,254.0,76.0,88.0,93.0" style="Tabla6">
1784+ <tr>
1785+ <td>
1786+ <para style="P2">
1787+ <font color="white"> </font>
1788+ </para>
1789+ </td>
1790+ <td>
1791+ <para style="P2">
1792+ <font color="white"> </font>
1793+ </para>
1794+ </td>
1795+ <td>
1796+ <para style="P2">
1797+ <font color="white"> </font>
1798+ </para>
1799+ </td>
1800+ <td>
1801+ <para style="P2">
1802+ <font color="white"> </font>
1803+ </para>
1804+ </td>
1805+ <td>
1806+ <para style="P2">
1807+ <font color="white"> </font>
1808+ </para>
1809+ </td>
1810+ </tr>
1811+ <tr>
1812+ <td>
1813+ <para style="P2">
1814+ <font color="white"> </font>
1815+ </para>
1816+ </td>
1817+ <td>
1818+ <para style="P2">
1819+ <font color="white"> </font>
1820+ </para>
1821+ </td>
1822+ <td>
1823+ <para style="P6">
1824+ <font color="white"> </font>
1825+ </para>
1826+ </td>
1827+ <td>
1828+ <para style="P6">
1829+ <font color="white"> </font>
1830+ </para>
1831+ </td>
1832+ <td>
1833+ <para style="P7">
1834+ <font color="white"> </font>
1835+ </para>
1836+ </td>
1837+ </tr>
1838+ </blockTable>
1839+ </td>
1840+ </tr>
1841+ </blockTable>
1842+ </story>
1843+</document>
1844
1845=== added file 'delivery_plan/report/delivery_route_print.sxw'
1846Binary 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
1847=== added file 'delivery_plan/sale.py'
1848--- delivery_plan/sale.py 1970-01-01 00:00:00 +0000
1849+++ delivery_plan/sale.py 2013-09-09 08:37:27 +0000
1850@@ -0,0 +1,1182 @@
1851+# -*- coding: utf-8 -*-
1852+##############################################################################
1853+#
1854+# OpenERP, Open Source Management Solution
1855+# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
1856+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
1857+#
1858+# This program is free software: you can redistribute it and/or modify
1859+# it under the terms of the GNU Affero General Public License as
1860+# published by the Free Software Foundation, either version 3 of the
1861+# License, or (at your option) any later version.
1862+#
1863+# This program is distributed in the hope that it will be useful,
1864+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1865+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1866+# GNU Affero General Public License for more details.
1867+#
1868+# You should have received a copy of the GNU Affero General Public License
1869+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1870+#
1871+##############################################################################
1872+
1873+from osv import osv, fields
1874+from datetime import datetime
1875+from dateutil.relativedelta import relativedelta
1876+import pytz
1877+from openerp import netsvc
1878+from openerp.tools.translate import _
1879+
1880+
1881+class sale_order(osv.osv):
1882+ _inherit = "sale.order"
1883+
1884+ def _get_dts_id(self, cr, uid, ids, fields, args, context=None):
1885+ result = {}
1886+ for so in self.browse(cr, uid, ids, context=context):
1887+ result[so.id] = so.pts_id and so.pts_id.dts_id and so.pts_id.dts_id.id or False
1888+ return result
1889+
1890+ def _so_to_update_after_dts_change(self, cr, uid, ids, fields=None, arg=None, context=None):
1891+ if type(ids) != type([]):
1892+ ids = [ids]
1893+ return self.pool.get('sale.order').search(cr, uid, [('pts_id', 'in', ids)]) or []
1894+
1895+ _store_dts_id = {
1896+ 'sale.order': (lambda self, cr, uid, ids, context: ids, ['pts_id'], 10),
1897+ 'delivery.time': (_so_to_update_after_dts_change, ['dts_id'], 10),
1898+ }
1899+
1900+ _columns = {
1901+ 'pts_id': fields.many2one('delivery.time', 'Preparation Time', domain=[('type', '=', 'pts')]),
1902+ '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')]),
1903+ 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
1904+ 'start_date': fields.datetime('Delivery Start Date'),
1905+ 'end_date': fields.datetime(' Delivery End Date'),
1906+ # 'so_payment_method': fields.char('Payment Method', size=32),
1907+ }
1908+
1909+
1910+ def action_cancel_order_with_moves_not_delivered(self, cr, uid, ids, context=None):
1911+ wf_service = netsvc.LocalService("workflow")
1912+ if context is None:
1913+ context = {}
1914+ sale_order_line_obj = self.pool.get('sale.order.line')
1915+ drl_obj = self.pool.get('delivery.route.line')
1916+ #proc_obj = self.pool.get('procurement.order')
1917+ for sale in self.browse(cr, uid, ids, context=context):
1918+ try:
1919+ for pick in sale.picking_ids:
1920+ for mov in pick.move_lines:
1921+ if mov.state not in ('done','cancel'):
1922+ mov.write({'state':'cancel'})
1923+
1924+ for pick in sale.picking_ids:
1925+ if pick.state != 'cancel':
1926+ #wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
1927+ pick.write({'state':'cancel'})
1928+ for inv in sale.invoice_ids:
1929+ wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
1930+ for line in sale.order_line:
1931+ if line.procurement_id:
1932+ wf_service.trg_validate(uid, 'procurement.order', line.procurement_id.id, 'button_check', cr)
1933+
1934+ #cancel delivery route line
1935+ drl_ids = drl_obj.search(cr, uid, [('sale_order_id','=',sale.id),('state','!=','cancel')])
1936+ drl_obj.action_cancel(cr,uid,drl_ids,context=context)
1937+
1938+ order_ref = context.get('order_ref',False)
1939+ self.write(cr, uid, [sale.id], {'state':'shipping_except','client_order_ref':order_ref})
1940+ cr.commit()
1941+ except:
1942+ _logger.info('==== #LY action_cancel_order_with_moves_not_delivered fail %s===='%(sale.id))
1943+ return True
1944+
1945+ def action_cancel_order_with_moves(self, cr, uid, ids, context=None):
1946+ wf_service = netsvc.LocalService("workflow")
1947+ if context is None:
1948+ context = {}
1949+ sale_order_line_obj = self.pool.get('sale.order.line')
1950+ drl_obj = self.pool.get('delivery.route.line')
1951+ #proc_obj = self.pool.get('procurement.order')
1952+ for sale in self.browse(cr, uid, ids, context=context):
1953+ try:
1954+ if sale.state == 'done':
1955+ return False
1956+ for pick in sale.picking_ids:
1957+ if pick.state == 'done':
1958+ return False
1959+ for mov in pick.move_lines:
1960+ if mov.state == 'done':
1961+ return False
1962+ for inv in sale.invoice_ids:
1963+ if inv.state == 'paid':
1964+ return False
1965+
1966+ for pick in sale.picking_ids:
1967+ wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
1968+ for pick in sale.picking_ids:
1969+ if pick.state != 'cancel':
1970+ wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
1971+
1972+ for inv in sale.invoice_ids:
1973+ wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
1974+ for line in sale.order_line:
1975+ if line.procurement_id:
1976+ wf_service.trg_validate(uid, 'procurement.order', line.procurement_id.id, 'button_check', cr)
1977+
1978+ #cancel delivery route line
1979+ drl_ids = drl_obj.search(cr, uid, [('sale_order_id','=',sale.id),('state','!=','cancel')])
1980+ drl_obj.action_cancel(cr,uid,drl_ids,context=context)
1981+
1982+ sale_order_line_obj.write(cr, uid, [l.id for l in sale.order_line], {'state': 'cancel'})
1983+ self.write(cr, uid, [sale.id], {'state': 'cancel'})
1984+ cr.commit()
1985+ except:
1986+ _logger.info('==== #LY action_cancel_order_with_moves fail %s===='%(sale.id))
1987+ return True
1988+
1989+ def _prepare_order_line_procurement(self, cr, uid, order, pt_id, line, move_id, date_planned, context=None):
1990+ return {
1991+ 'name': line.name,
1992+ 'origin': order.name,
1993+ 'date_planned': date_planned,
1994+ 'product_id': line.product_id.id,
1995+ 'product_qty': line.product_uom_qty,
1996+ 'product_uom': line.product_uom.id,
1997+ 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
1998+ 'product_uos': (line.product_uos and line.product_uos.id) or line.product_uom.id,
1999+ 'location_id': order.shop_id.warehouse_id.lot_stock_id.id,
2000+ 'procure_method': line.type,
2001+ 'move_id': move_id,
2002+ 'company_id': order.company_id.id,
2003+ 'note': line.name,
2004+ 'pts_id': pt_id,
2005+ }
2006+
2007+ def _prepare_order_line_move_fc(self, cr, uid, order, line, picking_id, pt_id, date_planned, context=None):
2008+ location_id = order.shop_id.warehouse_id.lot_stock_id.id
2009+ output_id = order.shop_id.warehouse_id.lot_output_id.id
2010+ return {
2011+ 'name': line.name,
2012+ 'picking_id': picking_id,
2013+ 'product_id': line.product_id.id,
2014+ 'date': date_planned,
2015+ 'date_expected': date_planned,
2016+ 'product_qty': line.product_uom_qty,
2017+ 'product_uom': line.product_uom.id,
2018+ 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
2019+ 'product_uos': (line.product_uos and line.product_uos.id) or line.product_uom.id,
2020+ 'product_packaging': line.product_packaging.id,
2021+ 'partner_id': line.address_allotment_id.id or order.partner_shipping_id.id,
2022+ 'location_id': location_id,
2023+ 'location_dest_id': output_id,
2024+ 'sale_line_id': line.id,
2025+ 'tracking_id': False,
2026+ 'state': 'draft',
2027+ 'company_id': order.company_id.id,
2028+ 'price_unit': line.product_id.standard_price or 0.0,
2029+ 'pts_id':pt_id,
2030+ }
2031+
2032+ def _prepare_order_picking(self, cr, uid, order, dt_id, pt_id, context=None):
2033+ # SHOULD USE ir_sequence.next_by_code() or ir_sequence.next_by_id()
2034+ pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
2035+ return {
2036+ 'name': pick_name,
2037+ 'origin': order.name,
2038+ 'date': order.date_order,
2039+ 'type': 'out',
2040+ 'state': 'auto',
2041+ 'move_type': order.picking_policy,
2042+ 'sale_id': order.id,
2043+ 'partner_id': order.partner_shipping_id.id,
2044+ 'note': order.note,
2045+ 'invoice_state': (order.order_policy == 'picking' and '2binvoiced') or 'none',
2046+ 'company_id': order.company_id.id,
2047+ 'dts_id':dt_id,
2048+ 'pts_id':pt_id,
2049+ }
2050+
2051+ def _prepare_pts_dts(self, cr, uid, order, context=None):
2052+ if not context:
2053+ context = {}
2054+ tz = pytz.timezone('Asia/Shanghai')
2055+ tz2 = pytz.timezone('America/Anchorage')
2056+ delivery_time_obj = self.pool.get('delivery.time')
2057+ time_slot_obj = self.pool.get('delivery.time.slot')
2058+ val={}
2059+
2060+ dts = False
2061+ pts = False
2062+ pt_id = False
2063+ dt_id = False
2064+ min_date = False
2065+ slot_id = False
2066+ now = datetime.now()
2067+ address = order.partner_shipping_id or order.partner_id or False
2068+
2069+ if order.start_date:
2070+ min_date = order.start_date
2071+ dts = order.start_date
2072+ dts = datetime.strptime(dts, '%Y-%m-%d %H:%M:%S')
2073+ dts = pytz.utc.localize(dts).astimezone(tz)
2074+ if order.date_order:
2075+ pts = datetime.strptime(order.date_order, '%Y-%m-%d')
2076+ pts = pytz.utc.localize(pts).astimezone(tz)
2077+ if not pts:
2078+ pts = dts
2079+
2080+ if dts:
2081+ start_date = datetime.strftime(dts, '%Y-%m-%d')
2082+ from_time = datetime.strftime(dts, '%H:%M')
2083+ #LY remove the shanghai restrict out
2084+ # if address and (not address.city or address.city.lower() in ['shanghai']):
2085+ # from_time = datetime.strftime(dts, '%H:%M')
2086+ # else: # eg: in Nanjing
2087+ # from_time = '09:30'
2088+ name = datetime.strftime(dts, '%y%m%d')
2089+ name_pts = name
2090+ start_date_pts = start_date
2091+
2092+ slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'dts')], order='max_time')
2093+ if slot_ids:
2094+ slot = time_slot_obj.browse(cr, uid, slot_ids[0])
2095+ name += slot.name
2096+ end_date = start_date + ' ' + slot.end_time
2097+ start_date += ' ' + slot.start_time
2098+ start_date = datetime.strptime(start_date, '%Y-%m-%d %H:%M')
2099+ start_date = pytz.utc.localize(start_date).astimezone(tz2)
2100+ start_date = datetime.strftime(start_date, '%Y-%m-%d %H:%M')
2101+ end_date = datetime.strptime(end_date, '%Y-%m-%d %H:%M')
2102+ end_date = pytz.utc.localize(end_date).astimezone(tz2)
2103+ end_date = datetime.strftime(end_date, '%Y-%m-%d %H:%M')
2104+
2105+ dt_ids = delivery_time_obj.search(cr, uid, [('name', '=', name), ('type', '=', 'dts'), ('slot_id', '=', slot.id)])
2106+ if dt_ids:
2107+ dt_id = dt_ids[0]
2108+ else:
2109+ dt_id = delivery_time_obj.create(cr, uid, {
2110+ 'name':name,
2111+ 'start_date': start_date,
2112+ 'end_date': end_date,
2113+ 'active': True,
2114+ 'type': 'dts',
2115+ 'slot_id': slot.id,
2116+ }, context)
2117+ cr.commit()
2118+
2119+ if pts and dt_id:
2120+ date_pts = datetime.strftime(pts, '%Y-%m-%d')
2121+ from_time = datetime.strftime(pts, '%H:%M')
2122+ if date_pts < datetime.strftime(dts, '%Y-%m-%d'):
2123+ date_pts = datetime.strftime(dts, '%Y-%m-%d')
2124+ from_time = '00:00'
2125+
2126+ pts_slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'pts'), ('dts_id', '=', slot.id)], order='max_time')
2127+ if pts_slot_ids:
2128+ pts_slot = time_slot_obj.browse(cr, uid, pts_slot_ids[0])
2129+ name_pts += pts_slot.name
2130+ end_date_pts = start_date_pts + ' ' + pts_slot.end_time
2131+ start_date_pts += ' ' + pts_slot.start_time
2132+ start_date_pts = datetime.strptime(start_date_pts, '%Y-%m-%d %H:%M')
2133+ start_date_pts = pytz.utc.localize(start_date_pts).astimezone(tz2)
2134+ start_date_pts = datetime.strftime(start_date_pts, '%Y-%m-%d %H:%M')
2135+ end_date_pts = datetime.strptime(end_date_pts, '%Y-%m-%d %H:%M')
2136+ end_date_pts = pytz.utc.localize(end_date_pts).astimezone(tz2)
2137+ end_date_pts = datetime.strftime(end_date_pts, '%Y-%m-%d %H:%M')
2138+
2139+ pt_ids = delivery_time_obj.search(cr, uid, [('name', '=', name_pts), ('type', '=', 'pts'), ('slot_id', '=', pts_slot.id)])
2140+ if pt_ids:
2141+ pt_id = pt_ids[0]
2142+ else:
2143+ pt_id = delivery_time_obj.create(cr, uid, {
2144+ 'name':name_pts,
2145+ 'start_date': start_date_pts,
2146+ 'end_date': end_date_pts,
2147+ 'active': True,
2148+ 'type': 'pts',
2149+ 'slot_id': pts_slot.id,
2150+ 'dts_id': dt_id,
2151+ }, context)
2152+ cr.commit()
2153+ val['pts_id'] = pt_id
2154+ if val:
2155+ order.write(val)
2156+ return min_date, dt_id, pt_id
2157+
2158+
2159+ def _create_pickings_and_procurements(self, cr, uid, order, order_lines, picking_id=False, context=None):
2160+ """Create the required procurements to supply sales order lines, also connecting
2161+ the procurements to appropriate stock moves in order to bring the goods to the
2162+ sales order's requested location.
2163+
2164+ If ``picking_id`` is provided, the stock moves will be added to it, otherwise
2165+ a standard outgoing picking will be created to wrap the stock moves, as returned
2166+ by :meth:`~._prepare_order_picking`.
2167+
2168+ Modules that wish to customize the procurements or partition the stock moves over
2169+ multiple stock pickings may override this method and call ``super()`` with
2170+ different subsets of ``order_lines`` and/or preset ``picking_id`` values.
2171+
2172+ :param browse_record order: sales order to which the order lines belong
2173+ :param list(browse_record) order_lines: sales order line records to procure
2174+ :param int picking_id: optional ID of a stock picking to which the created stock moves
2175+ will be added. A new picking will be created if ommitted.
2176+ :return: True
2177+ """
2178+ val = {}
2179+ move_obj = self.pool.get('stock.move')
2180+ picking_obj = self.pool.get('stock.picking')
2181+ procurement_obj = self.pool.get('procurement.order')
2182+ proc_ids = []
2183+
2184+ min_date, dt_id, pt_id = self._prepare_pts_dts(cr, uid, order)
2185+ # min_date, dt_id, pt_id = order.date_order, order.dts_id.id, order.pts_id.id
2186+ print '<<<<<<<<<<<<<< %s, %s, %s' % (min_date, dt_id, pt_id)
2187+
2188+ for line in order_lines:
2189+ if line.state == 'done':
2190+ continue
2191+
2192+ date_planned = min_date or self._get_date_planned(cr, uid, order, line, order.date_order, context=context)
2193+
2194+ if line.product_id:
2195+ if line.product_id.type in ('product', 'consu'):
2196+ if not picking_id:
2197+ picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, dt_id, pt_id, context=context))
2198+ 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))
2199+ else:
2200+ # a service has no stock move
2201+ move_id = False
2202+
2203+ proc_id = procurement_obj.create(cr, uid, self._prepare_order_line_procurement(cr, uid, order, pt_id, line, move_id, date_planned, context=context))
2204+ proc_ids.append(proc_id)
2205+ line.write({'procurement_id': proc_id})
2206+ self.ship_recreate(cr, uid, order, line, move_id, proc_id)
2207+
2208+ wf_service = netsvc.LocalService("workflow")
2209+ if picking_id:
2210+ wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
2211+ for proc_id in proc_ids:
2212+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
2213+
2214+ if order.state == 'shipping_except':
2215+ val['state'] = 'progress'
2216+ val['shipped'] = False
2217+
2218+ if (order.order_policy == 'manual'):
2219+ for line in order.order_line:
2220+ if (not line.invoiced) and (line.state not in ('cancel', 'draft')):
2221+ val['state'] = 'manual'
2222+ break
2223+ order.write(val)
2224+ return True
2225+
2226+sale_order()
2227+
2228+
2229+class picking_batch(osv.osv):
2230+ _name = "picking.batch"
2231+ _columns = {
2232+ 'name': fields.char('Name', size=32, translate=True),
2233+ 'picking_ids': fields.one2many('stock.picking', 'batch_id', 'Contains'),
2234+ 'active': fields.boolean('Active'),
2235+ }
2236+
2237+ _defaults = {
2238+ 'active': True,
2239+ }
2240+
2241+picking_batch()
2242+
2243+
2244+class stock_picking(osv.osv):
2245+ _name = "stock.picking"
2246+ _inherit = "stock.picking"
2247+ _columns = {
2248+ 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
2249+ 'route_line_id': fields.one2many('delivery.route.line', 'picking_id', 'Delivery Time'),
2250+ 'so_payment_method': fields.char('Payment Method', size=32),
2251+ }
2252+
2253+ def write(self, cr, uid, ids, vals, context=None):
2254+ context = context or {}
2255+ pts_id = False
2256+ if type(ids) != type([]):
2257+ ids = [ids]
2258+ if 'dts_id' in vals:
2259+ move_pool = self.pool.get('stock.move')
2260+ proc_pool = self.pool.get('procurement.order')
2261+ pts_pool = self.pool.get('delivery.time')
2262+ drl_pool = self.pool.get('delivery.route.line')
2263+
2264+ if 'pts_id' not in vals:
2265+ pts_id = pts_pool.search(cr, uid, [('active', '=', True), ('type', '=', 'pts'), ('dts_id', '=', vals['dts_id'])], order='start_date DESC')
2266+ if pts_id:
2267+ pts_id = pts_id[0]
2268+ vals.update({'pts_id':pts_id})
2269+ else:
2270+ pts_id = vals['pts_id']
2271+
2272+ if pts_id:
2273+ move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
2274+ if move_ids:
2275+ move_pool.write(cr, uid, move_ids, {'pts_id':pts_id})
2276+ proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
2277+ if proc_ids:
2278+ proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
2279+
2280+# Actually DONE in fields.function
2281+# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
2282+# if route_lines:
2283+# drl_pool.write(cr, uid, route_lines, {'dts_id': vals['dts_id']})
2284+ return super(stock_picking, self).write(cr, uid, ids, vals, context=context)
2285+
2286+
2287+ def pts_id_change(self, cr, uid, ids, pts_id, context=None):
2288+ res = {}
2289+ context = context or {}
2290+ if type(ids) != type([]):
2291+ ids = [ids]
2292+ move_pool = self.pool.get('stock.move')
2293+ proc_pool = self.pool.get('procurement.order')
2294+ pts_pool = self.pool.get('delivery.time')
2295+ drl_pool = self.pool.get('delivery.route.line')
2296+
2297+ if pts_id:
2298+ pts = pts_pool.browse(cr, uid, [pts_id])[0]
2299+ #self.write(cr, uid, ids, {'dts_id':pts and pts.dts_id and pts.dts_id.id or False})
2300+ res['dts_id'] = pts and pts.dts_id and pts.dts_id.id or False
2301+
2302+ move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
2303+ if move_ids:
2304+ vals = {'pts_id':pts_id}
2305+ if pts_id:
2306+ vals.update({'date_expected':pts.dts_id.start_date})
2307+ move_pool.write(cr, uid, move_ids, vals)
2308+ proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
2309+ if proc_ids:
2310+ proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
2311+
2312+# Actually DONE in fields.function
2313+# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
2314+# if route_lines and 'dts_id' in res:
2315+# drl_pool.write(cr, uid, route_lines, {'dts_id': res['dts_id']})
2316+ return {'value': res}
2317+
2318+
2319+ def create(self, cr, uid, data, context=None):
2320+ """
2321+ create route line
2322+ """
2323+ if not data.get('pts_id', False) and data.get('origin', False):
2324+ so_obj = self.pool.get('sale.order')
2325+ so_ids = so_obj.search(cr, uid, [('name', '=', data.get('origin'))]) or []
2326+ for so in so_obj.browse(cr, uid, so_ids):
2327+ 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})
2328+
2329+ return_type = data.get('return', 'none')
2330+ sp = super(stock_picking, self).create(cr, uid, data, context=context)
2331+ if data.get('type', 'internal') in ['in','out'] and data.get('pts_id', False) and return_type not in ['customer', 'supplier']:
2332+ self.pool.get('delivery.route.line').create(cr, uid, {'picking_id':sp, })
2333+ return sp
2334+
2335+stock_picking()
2336+
2337+
2338+class stock_picking_out(osv.osv):
2339+ _inherit = "stock.picking.out"
2340+ _columns = {
2341+ 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
2342+ 'route_line_id': fields.one2many('delivery.route.line', 'picking_id', 'Delivery Time'),
2343+ 'so_payment_method': fields.char('Payment Method', size=32),
2344+ }
2345+
2346+ def write(self, cr, uid, ids, vals, context=None):
2347+ context = context or {}
2348+ pts_id = False
2349+ if type(ids) != type([]):
2350+ ids = [ids]
2351+ if 'dts_id' in vals:
2352+ move_pool = self.pool.get('stock.move')
2353+ proc_pool = self.pool.get('procurement.order')
2354+ pts_pool = self.pool.get('delivery.time')
2355+ drl_pool = self.pool.get('delivery.route.line')
2356+
2357+ if 'pts_id' not in vals:
2358+ pts_id = pts_pool.search(cr, uid, [('active', '=', True), ('type', '=', 'pts'), ('dts_id', '=', vals['dts_id'])], order='start_date DESC')
2359+ if pts_id:
2360+ pts_id = pts_id[0]
2361+ vals.update({'pts_id':pts_id})
2362+ else:
2363+ pts_id = vals['pts_id']
2364+
2365+ if pts_id:
2366+ move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
2367+ if move_ids:
2368+ move_pool.write(cr, uid, move_ids, {'pts_id':pts_id})
2369+ proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
2370+ if proc_ids:
2371+ proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
2372+
2373+# Actually DONE in fields.function
2374+# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
2375+# if route_lines:
2376+# drl_pool.write(cr, uid, route_lines, {'dts_id': vals['dts_id']})
2377+ return super(stock_picking_out, self).write(cr, uid, ids, vals, context=context)
2378+
2379+
2380+ def pts_id_change(self, cr, uid, ids, pts_id, context=None):
2381+ res = {}
2382+ context = context or {}
2383+ if type(ids) != type([]):
2384+ ids = [ids]
2385+ move_pool = self.pool.get('stock.move')
2386+ proc_pool = self.pool.get('procurement.order')
2387+ pts_pool = self.pool.get('delivery.time')
2388+ drl_pool = self.pool.get('delivery.route.line')
2389+
2390+ if pts_id:
2391+ pts = pts_pool.browse(cr, uid, [pts_id])[0]
2392+ #self.write(cr, uid, ids, {'dts_id':pts and pts.dts_id and pts.dts_id.id or False})
2393+ res['dts_id'] = pts and pts.dts_id and pts.dts_id.id or False
2394+
2395+ move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
2396+ if move_ids:
2397+ vals = {'pts_id':pts_id}
2398+ if pts_id:
2399+ vals.update({'date_expected':pts.dts_id.start_date})
2400+ move_pool.write(cr, uid, move_ids, vals)
2401+ proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
2402+ if proc_ids:
2403+ proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
2404+
2405+# Actually DONE in fields.function
2406+# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
2407+# if route_lines and 'dts_id' in res:
2408+# drl_pool.write(cr, uid, route_lines, {'dts_id': res['dts_id']})
2409+ return {'value': res}
2410+
2411+
2412+ def create(self, cr, uid, data, context=None):
2413+ """
2414+ create route line
2415+ """
2416+ if not data.get('pts_id', False) and data.get('origin', False):
2417+ so_obj = self.pool.get('sale.order')
2418+ so_ids = so_obj.search(cr, uid, [('name', '=', data.get('origin'))]) or []
2419+ for so in so_obj.browse(cr, uid, so_ids):
2420+ 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})
2421+
2422+ return_type = data.get('return', 'none')
2423+ sp = super(stock_picking_out, self).create(cr, uid, data, context=context)
2424+ if data.get('pts_id', False) and return_type not in ['customer', 'supplier']:
2425+ self.pool.get('delivery.route.line').create(cr, uid, {'picking_id':sp, })
2426+ return sp
2427+
2428+stock_picking_out()
2429+
2430+
2431+class stock_picking_in(osv.osv):
2432+ _inherit = "stock.picking.in"
2433+
2434+ _columns = {
2435+ 'batch_id': fields.many2one('picking.batch', 'Picking Batch', change_default=True),
2436+ 'route_line_id': fields.one2many('delivery.route.line', 'picking_id', 'Delivery Time'),
2437+ }
2438+
2439+ def write(self, cr, uid, ids, vals, context=None):
2440+ context = context or {}
2441+ pts_id = False
2442+ if type(ids) != type([]):
2443+ ids = [ids]
2444+ if 'dts_id' in vals:
2445+ move_pool = self.pool.get('stock.move')
2446+ proc_pool = self.pool.get('procurement.order')
2447+ pts_pool = self.pool.get('delivery.time')
2448+ drl_pool = self.pool.get('delivery.route.line')
2449+
2450+ if 'pts_id' not in vals:
2451+ pts_id = pts_pool.search(cr, uid, [('active', '=', True), ('type', '=', 'pts'), ('dts_id', '=', vals['dts_id'])], order='start_date DESC')
2452+ if pts_id:
2453+ pts_id = pts_id[0]
2454+ vals.update({'pts_id':pts_id})
2455+ else:
2456+ pts_id = vals['pts_id']
2457+
2458+ if pts_id:
2459+ move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
2460+ if move_ids:
2461+ move_pool.write(cr, uid, move_ids, {'pts_id':pts_id})
2462+ proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
2463+ if proc_ids:
2464+ proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
2465+
2466+# Actually DONE in fields.function
2467+# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
2468+# if route_lines:
2469+# drl_pool.write(cr, uid, route_lines, {'dts_id': vals['dts_id']})
2470+ return super(stock_picking_in, self).write(cr, uid, ids, vals, context=context)
2471+
2472+
2473+ def pts_id_change(self, cr, uid, ids, pts_id, context=None):
2474+ res = {}
2475+ context = context or {}
2476+ if type(ids) != type([]):
2477+ ids = [ids]
2478+ move_pool = self.pool.get('stock.move')
2479+ proc_pool = self.pool.get('procurement.order')
2480+ pts_pool = self.pool.get('delivery.time')
2481+ drl_pool = self.pool.get('delivery.route.line')
2482+
2483+ if pts_id:
2484+ pts = pts_pool.browse(cr, uid, [pts_id])[0]
2485+ #self.write(cr, uid, ids, {'dts_id':pts and pts.dts_id and pts.dts_id.id or False})
2486+ res['dts_id'] = pts and pts.dts_id and pts.dts_id.id or False
2487+
2488+ move_ids = move_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('picking_id', 'in', ids)])
2489+ if move_ids:
2490+ vals = {'pts_id':pts_id}
2491+ if pts_id:
2492+ vals.update({'date_expected':pts.dts_id.start_date})
2493+ move_pool.write(cr, uid, move_ids, vals)
2494+ proc_ids = proc_pool.search(cr, uid, [('state', 'not in', ['cancel', 'done']), ('move_id', 'in', move_ids)])
2495+ if proc_ids:
2496+ proc_pool.write(cr, uid, proc_ids, {'pts_id':pts_id})
2497+
2498+# Actually DONE in fields.function
2499+# route_lines = drl_pool.search(cr, uid, [('state', 'in', ['draft']), ('picking_id', 'in', ids)])
2500+# if route_lines and 'dts_id' in res:
2501+# drl_pool.write(cr, uid, route_lines, {'dts_id': res['dts_id']})
2502+ return {'value': res}
2503+
2504+
2505+ def create(self, cr, uid, data, context=None):
2506+ """
2507+ create route line
2508+ """
2509+ if not data.get('pts_id', False) and data.get('origin', False):
2510+ so_obj = self.pool.get('sale.order')
2511+ so_ids = so_obj.search(cr, uid, [('name', '=', data.get('origin'))]) or []
2512+ for so in so_obj.browse(cr, uid, so_ids):
2513+ 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})
2514+
2515+ purchase_id = data.get('purchase_id', False)
2516+ return_type = data.get('return', 'none')
2517+ if purchase_id:
2518+ po = self.pool.get('purchase.order').browse(cr, uid, purchase_id)
2519+ if not po.is_collected:
2520+ purchase_id = False
2521+
2522+ sp = super(stock_picking_in, self).create(cr, uid, data, context=context)
2523+ if data.get('pts_id', False) and return_type not in ['customer', 'supplier'] and not purchase_id:
2524+ self.pool.get('delivery.route.line').create(cr, uid, {'picking_id':sp, })
2525+ return sp
2526+
2527+stock_picking_in()
2528+
2529+
2530+class stock_tracking(osv.osv):
2531+ _inherit = "stock.tracking"
2532+
2533+ _columns = {
2534+ 'picking_id': fields.many2one('stock.picking', 'Picking Related', change_default=True),
2535+ 'ul_id': fields.many2one('product.ul', 'Picking Box', change_default=True),
2536+ }
2537+stock_tracking()
2538+
2539+
2540+class mrp_production(osv.osv):
2541+ _inherit = 'mrp.production'
2542+
2543+ _columns = {
2544+ 'pts_id': fields.many2one('delivery.time', 'Preparation Time', select=True, domain=[('type', '=', 'pts')]),
2545+ }
2546+
2547+ def _make_production_internal_shipment_line(self, cr, uid, production_line, shipment_id, parent_move_id, destination_location_id=False, context=None):
2548+ stock_move = self.pool.get('stock.move')
2549+ production = production_line.production_id
2550+ date_planned = production.date_planned
2551+ # Internal shipment is created for Stockable and Consumer Products
2552+ if production_line.product_id.type not in ('product', 'consu'):
2553+ return False
2554+ source_location_id = production.location_src_id.id
2555+ if not destination_location_id:
2556+ destination_location_id = source_location_id
2557+ return stock_move.create(cr, uid, {
2558+ 'name': production.name,
2559+ 'picking_id': shipment_id,
2560+ 'product_id': production_line.product_id.id,
2561+ 'product_qty': production_line.product_qty,
2562+ 'product_uom': production_line.product_uom.id,
2563+ 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
2564+ 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
2565+ 'date': date_planned,
2566+ 'move_dest_id': parent_move_id,
2567+ 'location_id': source_location_id,
2568+ 'location_dest_id': destination_location_id,
2569+ 'state': 'waiting',
2570+ 'company_id': production.company_id.id,
2571+ 'pts_id': production.pts_id and production.pts_id.id or False,
2572+ })
2573+
2574+ def _make_production_internal_shipment(self, cr, uid, production, context=None):
2575+ ir_sequence = self.pool.get('ir.sequence')
2576+ stock_picking = self.pool.get('stock.picking')
2577+ routing_loc = None
2578+ pick_type = 'internal'
2579+ partner_id = False
2580+
2581+ # Take routing address as a Shipment Address.
2582+ # If usage of routing location is a internal, make outgoing shipment otherwise internal shipment
2583+ if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
2584+ routing_loc = production.bom_id.routing_id.location_id
2585+ if routing_loc.usage != 'internal':
2586+ pick_type = 'out'
2587+ partner_id = routing_loc.partner_id and routing_loc.partner_id.id or False
2588+
2589+ # Take next Sequence number of shipment base on type
2590+ # SHOULD USE ir_sequence.next_by_code() or ir_sequence.next_by_id()
2591+ pick_name = ir_sequence.get(cr, uid, 'stock.picking.' + pick_type)
2592+
2593+ picking_id = stock_picking.create(cr, uid, {
2594+ 'name': pick_name,
2595+ 'origin': (production.origin or '').split(':')[0] + ':' + production.name,
2596+ 'type': pick_type,
2597+ 'move_type': 'one',
2598+ 'state': 'auto',
2599+ 'partner_id': partner_id,
2600+ 'auto_picking': self._get_auto_picking(cr, uid, production),
2601+ 'company_id': production.company_id.id,
2602+ 'pts_id': production.pts_id and production.pts_id.id or False,
2603+ 'dts_id': production.pts_id and production.pts_id.dts_id and production.pts_id.dts_id.id or False,
2604+ })
2605+ production.write({'picking_id': picking_id}, context=context)
2606+ return picking_id
2607+
2608+ def _make_production_produce_line(self, cr, uid, production, context=None):
2609+ stock_move = self.pool.get('stock.move')
2610+ source_location_id = production.product_id.property_stock_production.id
2611+ destination_location_id = production.location_dest_id.id
2612+ data = {
2613+ 'name': production.name,
2614+ 'date': production.date_planned,
2615+ 'product_id': production.product_id.id,
2616+ 'product_qty': production.product_qty,
2617+ 'product_uom': production.product_uom.id,
2618+ 'product_uos_qty': production.product_uos and production.product_uos_qty or False,
2619+ 'product_uos': production.product_uos and production.product_uos.id or False,
2620+ 'location_id': source_location_id,
2621+ 'location_dest_id': destination_location_id,
2622+ 'move_dest_id': production.move_prod_id.id,
2623+ 'state': 'waiting',
2624+ 'company_id': production.company_id.id,
2625+ 'pts_id': production.pts_id and production.pts_id.id or False,
2626+ }
2627+ move_id = stock_move.create(cr, uid, data, context=context)
2628+ production.write({'move_created_ids': [(6, 0, [move_id])]}, context=context)
2629+ return move_id
2630+
2631+ def _make_production_consume_line(self, cr, uid, production_line, parent_move_id, source_location_id=False, context=None):
2632+ stock_move = self.pool.get('stock.move')
2633+ production = production_line.production_id
2634+ # Internal shipment is created for Stockable and Consumer Products
2635+ if production_line.product_id.type not in ('product', 'consu'):
2636+ return False
2637+ destination_location_id = production.product_id.property_stock_production.id
2638+ if not source_location_id:
2639+ source_location_id = production.location_src_id.id
2640+ move_id = stock_move.create(cr, uid, {
2641+ 'name': production.name,
2642+ 'date': production.date_planned,
2643+ 'product_id': production_line.product_id.id,
2644+ 'product_qty': production_line.product_qty,
2645+ 'product_uom': production_line.product_uom.id,
2646+ 'product_uos_qty': production_line.product_uos and production_line.product_uos_qty or False,
2647+ 'product_uos': production_line.product_uos and production_line.product_uos.id or False,
2648+ 'location_id': source_location_id,
2649+ 'location_dest_id': destination_location_id,
2650+ 'move_dest_id': parent_move_id,
2651+ 'state': 'waiting',
2652+ 'company_id': production.company_id.id,
2653+ 'pts_id': production.pts_id and production.pts_id.id or False,
2654+ })
2655+ production.write({'move_lines': [(4, move_id)]}, context=context)
2656+ return move_id
2657+
2658+mrp_production()
2659+
2660+
2661+class procurement_order(osv.osv):
2662+ _inherit = 'procurement.order'
2663+
2664+ _columns = {
2665+ 'pts_id': fields.many2one('delivery.time', 'Preparation Time', select=True, domain=[('type', '=', 'pts')]),
2666+ 'message': fields.char(_('Latest error'), size=2048, help="Exception occurred while computing procurement orders."),
2667+ }
2668+
2669+ def make_mo(self, cr, uid, ids, context=None):
2670+ """ Make Manufacturing(production) order from procurement
2671+ @return: New created Production Orders procurement wise
2672+ """
2673+ res = {}
2674+ company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
2675+ production_obj = self.pool.get('mrp.production')
2676+ move_obj = self.pool.get('stock.move')
2677+ wf_service = netsvc.LocalService("workflow")
2678+ procurement_obj = self.pool.get('procurement.order')
2679+ for procurement in procurement_obj.browse(cr, uid, ids, context=context):
2680+ res_id = procurement.move_id.id
2681+ newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.produce_delay or 0.0)
2682+ newdate = newdate - relativedelta(days=company.manufacturing_lead)
2683+ produce_id = production_obj.create(cr, uid, {
2684+ 'origin': procurement.origin,
2685+ 'product_id': procurement.product_id.id,
2686+ 'product_qty': procurement.product_qty,
2687+ 'product_uom': procurement.product_uom.id,
2688+ 'product_uos_qty': procurement.product_uos and procurement.product_uos_qty or False,
2689+ 'product_uos': procurement.product_uos and procurement.product_uos.id or False,
2690+ 'location_src_id': procurement.location_id.id,
2691+ 'location_dest_id': procurement.location_id.id,
2692+ 'bom_id': procurement.bom_id and procurement.bom_id.id or False,
2693+ 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
2694+ 'move_prod_id': res_id,
2695+ 'company_id': procurement.company_id.id,
2696+ 'pts_id': procurement.pts_id and procurement.pts_id.id or context and context.get('force_pts_id', False) or False,
2697+ })
2698+
2699+ res[procurement.id] = produce_id
2700+ self.write(cr, uid, [procurement.id], {'state': 'running', 'production_id': produce_id})
2701+ bom_result = production_obj.action_compute(cr, uid,
2702+ [produce_id], properties=[x.id for x in procurement.property_ids])
2703+ wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
2704+ if res_id:
2705+ move_obj.write(cr, uid, [res_id], {'location_id': procurement.location_id.id})
2706+ self.production_order_create_note(cr, uid, ids, context=context)
2707+ return res
2708+
2709+procurement_order()
2710+
2711+
2712+class delivery_time(osv.osv):
2713+ _inherit = 'delivery.time'
2714+
2715+ def search(self, cr, uid, args, offset=0, limit=None, order='name', context=None, count=False):
2716+ # now = datetime.now()
2717+ # args.append(('name','>=',datetime.strftime(now,'%y%m%d')))
2718+ return super(delivery_time, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
2719+
2720+delivery_time()
2721+
2722+
2723+class delivery_return_type(osv.osv):
2724+ _name = 'delivery.return.type'
2725+
2726+ _columns = {
2727+ 'name': fields.char('Name', size=64, required=True, select=True),
2728+ 'sequence': fields.integer('Sequence'),
2729+ }
2730+ _order = 'sequence'
2731+delivery_return_type()
2732+
2733+
2734+class delivery_return_reason(osv.osv):
2735+ _name = 'delivery.return.reason'
2736+
2737+ _columns = {
2738+ 'type': fields.many2one('delivery.return.type', 'Type', required=True),
2739+ 'reason': fields.char('Name', size=1024, required=False),
2740+ 'route_line_id': fields.many2one('delivery.route.line', 'Delivery Route Line'),
2741+ }
2742+delivery_return_reason()
2743+
2744+
2745+class delivery_route(osv.osv):
2746+ _inherit = 'delivery.route'
2747+
2748+ def _auto_init(self, cr, context=None):
2749+ super(delivery_route, self)._auto_init(cr, context=context)
2750+ cr.execute("SELECT table_name FROM information_schema.tables WHERE table_name = 'delivery_scheduler_running'")
2751+ if not cr.fetchone():
2752+ cr.execute('CREATE TABLE delivery_scheduler_running (running boolean)')
2753+ cr.commit()
2754+ cr.execute('INSERT INTO delivery_scheduler_running (running) VALUES (FALSE)')
2755+
2756+ def set_confirm_cs(self, cr, uid, ids, context=None):
2757+ self.write(cr, uid, ids, {'confirm_cs': True}, context=context)
2758+ return True
2759+
2760+delivery_route()
2761+
2762+
2763+class delivery_route_line(osv.osv):
2764+ _inherit = 'delivery.route.line'
2765+
2766+ def search(self, cr, uid, args, offset=0, limit=None, order='dts_name', context=None, count=False):
2767+ context = context or {}
2768+ new_order = context.get('sorting', order)
2769+ return super(delivery_route_line, self).search(cr, uid, args, offset=offset, limit=limit, order=new_order, context=context, count=count)
2770+
2771+ def set_not_vip(self, cr, uid, ids, context=None):
2772+ return self.write(cr, uid, ids, {'vip':False})
2773+
2774+ def set_vip(self, cr, uid, ids, context=None):
2775+ return self.write(cr, uid, ids, {'vip':True})
2776+
2777+ def write(self, cr, uid, ids, vals, context=None):
2778+ if type(ids) != type([]):
2779+ ids = [ids]
2780+ context = context or {}
2781+ if ('route_id' in vals or 'color' in vals or 'sequence' in vals) and not 'force_update' in context:
2782+ for line in self.browse(cr, uid, ids):
2783+ if line.state == 'draft':
2784+ current_dts = context.get('force_dts_id_kanban', False) or False
2785+ # if current_dts:
2786+ # vals.update({'dts_id':current_dts})
2787+ if 'route_id' in vals and vals['route_id']:
2788+ route_state = self.pool.get('delivery.route').read(cr, uid, [vals['route_id']], ['state', 'name'])
2789+ if route_state[0]['state'] != 'draft':
2790+ print('The Route %s is confirmed, you can not add lines to it.' % (route_state[0]['name']))
2791+ raise osv.except_osv(_('Error'), _('The Route %s is confirmed, you can not add lines to it.' % (route_state[0]['name'])))
2792+
2793+ elif 'update_color' in context and context['update_color'] == 1:
2794+ current_color = str(line.color)
2795+ 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")
2796+ color = cr.fetchone()
2797+ if color and color[0]:
2798+ vals.update({'color':color[0]})
2799+
2800+ elif current_dts:
2801+ 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")
2802+ colors = map(lambda x: x[0], cr.fetchall())
2803+ color = False
2804+
2805+ for idx in range(1, 22):
2806+ if idx not in colors and not color and idx != current_color:
2807+ color = idx
2808+ if color:
2809+ vals.update({'color':color})
2810+ else:
2811+ print('No more Route available for the DTS %s.' % (line.dts_id.name))
2812+ raise osv.except_osv(_('Error'), _('No more Route available for the DTS %s.' % (line.dts_id.name)))
2813+
2814+ elif 'check4color' in context and context['check4color'] and 'color' in vals:
2815+ 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')")
2816+ route_line_ids = map(lambda x: x[0], cr.fetchall())
2817+ if route_line_ids:
2818+ 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))
2819+ 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)))
2820+ else:
2821+ print('The Route Line %s (origin: %s) is confirmed. You can not change it.' % (line.picking_id.name, line.picking_id.origin))
2822+ 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)))
2823+ return super(delivery_route_line, self).write(cr, uid, ids, vals, context=context)
2824+
2825+
2826+ def set_van(self, cr, uid, ids, van=0, context=None):
2827+ self.write(cr, uid, ids, {'color': van}, context=context)
2828+ return True
2829+ def set_van_0(self, cr, uid, ids, context=None):
2830+ return self.set_van(cr, uid, ids, 0, context)
2831+ def set_van_1(self, cr, uid, ids, context=None):
2832+ return self.set_van(cr, uid, ids, 1, context)
2833+ def set_van_2(self, cr, uid, ids, context=None):
2834+ return self.set_van(cr, uid, ids, 2, context)
2835+ def set_van_3(self, cr, uid, ids, context=None):
2836+ return self.set_van(cr, uid, ids, 3, context)
2837+ def set_van_4(self, cr, uid, ids, context=None):
2838+ return self.set_van(cr, uid, ids, 4, context)
2839+ def set_van_5(self, cr, uid, ids, context=None):
2840+ return self.set_van(cr, uid, ids, 5, context)
2841+ def set_van_6(self, cr, uid, ids, context=None):
2842+ return self.set_van(cr, uid, ids, 6, context)
2843+ def set_van_7(self, cr, uid, ids, context=None):
2844+ return self.set_van(cr, uid, ids, 7, context)
2845+ def set_van_8(self, cr, uid, ids, context=None):
2846+ return self.set_van(cr, uid, ids, 8, context)
2847+ def set_van_9(self, cr, uid, ids, context=None):
2848+ return self.set_van(cr, uid, ids, 9, context)
2849+
2850+
2851+ def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
2852+ context = context or {}
2853+ if 'view_name' in context and view_type == 'kanban':
2854+ view_ids = self.pool.get('ir.ui.view').search(cr, uid, [('model', '=', 'delivery.route.line'), ('name', '=', context['view_name'])], context=context)
2855+ if view_ids:
2856+ view_id = view_ids[0]
2857+ del context['view_name']
2858+ 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)
2859+
2860+
2861+ def _get_neighborhood(self, cr, uid, ids, fields, args, context=None):
2862+ res = {}
2863+ for route in self.browse(cr, uid, ids):
2864+ # 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
2865+ res[route.id] = route.picking_id and route.picking_id.partner_id and route.picking_id.partner_id.deliver_zone or False
2866+ return res
2867+
2868+ def _get_dts_id(self, cr, uid, ids, fields, args, context=None):
2869+ context = context or {}
2870+ res = {}
2871+ for route in self.browse(cr, uid, ids):
2872+ if route.state in ['draft'] and context.get('set_dts', True):
2873+ 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
2874+ else:
2875+ res[route.id] = route.dts_id and route.dts_id.id or False
2876+ return res
2877+
2878+ def _get_dts_name(self, cr, uid, ids, fields, args, context=None):
2879+ context = context or {}
2880+ res = {}
2881+ for route in self.browse(cr, uid, ids):
2882+ if route.state in ['draft'] and context.get('set_dts', True):
2883+ 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'
2884+ else:
2885+ res[route.id] = route.dts_name or 'n/a'
2886+ return res
2887+
2888+ def _get_special_time(self, cr, uid, ids, fields, args, context=None):
2889+ tz = pytz.timezone('Asia/Shanghai')
2890+ result = {}
2891+ for route in self.browse(cr, uid, ids):
2892+ res = {}
2893+ customer_date = ''
2894+ route_dts_id = route.dts_id and route.dts_id.id
2895+ so_dts_id = route.picking_id.sale_id.dts_id and route.picking_id.sale_id.dts_id.id
2896+
2897+ if so_dts_id and route_dts_id != so_dts_id:
2898+ customer_date = route.picking_id.sale_id.dts_id.name
2899+
2900+ elif route.picking_id.sale_id:
2901+ date_start = route.picking_id.sale_id.start_date or False
2902+ date_end = route.picking_id.sale_id.end_date or False
2903+
2904+ if date_start:
2905+ date_start = datetime.strptime(date_start, '%Y-%m-%d %H:%M:%S')
2906+ date_start = pytz.utc.localize(date_start).astimezone(tz)
2907+
2908+ customer_date = datetime.strftime(date_start, '%H:%M')
2909+ #LY if customer_date is 00:00, no special time.
2910+ if customer_date != '00:00':
2911+ if date_end:
2912+ date_end = datetime.strptime(date_end, '%Y-%m-%d %H:%M:%S')
2913+ date_end = pytz.utc.localize(date_end).astimezone(tz)
2914+ customer_date += ' - '
2915+ customer_date += datetime.strftime(date_end, '%H:%M')
2916+ res['customer_date'] = customer_date or ' '
2917+ result[route.id] = res
2918+ return result
2919+
2920+ def _get_street(self, cr, uid, ids, fields, args, context=None):
2921+ res = {}
2922+ for route in self.browse(cr, uid, ids):
2923+ res[route.id] = route.picking_id and route.picking_id.partner_id and route.picking_id.partner_id.street or ' n/a'
2924+ return res
2925+
2926+ def _route_to_update_after_picking_change(self, cr, uid, ids, fields=None, arg=None, context=None):
2927+ if type(ids) != type([]):
2928+ ids = [ids]
2929+ return self.pool.get('delivery.route.line').search(cr, uid, [('picking_id', 'in', ids)]) or []
2930+
2931+ def _route_to_update_after_dts_change(self, cr, uid, ids, fields=None, arg=None, context=None):
2932+ if type(ids) != type([]):
2933+ ids = [ids]
2934+ picking_ids = self.pool.get('stock.picking').search(cr, uid, [('dts_id', 'in', ids)]) or []
2935+ return self.pool.get('delivery.route.line')._route_to_update_after_picking_change(cr, uid, picking_ids, None, None, context=context)
2936+
2937+ def _route_to_update_after_so_change(self, cr, uid, ids, fields=None, arg=None, context=None):
2938+ if type(ids) != type([]):
2939+ ids = [ids]
2940+ return self.pool.get('delivery.route.line').search(cr, uid, [('sale_order_id', 'in', ids)]) or []
2941+
2942+ def _route_to_update_after_po_change(self, cr, uid, ids, fields=None, arg=None, context=None):
2943+ if type(ids) != type([]):
2944+ ids = [ids]
2945+ return self.pool.get('delivery.route.line').search(cr, uid, [('purchase_id', 'in', ids)]) or []
2946+
2947+ def _route_to_update_after_partner_change(self, cr, uid, ids, fields=None, arg=None, context=None):
2948+ if type(ids) != type([]):
2949+ ids = [ids]
2950+ picking_ids = self.pool.get('stock.picking').search(cr, uid, [('partner_id', 'in', ids)]) or []
2951+ return self.pool.get('delivery.route.line')._route_to_update_after_picking_change(cr, uid, picking_ids, None, None, context=context)
2952+
2953+ _store_dts = {
2954+ 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 10),
2955+ 'stock.picking': (_route_to_update_after_picking_change, ['pts_id'], 10),
2956+ }
2957+ _store_dts_name = {
2958+ 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 10),
2959+ 'stock.picking': (_route_to_update_after_picking_change, ['pts_id'], 10),
2960+ 'delivery.time': (_route_to_update_after_dts_change, ['name'], 10),
2961+ }
2962+ _store_special_time = {
2963+ 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 12),
2964+ 'stock.picking': (_route_to_update_after_picking_change, ['sale_id','dts_id'], 12),
2965+ 'sale.order': (_route_to_update_after_so_change, ['dts_id'], 12),
2966+ }
2967+ _store_neighborhood = {
2968+ 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id'], 10),
2969+ 'stock.picking': (_route_to_update_after_picking_change, ['partner_id'], 10),
2970+ 'res.partner': (_route_to_update_after_partner_change, ['vm_district'], 10),
2971+ }
2972+
2973+ _store_amount = {
2974+ 'delivery.route.line': (lambda self, cr, uid, ids, context: ids, ['picking_id', 'adjustment'], 10),
2975+ 'stock.picking': (_route_to_update_after_picking_change, ['sale_id', 'purchase_id', 'origin'], 10),
2976+ 'purchase.order': (_route_to_update_after_po_change, ['amount_total'], 10),
2977+ }
2978+
2979+ _store_street = {
2980+ 'delivery.route.line': (lambda self,cr,uid,ids,context: ids,['picking_id'],10),
2981+ 'stock.picking': (_route_to_update_after_picking_change, ['partner_id'], 10),
2982+ }
2983+
2984+ def _get_amount(self, cr, uid, ids, fields, args, context=None):
2985+ result = {}
2986+ for route in self.browse(cr, uid, ids):
2987+ res = {}
2988+ res['amount_total'] = 0.0
2989+ res['amount_unpaid'] = 0.0
2990+ res['to_be_received'] = 0.0
2991+
2992+ if route.picking_id and route.picking_id.sale_id:
2993+ res['amount_total'] = route.picking_id.sale_id.amount_total
2994+ res['amount_unpaid'] = res['amount_total']
2995+ res['to_be_received'] = res['amount_unpaid'] + route.adjustment
2996+ elif route.picking_id and route.picking_id.purchase_id:
2997+ res['amount_total'] = route.picking_id.purchase_id.amount_total
2998+ res['amount_unpaid'] = 0.0
2999+ res['to_be_received'] = res['amount_unpaid'] + route.adjustment
3000+ result[route.id] = res
3001+ return result
3002+
3003+ _columns = {
3004+ 'dts_id': fields.function(_get_dts_id, type='many2one', obj='delivery.time', store=_store_dts, string='Delivery Time', _classic_read=True),
3005+ 'dts_name': fields.function(_get_dts_name, type='char', size=124, store=_store_dts_name, string='Delivery Time'),
3006+ 'return_reasons': fields.one2many('delivery.return.reason', 'route_line_id', 'Return Reasons', readonly=False),
3007+ 'delivered_cpt': fields.related('picking_id', 'delivered_cpt', type='integer', string='Delivered x times', readonly=True),
3008+ 'customer_date': fields.function(_get_special_time, type='char', size=64, store=_store_special_time, multi="special_time", string=_('Customer Delivery Time')),
3009+ 'neighborhood': fields.function(_get_neighborhood, type='char', size=255, store=_store_neighborhood, string=_('Neighborhood')),
3010+ 'street': fields.function(_get_street, type='char', size=128, store=_store_street, string='Street'),
3011+ 'vip': fields.boolean('is VIP ?'),
3012+ 'amount_total': fields.function(_get_amount, type='float', multi="amount", store=_store_amount, string='Total'),
3013+ 'amount_unpaid': fields.function(_get_amount, type='float', multi="amount", store=_store_amount, string='Unpaid'),
3014+ 'adjustment': fields.float('Adjustment'),
3015+ 'cs_remark': fields.text('CS Remark'),
3016+ 'to_be_received': fields.function(_get_amount, type='float', multi="amount", store=_store_amount, string='To be Received'),
3017+ 'amount_received': fields.float('Received'),
3018+ 'account_checked': fields.boolean('Checked'),
3019+ 'account_remark': fields.text('Remark Accounting'),
3020+ }
3021+delivery_route_line()
3022+
3023+
3024+class res_users(osv.osv):
3025+ _inherit = 'res.users'
3026+
3027+ _columns = {
3028+ 'dts_id': fields.many2one('delivery.time', 'Last Used Delivery Time'),
3029+ }
3030+res_users()
3031+
3032+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3033
3034=== added directory 'delivery_plan/security'
3035=== added file 'delivery_plan/security/ir.model.access.csv'
3036--- delivery_plan/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
3037+++ delivery_plan/security/ir.model.access.csv 2013-09-09 08:37:27 +0000
3038@@ -0,0 +1,3 @@
3039+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
3040+access_delivery_return_reason_fc,delivery.return.reason.fc,delivery_plan.model_delivery_return_reason,delivery_routes.group_delivery_user,1,1,1,1
3041+access_delivery_return_reason_cs,delivery.return.reason.cs,delivery_plan.model_delivery_return_reason,delivery_routes.group_customer_service_user,1,1,0,0
3042
3043=== added file 'delivery_plan/sequence.xml'
3044--- delivery_plan/sequence.xml 1970-01-01 00:00:00 +0000
3045+++ delivery_plan/sequence.xml 2013-09-09 08:37:27 +0000
3046@@ -0,0 +1,18 @@
3047+<?xml version="1.0" encoding="utf-8"?>
3048+<openerp>
3049+ <data noupdate="1">
3050+ <!-- Sequences for sale.order -->
3051+ <record id="seq_type_picking_batch" model="ir.sequence.type">
3052+ <field name="name">Picking Batch</field>
3053+ <field name="code">picking.batch</field>
3054+ </record>
3055+
3056+ <record id="seq_picking_batch" model="ir.sequence">
3057+ <field name="name">Picking Batch</field>
3058+ <field name="code">picking.batch</field>
3059+ <field name="prefix">PB%(year)s%(month)s%(day)s</field>
3060+ <field name="padding">3</field>
3061+ <field name="company_id" eval="False"/>
3062+ </record>
3063+ </data>
3064+</openerp>
3065\ No newline at end of file
3066
3067=== added directory 'delivery_plan/static'
3068=== added directory 'delivery_plan/static/description'
3069=== added file 'delivery_plan/static/description/delivery_plan1.png'
3070Binary 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
3071=== added file 'delivery_plan/static/description/delivery_plan2.png'
3072Binary 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
3073=== added file 'delivery_plan/static/description/delivery_plan3.png'
3074Binary 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
3075=== added file 'delivery_plan/static/description/delivery_plan4.png'
3076Binary 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
3077=== added file 'delivery_plan/static/description/index.html'
3078--- delivery_plan/static/description/index.html 1970-01-01 00:00:00 +0000
3079+++ delivery_plan/static/description/index.html 2013-09-09 08:37:27 +0000
3080@@ -0,0 +1,40 @@
3081+ <section class="oe_container oe_website_only">
3082+
3083+ <div class="oe_row oe_more_spaced">
3084+ <h2 class="oe_slogan">delivery_plan Module</h2>
3085+ <h3 class="oe_slogan">Add and Edit Details of Delivery</h3>
3086+ <h4 class="oe_slogan"><a href="http://www.openerp.com.cn">By Elico Corp</a></h4>
3087+ <div class="oe_span6">
3088+ <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>
3089+ <div class="oe_span6">
3090+ <img class="oe_picture" src="delivery_plan1.png">
3091+ </div>
3092+ </div>
3093+ <div class="oe_span6">
3094+ <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
3095+ </div>
3096+ </div>
3097+ <div class="oe_span4 oe_centered">
3098+ <h3>Prepare Vans for DTS</h3>
3099+ <div class="oe_row_img oe_centered">
3100+ <img class="oe_picture" src="delivery_plan2.png">
3101+ </div>
3102+ </div>
3103+ <div class="oe_span4 oe_centered">
3104+ <h3>Prepare Routes for DTS</h3>
3105+ <div class="oe_row_img oe_centered">
3106+ <img class="oe_picture" src="delivery_plan3.png">
3107+ </div>
3108+ </div>
3109+ <div class="oe_span4 oe_centered">
3110+ <h3>Choose Driver for DTS</h3>
3111+ <div class="oe_row_img oe_centered">
3112+ <img class="oe_picture" src="delivery_plan4.png">
3113+ </div>
3114+ </div>
3115+ <div class="oe_row oe_centeralign oe_more_space" style="clear:both;">
3116+ <a href="http://www.elico-corp.com" class="oe_button oe_big"> Start your <span class="oe_emph">free</span> trial</a>
3117+ </div>
3118+ <h4 class="oe_slogan">or</h4>
3119+
3120+</section>
3121\ No newline at end of file
3122
3123=== added file 'delivery_plan/stock_view.xml'
3124--- delivery_plan/stock_view.xml 1970-01-01 00:00:00 +0000
3125+++ delivery_plan/stock_view.xml 2013-09-09 08:37:27 +0000
3126@@ -0,0 +1,694 @@
3127+<?xml version="1.0" encoding="utf-8"?>
3128+<openerp>
3129+ <data>
3130+
3131+ <record id="procurement_form_view_pts_elico" model="ir.ui.view">
3132+ <field name="name">procurement_form_view_pts_elico</field>
3133+ <field name="model">procurement.order</field>
3134+ <field name="inherit_id" ref="procurement.procurement_form_view" />
3135+ <field name="arch" type="xml">
3136+ <xpath expr="//field[@name='origin']" position="after">
3137+ <field name="pts_id" attrs="{'readonly': [('state','!=','draft')]}" domain="[('type','=','pts'),('active','=',True)]"/>
3138+ </xpath>
3139+ </field>
3140+ </record>
3141+ <record id="procurement_tree_view_pts_elico" model="ir.ui.view">
3142+ <field name="name">procurement_tree_view_pts_elico</field>
3143+ <field name="model">procurement.order</field>
3144+ <field name="inherit_id" ref="procurement.procurement_tree_view" />
3145+ <field name="arch" type="xml">
3146+ <xpath expr="//field[@name='origin']" position="before">
3147+ <field name="pts_id" domain="[('type','=','pts')]"/>
3148+ </xpath>
3149+ </field>
3150+ </record>
3151+
3152+ <record id="mrp_production_search_view_pts_elico" model="ir.ui.view">
3153+ <field name="name">mrp_production_search_view_pts_elico</field>
3154+ <field name="model">mrp.production</field>
3155+ <field name="inherit_id" ref="mrp.view_mrp_production_filter" />
3156+ <field name="arch" type="xml">
3157+ <xpath expr="//field[@string='Production']" position="after">
3158+ <field name="pts_id" context="{'domain':[('type','=','pts')]}"/>
3159+ </xpath>
3160+ <xpath expr="//filter[@string='Date']" position="after">
3161+ <filter string="Preparation Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'pts_id'}"/>
3162+ </xpath>
3163+ </field>
3164+ </record>
3165+ <record id="mrp_production_form_view_pts_elico" model="ir.ui.view">
3166+ <field name="name">mrp_production_form_view_pts_elico</field>
3167+ <field name="model">mrp.production</field>
3168+ <field name="inherit_id" ref="mrp.mrp_production_form_view" />
3169+ <field name="arch" type="xml">
3170+ <xpath expr="//field[@name='date_planned']" position="after">
3171+ <field name="pts_id" readonly="1" domain="[('type','=','pts'),('active','=',True)]"/>
3172+ </xpath>
3173+ </field>
3174+ </record>
3175+ <record id="mrp_production_tree_view_pts_elico" model="ir.ui.view">
3176+ <field name="name">mrp_production_tree_view_pts_elico</field>
3177+ <field name="model">mrp.production</field>
3178+ <field name="inherit_id" ref="mrp.mrp_production_tree_view" />
3179+ <field name="arch" type="xml">
3180+ <xpath expr="//field[@name='date_planned']" position="after">
3181+ <field name="pts_id" domain="[('type','=','pts')]"/>
3182+ </xpath>
3183+ </field>
3184+ </record>
3185+
3186+ <record id="view_picking_out_pts_form_elico" model="ir.ui.view">
3187+ <field name="name">stock.picking.out.form_pts_elico</field>
3188+ <field name="model">stock.picking.out</field>
3189+ <field name="inherit_id" ref="stock.view_picking_out_form"/>
3190+ <field name="arch" type="xml">
3191+ <xpath expr="//field[@name='partner_id']" position="after">
3192+ <field name="dts_id" readonly="1"/>
3193+ <field name="pts_id" on_change="pts_id_change(pts_id, context)" attrs="{'readonly': [('state','in',['cancel','done'])]}" domain="[('type','=','pts'),('active','=',True)]"/>
3194+ <field name="sale_id"/>
3195+ </xpath>
3196+ </field>
3197+ </record>
3198+
3199+ <record id="view_picking_out_pts_tree_elico" model="ir.ui.view">
3200+ <field name="name">stock.picking.out.tree_pts_elico</field>
3201+ <field name="model">stock.picking.out</field>
3202+ <field name="inherit_id" ref="stock.view_picking_out_tree"/>
3203+ <field name="arch" type="xml">
3204+ <xpath expr="//field[@name='partner_id']" position="after">
3205+ <field name="dts_id" domain="[('type','=','dts')]"/>
3206+ <field name="pts_id" domain="[('type','=','pts')]"/>
3207+ </xpath>
3208+ </field>
3209+ </record>
3210+ <record id="view_picking_pts_form_elico" model="ir.ui.view">
3211+ <field name="name">stock.picking.form_pts_elico</field>
3212+ <field name="model">stock.picking</field>
3213+ <field name="inherit_id" ref="stock.view_picking_form"/>
3214+ <field name="arch" type="xml">
3215+ <xpath expr="//field[@name='partner_id']" position="after">
3216+ <field name="dts_id" readonly="1"/>
3217+ <field name="pts_id" on_change="pts_id_change(pts_id, context)" attrs="{'readonly': [('state','in',['cancel','done'])]}" domain="[('type','=','pts'),('active','=',True)]"/>
3218+ </xpath>
3219+ </field>
3220+ </record>
3221+ <record id="view_picking_pts_tree_elico" model="ir.ui.view">
3222+ <field name="name">stock.picking.tree_pts_elico</field>
3223+ <field name="model">stock.picking</field>
3224+ <field name="inherit_id" ref="stock.vpicktree"/>
3225+ <field name="arch" type="xml">
3226+ <xpath expr="//field[@name='min_date']" position="after">
3227+ <field name="dts_id" domain="[('type','=','dts')]"/>
3228+ <field name="pts_id" domain="[('type','=','pts')]"/>
3229+ </xpath>
3230+ </field>
3231+ </record>
3232+ <record id="view_picking_in_pts_form_elico" model="ir.ui.view">
3233+ <field name="name">stock.picking.in.form_pts_elico</field>
3234+ <field name="model">stock.picking.in</field>
3235+ <field name="inherit_id" ref="stock.view_picking_in_form"/>
3236+ <field name="arch" type="xml">
3237+ <xpath expr="//field[@name='partner_id']" position="after">
3238+ <field name="dts_id" domain="[('type','=','dts'),('active','=',True)]" attrs="{'readonly': [('state','in',['cancel','done'])]}"/>
3239+ <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)]"/>
3240+ </xpath>
3241+ </field>
3242+ </record>
3243+ <record id="view_picking_in_pts_tree_elico" model="ir.ui.view">
3244+ <field name="name">stock.picking.in.tree_pts_elico</field>
3245+ <field name="model">stock.picking.in</field>
3246+ <field name="inherit_id" ref="stock.view_picking_in_tree"/>
3247+ <field name="arch" type="xml">
3248+ <xpath expr="//field[@name='partner_id']" position="after">
3249+ <field name="dts_id" domain="[('type','=','dts')]"/>
3250+ <!--field name="pts_id" invisible="1"/-->
3251+ </xpath>
3252+ </field>
3253+ </record>
3254+
3255+ <record id="view_order_pts_form_elico" model="ir.ui.view">
3256+ <field name="name">sale.order.form_pts_elico</field>
3257+ <field name="model">sale.order</field>
3258+ <field name="inherit_id" ref="sale.view_order_form"/>
3259+ <field name="arch" type="xml">
3260+ <xpath expr="//field[@name='date_order']" position="after">
3261+ <field name="dts_id" domain="[('type','=','dts')]"/>
3262+ <field name="pts_id" domain="[('type','=','pts')]"/>
3263+ <field name="start_date" />
3264+ <field name="end_date" />
3265+ <field name="so_payment_method"/>
3266+ </xpath>
3267+ </field>
3268+ </record>
3269+ <record id="view_order_pts_tree_elico" model="ir.ui.view">
3270+ <field name="name">sale.order.tree_pts_elico</field>
3271+ <field name="model">sale.order</field>
3272+ <field name="inherit_id" ref="sale.view_order_tree"/>
3273+ <field name="arch" type="xml">
3274+ <xpath expr="//field[@name='date_order']" position="after">
3275+ <field name="dts_id" domain="[('type','=','dts')]"/>
3276+ <field name="pts_id" domain="[('type','=','pts')]"/>
3277+ </xpath>
3278+ </field>
3279+ </record>
3280+ <record id="view_quotation_pts_tree_elico" model="ir.ui.view">
3281+ <field name="name">sale.quotation.tree_pts_elico</field>
3282+ <field name="model">sale.order</field>
3283+ <field name="inherit_id" ref="sale.view_quotation_tree"/>
3284+ <field name="arch" type="xml">
3285+ <xpath expr="//field[@name='date_order']" position="after">
3286+ <field name="dts_id" invisible="1"/>
3287+ <field name="pts_id" invisible="1"/>
3288+ </xpath>
3289+ </field>
3290+ </record>
3291+ <record id="view_order_pts_search_elico" model="ir.ui.view">
3292+ <field name="name">sale.order.search_pts_elico</field>
3293+ <field name="model">sale.order</field>
3294+ <field name="inherit_id" ref="sale.view_sales_order_filter"/>
3295+ <field name="arch" type="xml">
3296+ <xpath expr="/search/group/filter[@string='Order Date']" position="after">
3297+ <field name="pts_id" context="{'domain':[('type','=','pts')]}"/>
3298+ <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
3299+ <filter string="Preparation Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'pts_id'}"/>
3300+ <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_id'}"/>
3301+ </xpath>
3302+ </field>
3303+ </record>
3304+
3305+ <!-- Delivery Picking Tree -->
3306+ <record id="delivery_picking_tree" model="ir.ui.view">
3307+ <field name="name">stock.picking.tree</field>
3308+ <field name="model">stock.picking</field>
3309+ <field name="arch" type="xml">
3310+ <tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Picking list">
3311+ <field name="name"/>
3312+ <field name="origin"/>
3313+ <field name="partner_id"/>
3314+ <field name="street"/>
3315+ <field name="pts_id" invisible="1"/>
3316+ <field name="purchase_id" invisible="1"/>
3317+ <field name="sale_id" invisible="1"/>
3318+ <field name="dts_id"/>
3319+ <field name="min_date"/>
3320+ <field name="type"/>
3321+ <field name="state"/>
3322+ <field name="delivery_state"/>
3323+ <button name="%(delivery_routes.action_picking_get_order)d"
3324+ string="Related Order" type="action"
3325+ icon="terp-mail-forward"
3326+ attrs="{'invisible': [('purchase_id','=',None),('sale_id','=',None)]}"
3327+ groups="base.group_user"/>
3328+ </tree>
3329+ </field>
3330+ </record>
3331+
3332+ <!-- Delivery Picking Search -->
3333+ <record id="view_picking_internal_search_extend" model="ir.ui.view">
3334+ <field name="name">stock.picking.internal.search.extend</field>
3335+ <field name="model">stock.picking</field>
3336+ <field name="arch" type="xml">
3337+ <search string="Internal Picking List">
3338+ <field name="name" string="Internal Picking List" filter_domain="['|',('name','ilike', self),('origin','ilike',self)]"/>
3339+ <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"/>
3340+ <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"/>
3341+ <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"/>
3342+ <separator/>
3343+ <filter icon="terp-check" name="not_planned" string="Not Planned" domain="[('delivery_state','=','not_planned')]"/>
3344+ <filter icon="terp-check" name="delivery" string="In delivery" domain="[('delivery_state','=',['del_rt','in_del','in_del','in_del','planned'])]"/>
3345+ <filter icon="terp-check" name="delivered" string="Delivered" domain="[('delivery_state','=',['del_ok','del_ex','del_rt_exp'])]"/>
3346+ <separator/>
3347+ <filter icon="terp-check" name="available" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
3348+ <filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves"/>
3349+ <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Picking already processed"/>
3350+ <filter icon="terp-dialog-close" name="no_batch" string="No batch" domain="[('batch_id','=',None)]" help="Picking without batch"/>
3351+ <field name="partner_id"/>
3352+ <field name="batch_id"/>
3353+ <field name="product_id"/>
3354+ <field name="origin"/>
3355+ <field name="stock_journal_id"/>
3356+ <field name="pts_id" context="{'domain':[('type','=','pts')]}"/>
3357+ <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
3358+ <group expand="0" string="Group By...">
3359+ <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
3360+ <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
3361+ <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
3362+ <filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
3363+ <filter string="Batch" domain="[]" context="{'group_by':'batch_id'}"/>
3364+ <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
3365+ <filter string="Preparation Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'pts_id'}"/>
3366+ <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_id'}"/>
3367+ <filter string="Delivery State" icon="terp-folder-orange" domain="[]" context="{'group_by':'delivery_state'}"/>
3368+ </group>
3369+ </search>
3370+ </field>
3371+ </record>
3372+
3373+ <record id="delivery_routes.action_delivery_routes_picking" model="ir.actions.act_window">
3374+ <field name="name">Delivery Pickings</field>
3375+ <field name="res_model">stock.picking</field>
3376+ <field name="type">ir.actions.act_window</field>
3377+ <field name="view_type">form</field>
3378+ <field name="view_id" ref="delivery_picking_tree"/>
3379+ <field name="view_mode">tree,form,calendar</field>
3380+ <field name="domain">[('type','in',['out','in']),('return','=','none'),('state','!=','cancel')]</field>
3381+ <field name="context">{'default_type': 'out', 'search_default_for_today':1, 'contact_display': 'partner_address'}</field>
3382+ <field name="search_view_id" ref="view_picking_internal_search_extend"/>
3383+ <field name="help" type="html">
3384+ <p class="oe_view_nocontent_create">
3385+ </p><p>
3386+ Pack selected delivery notes
3387+ </p>
3388+ </field>
3389+ </record>
3390+
3391+ <!-- picking batch Form view -->
3392+ <record id="picking_batch_view" model="ir.ui.view">
3393+ <field name="name">picking.batch.form</field>
3394+ <field name="model">picking.batch</field>
3395+ <field name="type">form</field>
3396+ <field name="arch" type="xml">
3397+ <form string="Picking Batch" version="7.0">
3398+ <group>
3399+ <field name="name"/>
3400+ <field name="active"/>
3401+ </group>
3402+ <field name="picking_ids"/>
3403+ </form>
3404+ </field>
3405+ </record>
3406+
3407+ <!-- picking batch Tree view -->
3408+ <record id="picking_batch_tree_view" model="ir.ui.view">
3409+ <field name="name">picking.batch.tree</field>
3410+ <field name="model">picking.batch</field>
3411+ <field name="arch" type="xml">
3412+ <tree string="Picking Batch">
3413+ <field name="name"/>
3414+ </tree>
3415+ </field>
3416+ </record>
3417+
3418+ <!-- picking batch action -->
3419+ <record id="action_picking_batch" model="ir.actions.act_window">
3420+ <field name="name">Picking Batch</field>
3421+ <field name="res_model">picking.batch</field>
3422+ <field name="type">ir.actions.act_window</field>
3423+ <field name="view_type">form</field>
3424+ <field name="view_mode">tree,form</field>
3425+ </record>
3426+
3427+ <!-- Delivery route kanban view -->
3428+ <record model="ir.ui.view" id="delivery_routes.delivery_route_line_kanban_view">
3429+ <field name="name">delivery.route.line.kanban</field>
3430+ <field name="model">delivery.route.line</field>
3431+ <field name="arch" type="xml">
3432+ <kanban version="7.0" default_group_by="route_id" quick_creatable="false">
3433+ <field name="dts_id"/>
3434+ <field name="picking_id"/>
3435+ <field name="route_id"/>
3436+ <field name="address_id"/>
3437+ <field name="customer_date"/>
3438+ <field name="street"/>
3439+ <field name="note"/>
3440+ <field name="vip"/>
3441+ <field name="sequence"/>
3442+ <field name="color"/>
3443+ <field name="state"/>
3444+ <templates>
3445+ <t t-name="kanban-box">
3446+ <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">
3447+ <div class="oe_kanban_content">
3448+ <div>
3449+ <b><field name="origin"/></b> (<field name="delivered_cpt"/>)
3450+ <a t-if="record.vip.raw_value == 1" type="object" name="set_not_vip" class="oe_e oe_star_on">7</a>
3451+ <a t-if="record.vip.raw_value != 1" type="object" name="set_vip" class="oe_e oe_star_off">7</a>
3452+ </div>
3453+ <div>
3454+ <field name="address_id"/><br/>
3455+ <field name="street"/><br/>
3456+ <field name="customer_date"/><br/>
3457+ <div class="oe_ellipsis"><t t-raw="record.note.value"/></div>
3458+ </div>
3459+ </div>
3460+ <div class="oe_clear"></div>
3461+ </div>
3462+ <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">
3463+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
3464+ <span class="oe_e">í</span>
3465+ <ul class="oe_dropdown_menu">
3466+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
3467+ </ul>
3468+ </div>
3469+ <div class="oe_kanban_content">
3470+ <div>
3471+ <b><field name="origin"/></b> (<field name="delivered_cpt"/>)
3472+ <a t-if="record.vip.raw_value == 1" type="object" name="set_not_vip" class="oe_e oe_star_on">7</a>
3473+ <a t-if="record.vip.raw_value != 1" type="object" name="set_vip" class="oe_e oe_star_off">7</a>
3474+ </div>
3475+ <div>
3476+ <field name="address_id"/><br/>
3477+ <field name="street"/><br/>
3478+ <field name="customer_date"/>
3479+ <div class="oe_ellipsis"><t t-raw="record.note.value"/></div>
3480+ </div>
3481+ </div>
3482+ <div class="oe_clear"></div>
3483+ </div>
3484+ </t>
3485+ </templates>
3486+ </kanban>
3487+ </field>
3488+ </record>
3489+
3490+ <record id="delivery_routes.view_delivery_route_line_form" model="ir.ui.view">
3491+ <field name="name">delivery.route.line.form</field>
3492+ <field name="model">delivery.route.line</field>
3493+ <field name="arch" type="xml">
3494+ <form string="Delivery Route Line" version="7.0">
3495+ <header>
3496+ <!--button name="action_draft" string="Draft" type="object" states="cancel"/-->
3497+ <!--button name="action_confirm" string="Confirm" class="oe_highlight" type="object" states="draft"/-->
3498+ <!--button name="action_delivered" string="In delivery" type="object" class="oe_highlight" states="confirm"/-->
3499+ <button name="action_received" string="Received" type="object" class="oe_highlight" states="delivered" groups="delivery_routes.group_delivery_manager"/>
3500+ <button name="action_received_exp" string="Received with exception" type="object" states="delivered" groups="delivery_routes.group_delivery_manager"/>
3501+ <button name="action_returned" string="Returned" type="object" states="delivered" groups="delivery_routes.group_delivery_manager"/>
3502+ <button name="action_returned_exp" string="Returned, no Delivery" type="object" states="delivered" groups="delivery_routes.group_delivery_manager"/>
3503+ <button name="action_cancel" string="Cancel" type="object" states="confirm" groups="delivery_routes.group_delivery_user"/>
3504+ <field name="state" widget="statusbar" statusbar_visible="draft,confirm,delivered,received,returned,cancel" statusbar_colors='{"received":"green","returned":"red","delivered":"blue"}'/>
3505+ </header>
3506+ <sheet>
3507+ <group colspan="4" col="4">
3508+ <field name="sequence" attrs="{'readonly':[('state','not in',['draft'])]}"/>
3509+ <field name="route_id" attrs="{'readonly':[('state','not in',['draft'])]}"/>
3510+ <field name="address_id" readonly="1"/>
3511+ <field name="dts_id" domain="[('type','=','dts')]"/>
3512+ <!--field name="origin"/-->
3513+ <field name="street" readonly="1"/>
3514+ <field name="picking_id" domain="[('return','=','none'),('delivery_state','in',['not_planned','del_rt']),('type','in',['in','out']),('state','!=','cancel')]"/>
3515+ <field name="so_payment_method" readonly="1"/>
3516+ <field name="box_type"/>
3517+ <field name="visit_date"/>
3518+ <field name="driver" readonly="1"/>
3519+ <field name="purchase_id" attrs="{'invisible':[('purchase_id','=',False)]}"/>
3520+ <field name="sale_order_id" attrs="{'invisible':[('sale_order_id','=',False)]}"/>
3521+ <field name="exceptions" invisible="1"/>
3522+ <group colspan="4" col="1" attrs="{'invisible':[('exceptions','=',False),('state','not in',['returned'])]}">
3523+ <separator string="Return Reasons"/>
3524+ <field name="return_reasons" nolabel="1">
3525+ <tree editable="bottom">
3526+ <field name="type"/>
3527+ <field name="reason"/>
3528+ </tree>
3529+ </field>
3530+ </group>
3531+ <group colspan="4" col="2">
3532+ <separator string="Notes"/>
3533+ <separator string="DO Notes"/>
3534+ </group>
3535+ <group colspan="4" col="2">
3536+ <field name="note" nolabel="1"/>
3537+ <field name="picking_note" nolabel="1" readonly="1"/>
3538+ </group>
3539+ </group>
3540+ </sheet>
3541+ </form>
3542+ </field>
3543+ </record>
3544+
3545+ <record id="view_delivery_route_line_tree_elico" model="ir.ui.view">
3546+ <field name="name">delivery.route.line.tree_elico</field>
3547+ <field name="model">delivery.route.line</field>
3548+ <field name="inherit_id" ref="delivery_routes.view_delivery_route_line_tree"/>
3549+ <field name="arch" type="xml">
3550+ <xpath expr="//field[@name='origin']" position="after">
3551+ <field name="dts_id"/>
3552+ <field name="dts_name" invisible="1"/>
3553+ <field name="customer_date"/>
3554+ </xpath>
3555+ <xpath expr="//field[@name='note']" position="after">
3556+ <field name="amount_received" groups="account.group_account_user" sum="Total Received"/>
3557+ <field name="account_checked" string="OK" groups="account.group_account_user"/>
3558+ <field name="account_remark" string="Acc. Notes" groups="account.group_account_user"/>
3559+ </xpath>
3560+ </field>
3561+ </record>
3562+ <record id="delivery_routes.view_delivery_line_search" model="ir.ui.view">
3563+ <field name="name">delivery.route.line.search_elico</field>
3564+ <field name="model">delivery.route.line</field>
3565+ <field name="arch" type="xml">
3566+ <search string="Delivery Line">
3567+ <field name="picking_id" />
3568+ <field name="address_id" />
3569+ <field name="origin" />
3570+ <filter name="no_route" string="no route" domain="[('route_id','=',None)]" help="line without route" />
3571+ <filter icon="terp-go-today" string="Today" domain="[('route_id.date','=',time.strftime('%%Y-%%m-%%d'))]" help="Delivery for Today" name="today"/>
3572+ <group expand="0" string="Group By...">
3573+ <filter string="Route" icon="terp-folder-orange" domain="[]" context="{'group_by':'route_id'}"/>
3574+ <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_name'}"/>
3575+ <filter string="State" icon="terp-folder-orange" domain="[]" context="{'group_by':'state'}"/>
3576+ </group>
3577+ </search>
3578+ </field>
3579+ </record>
3580+
3581+ <!--record model="ir.ui.view" id="delivery_route_address_kanban_view">
3582+ <field name="name">delivery.route.address.kanban</field>
3583+ <field name="model">delivery.route.line</field>
3584+ <field name="arch" type="xml">
3585+ <kanban version="7.0">
3586+ <field name="dts_id"/>
3587+ <field name="picking_id"/>
3588+ <field name="route_id"/>
3589+ <field name="address_id"/>
3590+ <field name="note"/>
3591+ <field name="sequence"/>
3592+ <templates>
3593+ <t t-name="kanban-box">
3594+ <div t-attf-class="oe_kanban_card oe_kanban_global_click">
3595+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
3596+ <span class="oe_e">í</span>
3597+ <ul class="oe_dropdown_menu">
3598+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
3599+ <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
3600+ </ul>
3601+ </div>
3602+ <div class="oe_kanban_content">
3603+ <div><b><field name="street"/></b></div>
3604+ </div>
3605+ <div class="oe_clear"></div>
3606+ </div>
3607+ </t>
3608+ </templates>
3609+ </kanban>
3610+ </field>
3611+ </record-->
3612+
3613+
3614+ <record id="action_delivery_return_type" model="ir.actions.act_window">
3615+ <field name="name">Return Reason Type</field>
3616+ <field name="type">ir.actions.act_window</field>
3617+ <field name="res_model">delivery.return.type</field>
3618+ <field name="view_type">form</field>
3619+ <field name="view_mode">tree,form</field>
3620+ </record>
3621+ <menuitem action="action_delivery_return_type" id="menu_action_delivery_return_type" parent="delivery_routes.menu_delivery_config" sequence="99"/>
3622+
3623+
3624+ <menuitem name="Delivery Payments"
3625+ id="menu_delivery_delivery_payment"
3626+ parent="delivery_routes.menu_delivery_root"
3627+ groups="delivery_routes.group_customer_service_user,account.group_account_user"
3628+ sequence="5"/>
3629+
3630+
3631+ <record id="view_delivery_route_form_cs" model="ir.ui.view">
3632+ <field name="name">delivery.route.form_CS</field>
3633+ <field name="model">delivery.route</field>
3634+ <field name="priority">17</field>
3635+ <field name="arch" type="xml">
3636+ <form string="Delivery Route" version="7.0">
3637+ <header>
3638+ <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)]}"/>
3639+ <button name="action_done" string="Done" type="object" class="oe_highlight" states="departure" groups="account.group_account_user"/>
3640+ <field name="state" widget="statusbar" statusbar_visible="draft,confirm,departure,done,cancel" statusbar_colors='{"done":"green","cancel":"red","departure":"blue"}'/>
3641+ </header>
3642+ <sheet>
3643+ <group colspan="4" col="4">
3644+ <field name="name" readonly="1"/>
3645+ <field name="date" readonly="1"/>
3646+ <field name="departure_date" readonly="1"/>
3647+ <field name="arrive_date"/>
3648+ <field name="dts_id" readonly="1"/>
3649+ <newline />
3650+ <field name="driver_id" readonly="1"/>
3651+ <field name="picker_id" readonly="1"/>
3652+ <field name="confirm_cs" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('state','not in',['confirm','draft'])]}"/>
3653+ <newline />
3654+ <field name="line_ids" colspan="4" nolabel="1">
3655+ <tree editable="bottom" create="false" delete="false">
3656+ <field name="origin"/>
3657+ <field name="amount_total" sum="Total"/>
3658+ <field name="amount_unpaid" sum="Total Unpaid"/>
3659+ <field name="adjustment" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}" sum="Total Adjustment"/>
3660+ <field name="cs_remark" string="CS Notes" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}"/>
3661+ <field name="to_be_received" sum="Total to be received" string="To be Rec."/>
3662+ <field name="amount_received" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}" sum="Total Received"/>
3663+ <field name="account_checked" string="OK" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
3664+ <field name="account_remark" string="Acc. Notes" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
3665+ <field name="complete_state" string="State" readonly="1"/>
3666+ <field name="state" invisible="1"/>
3667+ <field name="confirm_cs" invisible="1"/>
3668+ </tree>
3669+ </field>
3670+ </group>
3671+ </sheet>
3672+ </form>
3673+ </field>
3674+ </record>
3675+ <record id="view_delivery_route_tree_cs" model="ir.ui.view">
3676+ <field name="name">delivery.route.tree_cs</field>
3677+ <field name="model">delivery.route</field>
3678+ <field name="type">tree</field>
3679+ <field name="arch" type="xml">
3680+ <tree string="Delivery Routes">
3681+ <field name="name"/>
3682+ <field name="date"/>
3683+ <field name="dts_id"/>
3684+ <field name="departure_date"/>
3685+ <field name="arrive_date"/>
3686+ <field name="state"/>
3687+ </tree>
3688+ </field>
3689+ </record>
3690+ <record id="view_delivery_search_cs" model="ir.ui.view">
3691+ <field name="name">delivery.route.search_cs</field>
3692+ <field name="model">delivery.route</field>
3693+ <field name="arch" type="xml">
3694+ <search string="Delivery Route">
3695+ <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
3696+ <field name="date"/>
3697+ <filter icon="terp-go-today" string="Today" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]" help="Delivery Route for Today" name="today"/>
3698+ <group expand="0" string="Group By...">
3699+ <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_id'}"/>
3700+ </group>
3701+ </search>
3702+ </field>
3703+ </record>
3704+ <record id="action_delivery_route_form_cs" model="ir.actions.act_window">
3705+ <field name="name">Delivery Route CS</field>
3706+ <field name="type">ir.actions.act_window</field>
3707+ <field name="res_model">delivery.route</field>
3708+ <field name="view_type">form</field>
3709+ <field name="view_mode">tree,form</field>
3710+ <field name="context">{'active_test':False,'search_default_today':True,'force_update':True}</field>
3711+ <field name="search_view_id" ref="view_delivery_search_cs"/>
3712+ </record>
3713+ <record id="action_delivery_route_form_form_cs" model="ir.actions.act_window.view">
3714+ <field name="view_mode">form</field>
3715+ <field name="sequence">2</field>
3716+ <field name="view_id" ref="view_delivery_route_form_cs"/>
3717+ <field name="act_window_id" ref="action_delivery_route_form_cs"/>
3718+ </record>
3719+ <record id="action_delivery_route_form_tree_cs" model="ir.actions.act_window.view">
3720+ <field name="view_mode">tree</field>
3721+ <field name="sequence">1</field>
3722+ <field name="view_id" ref="view_delivery_route_tree_cs"/>
3723+ <field name="act_window_id" ref="action_delivery_route_form_cs"/>
3724+ </record>
3725+ <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"/>
3726+
3727+ <record id="view_delivery_line_tree_cs" model="ir.ui.view">
3728+ <field name="name">delivery.route.line.tree_cs</field>
3729+ <field name="model">delivery.route.line</field>
3730+ <field name="type">tree</field>
3731+ <field name="arch" type="xml">
3732+ <tree string="Delivery Route Lines" editable="bottom" create="false" delete="false">
3733+ <field name="origin" readonly="1"/>
3734+ <field name="dts_id" readonly="1"/>
3735+ <field name="dts_name" invisible="1"/>
3736+ <field name="route_id" invisible="1"/>
3737+ <field name="address_id" readonly="1"/>
3738+ <field name="amount_total" sum="Total"/>
3739+ <field name="amount_unpaid" sum="Total Unpaid"/>
3740+ <field name="adjustment" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}" sum="Total Adjustment"/>
3741+ <field name="cs_remark" groups="delivery_routes.group_customer_service_user" attrs="{'readonly':[('confirm_cs','=',True)]}"/>
3742+ <field name="to_be_received" sum="Total to be received"/>
3743+ <field name="amount_received" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}" sum="Total Received"/>
3744+ <field name="account_checked" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
3745+ <field name="account_remark" groups="account.group_account_user" attrs="{'readonly':[('state','not in',['received','returned'])]}"/>
3746+ <field name="complete_state" readonly="1"/>
3747+ <field name="state" invisible="1"/>
3748+ <field name="confirm_cs" invisible="1"/>
3749+ </tree>
3750+ </field>
3751+ </record>
3752+ <record id="view_delivery_line_search_cs" model="ir.ui.view">
3753+ <field name="name">delivery.route.search_cs</field>
3754+ <field name="model">delivery.route.line</field>
3755+ <field name="arch" type="xml">
3756+ <search string="Delivery Route">
3757+ <field name="dts_id" context="{'domain':[('type','=','dts')]}"/>
3758+ <field name="origin"/>
3759+ <filter icon="terp-go-today" string="Today" domain="[('route_id.date','=',time.strftime('%%Y-%%m-%%d'))]" help="Delivery Route for Today" name="today"/>
3760+ <group expand="0" string="Group By...">
3761+ <filter string="Delivery Time" icon="terp-folder-orange" domain="[]" context="{'group_by':'dts_name'}"/>
3762+ </group>
3763+ </search>
3764+ </field>
3765+ </record>
3766+ <record id="action_delivery_line_form_cs" model="ir.actions.act_window">
3767+ <field name="name">Delivery Route Line CS</field>
3768+ <field name="type">ir.actions.act_window</field>
3769+ <field name="res_model">delivery.route.line</field>
3770+ <field name="view_type">form</field>
3771+ <field name="view_mode">tree</field>
3772+ <field name="context">{'active_test':False,'search_default_today':True,'force_update':True}</field>
3773+ <field name="search_view_id" ref="view_delivery_line_search_cs"/>
3774+ </record>
3775+ <record id="action_delivery_line_form_tree_cs" model="ir.actions.act_window.view">
3776+ <field name="view_mode">tree</field>
3777+ <field name="sequence">1</field>
3778+ <field name="view_id" ref="view_delivery_line_tree_cs"/>
3779+ <field name="act_window_id" ref="action_delivery_line_form_cs"/>
3780+ </record>
3781+ <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"/>
3782+
3783+
3784+
3785+
3786+
3787+
3788+ <!-- Menu -->
3789+ <!--
3790+ <menuitem action="action_picking_batch" name="Picking Batch"
3791+ id="menu_action_picking_batch"
3792+ parent="delivery_routes.menu_delivery_delivery" sequence="9"/>
3793+ -->
3794+
3795+ <!-- picking Form view -->
3796+ <!--
3797+ <record model='ir.ui.view' id='picking_batch_form_view'>
3798+ <field name='name'>Delivery Routes Picking Form Inherit</field>
3799+ <field name='model'>stock.picking</field>
3800+ <field name='inherit_id' ref='stock.view_picking_form'/>
3801+ <field name='type'>form</field>
3802+ <field name="priority" eval="2"/>
3803+ <field name='arch' type='xml'>
3804+ <field name="move_type" position="after">
3805+ <field name="batch_id" />
3806+ <field name="pts_id" domain="[('type','=','pts'),('active','=',True)]"/>
3807+ <field name="route_line_id"/>
3808+ <field name="delivery_date"/>
3809+ <field name="route_state"/>
3810+ <field name="delivered"/>
3811+ </field>
3812+ </field>
3813+ </record>
3814+ <menuitem action="action_picking_pack_tree" name="Delivery Picking"
3815+ id="menu_action_picking_pack"
3816+ parent="delivery_routes.menu_delivery_delivery" sequence="10"/>
3817+ -->
3818+ <!-- Menu -->
3819+ </data>
3820+</openerp>
3821
3822=== added directory 'delivery_plan/wizard'
3823=== added file 'delivery_plan/wizard/__init__.py'
3824--- delivery_plan/wizard/__init__.py 1970-01-01 00:00:00 +0000
3825+++ delivery_plan/wizard/__init__.py 2013-09-09 08:37:27 +0000
3826@@ -0,0 +1,25 @@
3827+# -*- coding: utf-8 -*-
3828+##############################################################################
3829+#
3830+# OpenERP, Open Source Management Solution
3831+# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
3832+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
3833+#
3834+# This program is free software: you can redistribute it and/or modify
3835+# it under the terms of the GNU Affero General Public License as
3836+# published by the Free Software Foundation, either version 3 of the
3837+# License, or (at your option) any later version.
3838+#
3839+# This program is distributed in the hope that it will be useful,
3840+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3841+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3842+# GNU Affero General Public License for more details.
3843+#
3844+# You should have received a copy of the GNU Affero General Public License
3845+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3846+#
3847+##############################################################################
3848+
3849+import stock
3850+
3851+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3852
3853=== added file 'delivery_plan/wizard/stock.py'
3854--- delivery_plan/wizard/stock.py 1970-01-01 00:00:00 +0000
3855+++ delivery_plan/wizard/stock.py 2013-09-09 08:37:27 +0000
3856@@ -0,0 +1,503 @@
3857+# -*- coding: utf-8 -*-
3858+##############################################################################
3859+#
3860+# OpenERP, Open Source Management Solution
3861+# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
3862+# Author: Yannick Gouin <yannick.gouin@elico-corp.com>
3863+#
3864+# This program is free software: you can redistribute it and/or modify
3865+# it under the terms of the GNU Affero General Public License as
3866+# published by the Free Software Foundation, either version 3 of the
3867+# License, or (at your option) any later version.
3868+#
3869+# This program is distributed in the hope that it will be useful,
3870+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3871+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3872+# GNU Affero General Public License for more details.
3873+#
3874+# You should have received a copy of the GNU Affero General Public License
3875+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3876+#
3877+##############################################################################
3878+
3879+import threading
3880+from openerp import netsvc
3881+from openerp import pooler
3882+from openerp import tools
3883+from openerp.tools.translate import _
3884+from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
3885+from osv import osv, fields
3886+from datetime import datetime
3887+from dateutil.relativedelta import relativedelta
3888+import math
3889+import pytz
3890+import logging
3891+logger = logging.getLogger(__name__)
3892+
3893+
3894+class delivery_dts_to_routes(osv.osv_memory):
3895+ _name = 'delivery.dts_to_routes'
3896+
3897+ def _init_dts_id(self, cr, uid, context=None):
3898+ last_dts = self.pool.get('res.users').read(cr, 1, [uid], ['dts_id'])[0]['dts_id']
3899+ if last_dts:
3900+ ids = self.pool.get('delivery.time').search(cr, uid, [('id', '=', last_dts[0])])
3901+ else:
3902+ now = datetime.now()
3903+ ids = self.pool.get('delivery.time').search(cr, uid, [('type', '=', 'dts'), ('active', '=', True), ('name', 'ilike', datetime.strftime(now, '%y%m%d') + '%')])
3904+ return ids and ids[0] or False
3905+
3906+ _columns = {
3907+ 'dts_id': fields.many2one('delivery.time', 'Delivery Time', select=True, required=True, domain=[('type', '=', 'dts'), ('active', '=', True)]),
3908+ }
3909+ _defaults = {
3910+ 'dts_id': lambda self, cr, uid, context: self._init_dts_id(cr, uid, context=context),
3911+ }
3912+
3913+ def generate_routes(self, cr, uid, ids, context=None):
3914+ context = context or {}
3915+ route_obj = self.pool.get('delivery.route')
3916+ line_obj = self.pool.get('delivery.route.line')
3917+
3918+ if ids:
3919+ data = self.browse(cr, uid, ids)[0]
3920+ else:
3921+ data = self.pool.get('delivery.time').browse(cr, 1, context['wiz_dts_id'])
3922+ self.pool.get('res.users').write(cr, 1, [uid], {'dts_id':data.dts_id.id})
3923+
3924+ color2routes = {}
3925+ line_ids = line_obj.search(cr, uid, [("dts_id", "=", data.dts_id.id)], order="color")
3926+ for line in line_obj.browse(cr, uid, line_ids):
3927+ route_id = False
3928+ base_name = data.dts_id.name.split()[0]
3929+ if line.color > 0:
3930+ line_color = str(line.color).rjust(2, '0')
3931+ if line_color in color2routes:
3932+ route_id = color2routes[line_color]
3933+ else:
3934+ route_ids = route_obj.search(cr, uid, [('name', '=', base_name + str(line_color))], context=context)
3935+ route_id = route_ids and route_ids[0] or False
3936+ color2routes.update({line_color: route_id})
3937+
3938+ if not route_id:
3939+ route_id = route_obj.create(cr, uid, {
3940+ 'name': base_name + str(line_color),
3941+ 'date': data.dts_id.start_date and data.dts_id.start_date.split() and data.dts_id.start_date.split()[0] or False,
3942+ 'dts_id': data.dts_id.id,
3943+ 'departure_date': data.dts_id.start_date or False,
3944+ 'arrive_date': data.dts_id.end_date or False,
3945+ })
3946+ color2routes.update({line_color: route_id})
3947+ line_obj.write(cr, uid, [line.id], {'route_id':route_id}, context={'force_update':1})
3948+
3949+ #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)]
3950+ 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)]
3951+
3952+ return {
3953+ 'type': 'ir.actions.act_window',
3954+ 'res_model':'delivery.route.line',
3955+ 'view_type':'form',
3956+ 'view_mode':'kanban,form',
3957+ 'context':"{'update_color':1,'view_name':'delivery.route.line.kanban','force_dts_id_kanban': %s}" % data.dts_id.id,
3958+ 'domain': domain,
3959+ }
3960+delivery_dts_to_routes()
3961+
3962+
3963+class delivery_dts_to_vans(osv.osv_memory):
3964+ _name = 'delivery.dts_to_vans'
3965+
3966+ def _init_dts_id(self, cr, uid, context=None):
3967+ last_dts = self.pool.get('res.users').read(cr, 1, [uid], ['dts_id'])[0]['dts_id']
3968+ if last_dts:
3969+ ids = self.pool.get('delivery.time').search(cr, uid, [('id', '=', last_dts[0])])
3970+ else:
3971+ now = datetime.now()
3972+ ids = self.pool.get('delivery.time').search(cr, uid, [('type', '=', 'dts'), ('active', '=', True), ('name', 'ilike', datetime.strftime(now, '%y%m%d') + '%')])
3973+ return ids and ids[0] or False
3974+
3975+ _columns = {
3976+ 'dts_id': fields.many2one('delivery.time', 'Delivery Time', select=True, required=True, domain=[('type', '=', 'dts'), ('active', '=', True)]),
3977+ }
3978+ _defaults = {
3979+ 'dts_id': lambda self, cr, uid, context: self._init_dts_id(cr, uid, context=context),
3980+ }
3981+
3982+ def open_kanban(self, cr, uid, ids, context=None):
3983+ if ids:
3984+ data = self.browse(cr, uid, ids)[0]
3985+ else:
3986+ data = self.pool.get('delivery.time').browse(cr, 1, context['wiz_dts_id'])
3987+ self.pool.get('res.users').write(cr, 1, [uid], {'dts_id':data.dts_id.id})
3988+ #domain = [("picking_id.state", "!=", "cancel"), ("picking_id.type", "in", ["in", "out"]), ("dts_id", "=", data.dts_id.id)]
3989+ 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)]
3990+
3991+ return {
3992+ 'type': 'ir.actions.act_window',
3993+ 'res_model':'delivery.route.line',
3994+ 'view_type':'form',
3995+ 'view_mode':'kanban,form',
3996+ 'context':"{'view_name':'delivery.route.line.kanban_fc','sorting':'neighborhood,street,picking_id','check4color':" + str(data.dts_id.id) + "}",
3997+ 'domain': domain,
3998+ }
3999+delivery_dts_to_vans()
4000+
4001+
4002+
4003+class delivery_driver_for_routes(osv.osv_memory):
4004+ _name = 'delivery.driver_for_routes'
4005+
4006+ def _init_dts_id(self, cr, uid, context=None):
4007+ last_dts = self.pool.get('res.users').read(cr, 1, [uid], ['dts_id'])[0]['dts_id']
4008+ if last_dts:
4009+ ids = self.pool.get('delivery.time').search(cr, uid, [('id', '=', last_dts[0])])
4010+ else:
4011+ now = datetime.now()
4012+ ids = self.pool.get('delivery.time').search(cr, uid, [('type', '=', 'dts'), ('active', '=', True), ('name', 'ilike', datetime.strftime(now, '%y%m%d') + '%')])
4013+ return ids and ids[0] or False
4014+
4015+ _columns = {
4016+ 'dts_id': fields.many2one('delivery.time', 'Delivery Time', select=True, required=True, domain=[('type', '=', 'dts'), ('active', '=', True)]),
4017+ #'action': fields.selection([('driver_id','Driver'),('picker_id','Deliver')], string="Choose", required=True),
4018+ }
4019+ _defaults = {
4020+ 'dts_id': lambda self, cr, uid, context: self._init_dts_id(cr, uid, context=context),
4021+ #'action': lambda *a: 'driver_id',
4022+ }
4023+
4024+ def open_kanban(self, cr, uid, ids, context=None):
4025+ if ids:
4026+ data = self.browse(cr, uid, ids)[0]
4027+ else:
4028+ data = self.pool.get('delivery.time').browse(cr, 1, context['wiz_dts_id'])
4029+ self.pool.get('res.users').write(cr, 1, [uid], {'dts_id':data.dts_id.id})
4030+ driver_pool = self.pool.get('delivery.driver')
4031+ route_tmp_pool = self.pool.get('delivery.route_tmp')
4032+ route_pool = self.pool.get('delivery.route')
4033+
4034+ #cr.execute("DELETE FROM delivery_route_tmp WHERE dts_id=" + data.dts_id.id + " ")
4035+ cr.execute("DELETE FROM delivery_route_tmp")
4036+ cr.execute("UPDATE delivery_driver SET tmp_route_id = Null")
4037+ cr.commit()
4038+
4039+ route_ids = route_pool.search(cr, uid, [('dts_id', '=', data.dts_id.id)]) or []
4040+ for route in route_pool.browse(cr, uid, route_ids):
4041+ route_tmp_id = route_tmp_pool.create(cr, uid, {'dts_id': data.dts_id.id, 'route_id': route.id, 'name': route.name})
4042+ if route.driver_id:
4043+ driver_pool.write(cr, uid, [route.driver_id.id], {'tmp_route_id': route_tmp_id})
4044+ if route.picker_id:
4045+ driver_pool.write(cr, uid, [route.picker_id.id], {'tmp_route_id': route_tmp_id})
4046+
4047+ return {
4048+ 'type': 'ir.actions.act_window',
4049+ 'res_model':'delivery.driver',
4050+ 'view_type':'tree',
4051+ 'view_mode':'kanban',
4052+ 'context':"{'force_dts_id': %s}" % (data.dts_id.id),
4053+ }
4054+delivery_driver_for_routes()
4055+
4056+
4057+class delivery_change_dts(osv.osv_memory):
4058+ _name = 'delivery.change.dts'
4059+ _description = 'Change DTS / PTS'
4060+
4061+ _columns = {
4062+ 'action': fields.selection([('cleanup', 'Blank DTS/PTS'), ('change', 'Change DTS/PTS')], string='Action', required=True),
4063+ 'dts_id': fields.many2one('delivery.time', 'Delivery Time', domain=[('type', '=', 'dts')]),
4064+ 'pts_id': fields.many2one('delivery.time', 'Preparation Time', domain=[('type', '=', 'pts')]),
4065+ }
4066+ _defaults = {
4067+ 'action': 'change',
4068+ }
4069+
4070+
4071+ def dts_id_change(self, cr, uid, ids, dts_id, pts_id, context=None):
4072+ context = context or {}
4073+ new_pts_id = False
4074+
4075+ if pts_id and dts_id:
4076+ pts_pool = self.pool.get('delivery.time')
4077+ pts = pts_pool.browse(cr, uid, [pts_id])[0]
4078+ if pts.dts_id.id == dts_id:
4079+ new_pts_id = pts_id
4080+ return {'value': {'pts_id': new_pts_id}}
4081+
4082+
4083+ def change_dts(self, cr, uid, ids, context=None):
4084+ context = context or {}
4085+ context.update({'update_pts':1})
4086+ pick_ids = context.get('active_ids', False) or context.get('active_id', False) or []
4087+ if pick_ids and type(pick_ids) != type([]):
4088+ pick_ids = [pick_ids]
4089+
4090+ if pick_ids:
4091+ move_pool = self.pool.get('stock.move')
4092+ pick_pool = self.pool.get('stock.picking')
4093+ this = self.browse(cr, uid, ids[0], context=context)
4094+
4095+ if this.action == 'cleanup':
4096+ pts_id = False
4097+ dts_id = False
4098+ else:
4099+ dts_id = this.dts_id and this.dts_id.id or False
4100+ if dts_id:
4101+ pts_id = this.pts_id and this.pts_id.id or False
4102+ else:
4103+ pts_id = False
4104+
4105+ for pick in pick_pool.browse(cr, uid, pick_ids):
4106+ if pick.state not in ['cancel'] and pick.delivery_state in ["not_planned", "del_rt", ""]:
4107+ pick_pool.write(cr, uid, [pick.id], {'pts_id':pts_id, 'dts_id':dts_id}, context=context)
4108+ return {'type': 'ir.actions.act_window_close'}
4109+
4110+delivery_change_dts()
4111+
4112+
4113+
4114+########## TO BE DELETED ASAP ###############
4115+class dts_reset(osv.osv):
4116+ _name = 'dts.reset'
4117+
4118+ def resetall(self, cursor, uid, context=None):
4119+ logger.warning('################ START ################')
4120+ picking_obj = self.pool.get('stock.picking')
4121+ delivery_obj = self.pool.get('delivery.route.line')
4122+
4123+ cr2 = pooler.get_db(cursor.dbname).cursor()
4124+ cr2.execute("SELECT DISTINCT picking_id FROM delivery_route_line WHERE picking_id is not null")
4125+ pick_ids = map(lambda x: x[0], cr2.fetchall())
4126+ picking_ids = picking_obj.search(cr2, uid, [('id','not in',pick_ids),('state','not in',['cancel']),('type','in',['in','out'])])
4127+ for sp in picking_ids:
4128+ delivery_obj.create(cr2, uid, {'picking_id':sp, })
4129+ cr2.commit()
4130+ logger.warning('#### %s done #### '%sp)
4131+ #cancel picking canceled
4132+ logger.warning('################ DONE ################')
4133+ cr2.close()
4134+
4135+ """
4136+ logger.warning('################ START ################')
4137+ tz = pytz.timezone('Asia/Shanghai')
4138+ tz2 = pytz.timezone('America/Anchorage')
4139+ move_obj = self.pool.get('stock.move')
4140+ picking_obj = self.pool.get('stock.picking')
4141+ procurement_obj = self.pool.get('procurement.order')
4142+ delivery_time_obj = self.pool.get('delivery.time')
4143+ time_slot_obj = self.pool.get('delivery.time.slot')
4144+ so_pool = self.pool.get('sale.order')
4145+
4146+ use_new_cursor = cursor.dbname
4147+ cr = pooler.get_db(use_new_cursor).cursor()
4148+ cr2 = pooler.get_db(use_new_cursor).cursor()
4149+ cr3 = pooler.get_db(use_new_cursor).cursor()
4150+
4151+ cr2.execute("SELECT DISTINCT sale_id FROM stock_picking WHERE sale_id is not null AND sale_id > 0")
4152+ ids_from_pick = map(lambda x: x[0], cr2.fetchall())
4153+ so_ids = so_pool.search(cr3, uid, [('id','not in',ids_from_pick)])
4154+
4155+ cpt_commit = 1
4156+ for order in so_pool.browse(cr3, uid, so_ids):
4157+ val = {}
4158+ dts = False
4159+ pts = False
4160+ pt_id = False
4161+ dt_id = False
4162+ min_date = False
4163+ slot_id = False
4164+
4165+ try:
4166+ now = datetime.now()
4167+ address = order.partner_shipping_id or order.partner_id or False
4168+
4169+ if order.start_date:
4170+ min_date = order.start_date
4171+ dts = order.start_date
4172+ dts = datetime.strptime(dts, '%Y-%m-%d %H:%M:%S')
4173+ dts = pytz.utc.localize(dts).astimezone(tz)
4174+ if order.cdate:
4175+ pts = datetime.strptime(order.cdate, '%Y-%m-%d %H:%M:%S')
4176+ pts = pytz.utc.localize(pts).astimezone(tz)
4177+ elif order.date_order:
4178+ pts = datetime.strptime(order.date_order, '%Y-%m-%d')
4179+ pts = pytz.utc.localize(pts).astimezone(tz)
4180+ if not pts:
4181+ pts = dts
4182+
4183+ if dts:
4184+ start_date = datetime.strftime(dts, '%Y-%m-%d')
4185+ if address and (not address.city or address.city.lower() in ['shanghai']):
4186+ from_time = datetime.strftime(dts, '%H:%M')
4187+ else:#eg: in Nanjing
4188+ from_time = '09:30'
4189+ name = datetime.strftime(dts, '%y%m%d')
4190+ name_pts = name
4191+ start_date_pts = start_date
4192+
4193+ slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'dts')], order='max_time')
4194+ if slot_ids:
4195+ slot = time_slot_obj.browse(cr, uid, slot_ids[0])
4196+ name += slot.name
4197+ end_date = start_date + ' ' + slot.end_time
4198+ start_date += ' ' + slot.start_time
4199+ start_date = datetime.strptime(start_date, '%Y-%m-%d %H:%M')
4200+ start_date = pytz.utc.localize(start_date).astimezone(tz2)
4201+ start_date = datetime.strftime(start_date, '%Y-%m-%d %H:%M')
4202+ end_date = datetime.strptime(end_date, '%Y-%m-%d %H:%M')
4203+ end_date = pytz.utc.localize(end_date).astimezone(tz2)
4204+ end_date = datetime.strftime(end_date, '%Y-%m-%d %H:%M')
4205+
4206+ cr2.execute("SELECT id FROM delivery_time WHERE name='" + name + "' AND type='dts' AND slot_id='" + str(slot.id) + "'")
4207+ dt_ids = map(lambda x: x[0], cr2.fetchall())
4208+ if dt_ids:
4209+ dt_id = dt_ids[0]
4210+ else:
4211+ dt_id = delivery_time_obj.create(cr3, uid, {
4212+ 'name':name,
4213+ 'start_date': start_date,
4214+ 'end_date': end_date,
4215+ 'active': True,
4216+ 'type': 'dts',
4217+ 'slot_id': slot.id,
4218+ }, context)
4219+ cr3.commit()
4220+ cr2.commit()
4221+
4222+ if pts and dt_id:
4223+ date_pts = datetime.strftime(pts, '%Y-%m-%d')
4224+ from_time = datetime.strftime(pts, '%H:%M')
4225+ if date_pts < datetime.strftime(dts, '%Y-%m-%d'):
4226+ date_pts = datetime.strftime(dts, '%Y-%m-%d')
4227+ from_time = '00:00'
4228+
4229+ pts_slot_ids = time_slot_obj.search(cr, uid, [('max_time', '>=', from_time), ('type', '=', 'pts'), ('dts_id', '=', slot.id)], order='max_time')
4230+ if pts_slot_ids:
4231+ pts_slot = time_slot_obj.browse(cr, uid, pts_slot_ids[0])
4232+ name_pts += pts_slot.name
4233+ end_date_pts = start_date_pts + ' ' + pts_slot.end_time
4234+ start_date_pts += ' ' + pts_slot.start_time
4235+ start_date_pts = datetime.strptime(start_date_pts, '%Y-%m-%d %H:%M')
4236+ start_date_pts = pytz.utc.localize(start_date_pts).astimezone(tz2)
4237+ start_date_pts = datetime.strftime(start_date_pts, '%Y-%m-%d %H:%M')
4238+ end_date_pts = datetime.strptime(end_date_pts, '%Y-%m-%d %H:%M')
4239+ end_date_pts = pytz.utc.localize(end_date_pts).astimezone(tz2)
4240+ end_date_pts = datetime.strftime(end_date_pts, '%Y-%m-%d %H:%M')
4241+
4242+ cr2.execute("SELECT id FROM delivery_time WHERE name='" + name_pts + "' AND type='pts' AND slot_id='" + str(pts_slot.id) + "'")
4243+ pt_ids = map(lambda x: x[0], cr2.fetchall())
4244+ if pt_ids:
4245+ pt_id = pt_ids[0]
4246+ else:
4247+ pt_id = delivery_time_obj.create(cr3, uid, {
4248+ 'name':name_pts,
4249+ 'start_date': start_date_pts,
4250+ 'end_date': end_date_pts,
4251+ 'active': True,
4252+ 'type': 'pts',
4253+ 'slot_id': pts_slot.id,
4254+ 'dts_id': dt_id,
4255+ }, context)
4256+ cr3.commit()
4257+ cr2.commit()
4258+ val['pts_id'] = pt_id
4259+ if not pt_id:
4260+ val['pts_id'] = False
4261+ if not dt_id:
4262+ val['dts_id'] = False
4263+
4264+ if val:
4265+ so_pool.write(cr2, 1, [order.id], val)
4266+
4267+ ##################################################
4268+ #cr2.execute("SELECT DISTINCT id FROM stock_picking WHERE sale_id = "+ str(order.id) +"")
4269+ #pick_ids = map(lambda x: x[0], cr2.fetchall()) or []
4270+ #if pick_ids and val:
4271+ # picking_obj.write(cr2, uid, pick_ids, val)
4272+ ##################################################
4273+
4274+ cpt_commit += 1
4275+ if cpt_commit >= 30:
4276+ cr2.commit()
4277+ cr3.commit()
4278+ cr.commit()
4279+ cpt_commit = 1
4280+ except Exception as err:
4281+ logger.warning('>>> Error during SO %s : %s' % (order.id, err))
4282+ ##################################################
4283+ # We update the old wrong start_date and end_date in delivery.time
4284+ #delivery_time_obj = self.pool.get('delivery.time')
4285+ #cr.execute("SELECT id FROM delivery_time WHERE id<16613 and start_date is not null and end_date is not null")
4286+ #delivery_ids = map(lambda x: x[0], cr.fetchall()) or []
4287+ #for delivery in delivery_time_obj.browse(cr, 1, delivery_ids):
4288+ # delivery_start = datetime.strptime(delivery.start_date, '%Y-%m-%d %H:%M:%S')
4289+ # delivery_start = pytz.utc.localize(delivery_start).astimezone(tz2)
4290+ #
4291+ # delivery_end = datetime.strptime(delivery.end_date, '%Y-%m-%d %H:%M:%S')
4292+ # delivery_end = pytz.utc.localize(delivery_end).astimezone(tz2)
4293+ #
4294+ # delivery_time_obj.write(cr2, 1, [delivery.id], {'start_date':delivery_start,'end_date':delivery_end})
4295+ # cr2.commit()
4296+ ##################################################
4297+ cr.close()
4298+ cr2.close()
4299+ cr3.close()
4300+ logger.warning('################ DONE ################')
4301+ """
4302+ return
4303+dts_reset()
4304+
4305+class delivery_reset(osv.osv_memory):
4306+ _name = 'delivery.reset'
4307+
4308+ def go(self, cr, uid, ids, context=None):
4309+ context = context or {}
4310+ use_new_cursor = cr.dbname
4311+ threaded_calculation = threading.Thread(target=self.pool.get('dts.reset').resetall, args=(cr, uid, context))
4312+ threaded_calculation.start()
4313+ return {'type': 'ir.actions.act_window_close'}
4314+delivery_reset()
4315+
4316+#class add_picking_pack(osv.osv_memory):
4317+# _name='add.picking.pack'
4318+#
4319+# _columns = {
4320+# }
4321+#
4322+# def confirm_add(self, cr, uid, ids, context=None):
4323+# picking_ids = context['active_ids']
4324+#
4325+# sequence_obj = self.pool.get('ir.sequence')
4326+# picking_obj = self.pool.get('stock.picking')
4327+# move_obj = self.pool.get('stock.move')
4328+# ul_obj = self.pool.get('product.ul')
4329+# batch_obj = self.pool.get('picking.batch')
4330+# tracking_obj = self.pool.get('stock.tracking')
4331+#
4332+# batch_id = batch_obj.create(cr, uid, {
4333+# 'name': sequence_obj.get(cr, uid, 'picking.batch')
4334+# },context=context)
4335+#
4336+# for picking in picking_obj.browse(cr, uid, picking_ids, context):
4337+# picking_obj.write(cr, uid, [picking.id,], {'batch_id':batch_id})
4338+# for line in picking.move_lines :
4339+# tracking_ids = tracking_obj.search(cr, uid, [
4340+# ('picking_id','=',picking.id),
4341+# ('ul_id','=',line.product_id.ul_id and line.product_id.ul_id.id or False)],context=context)
4342+# if tracking_ids :
4343+# tracking_id = tracking_ids[0]
4344+# else:
4345+# tracking_id = tracking_obj.create(cr, uid, {
4346+# 'name':'%s_%s' % (picking.name,line.product_id.ul_id.name),
4347+# 'picking_id':picking.id,
4348+# 'ul_id':line.product_id.ul_id and line.product_id.ul_id.id or False,
4349+# },
4350+# context=context)
4351+# move_obj.write(cr, uid,[line.id], {'tracking_id':tracking_id},context=context)
4352+#
4353+# return {
4354+# 'type': 'ir.actions.act_window_close',
4355+# }
4356+#
4357+#add_picking_pack()
4358+
4359+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4360\ No newline at end of file
4361
4362=== added file 'delivery_plan/wizard/stock_view.xml'
4363--- delivery_plan/wizard/stock_view.xml 1970-01-01 00:00:00 +0000
4364+++ delivery_plan/wizard/stock_view.xml 2013-09-09 08:37:27 +0000
4365@@ -0,0 +1,463 @@
4366+<?xml version="1.0" encoding="utf-8"?>
4367+<openerp>
4368+ <data>
4369+ <record id="view_dts_to_routes" model="ir.ui.view">
4370+ <field name="name">Prepare Routes for DTS</field>
4371+ <field name="model">delivery.dts_to_routes</field>
4372+ <field name="arch" type="xml">
4373+ <form string="Prepare Routes for DTS" version="7.0">
4374+ <field name="dts_id"/>
4375+ <footer>
4376+ <button name="generate_routes" string="Confirm" type="object" class="oe_highlight"/>
4377+ or
4378+ <button string="Cancel" class="oe_link" special="cancel"/>
4379+ </footer>
4380+ </form>
4381+ </field>
4382+ </record>
4383+ <record id="view_dts_to_vans" model="ir.ui.view">
4384+ <field name="name">Prepare Vans for DTS</field>
4385+ <field name="model">delivery.dts_to_vans</field>
4386+ <field name="arch" type="xml">
4387+ <form string="Prepare Vans for DTS" version="7.0">
4388+ <field name="dts_id"/>
4389+ <footer>
4390+ <button name="open_kanban" string="Confirm" type="object" class="oe_highlight"/>
4391+ or
4392+ <button string="Cancel" class="oe_link" special="cancel"/>
4393+ </footer>
4394+ </form>
4395+ </field>
4396+ </record>
4397+
4398+ <act_window name="Prepare Routes for DTS"
4399+ res_model="delivery.dts_to_routes"
4400+ view_mode="form"
4401+ target="new"
4402+ id="action_dts_to_routes"/>
4403+
4404+ <act_window name="Prepare Vans for DTS"
4405+ res_model="delivery.dts_to_vans"
4406+ view_mode="form"
4407+ target="new"
4408+ id="action_dts_to_vans"/>
4409+
4410+ <menuitem name="Prepare Delivery Routes" id="menu_delivery_wizard" parent="delivery_routes.menu_delivery_root" sequence="0"/>
4411+ <menuitem action="action_dts_to_vans" name="Prepare Vans for DTS" id="menu_action_dts_to_vans" parent="menu_delivery_wizard" sequence="10"/>
4412+ <menuitem action="action_dts_to_routes" name="Prepare Routes for DTS" id="menu_action_dts_to_routes" parent="menu_delivery_wizard" sequence="15"/>
4413+
4414+
4415+
4416+ <record id="view_driver_for_routes" model="ir.ui.view">
4417+ <field name="name">Choose Driver / Deliver for DTS</field>
4418+ <field name="model">delivery.driver_for_routes</field>
4419+ <field name="arch" type="xml">
4420+ <form string="Choose Driver / Deliver for DTS" version="7.0">
4421+ <group colspan="2" col="4">
4422+ <field name="dts_id"/>
4423+ <!--field name="action"/-->
4424+ </group>
4425+ <footer>
4426+ <button name="open_kanban" string="Confirm" type="object" class="oe_highlight"/>
4427+ or
4428+ <button string="Cancel" class="oe_link" special="cancel"/>
4429+ </footer>
4430+ </form>
4431+ </field>
4432+ </record>
4433+
4434+ <act_window name="Choose Driver / Deliver for DTS"
4435+ res_model="delivery.driver_for_routes"
4436+ view_mode="form"
4437+ target="new"
4438+ id="action_driver_for_routes"/>
4439+ <menuitem action="action_driver_for_routes" name="Choose Driver / Deliver for DTS" id="menu_action_driver_for_routes" parent="menu_delivery_wizard" sequence="25"/>
4440+
4441+
4442+
4443+ <record model="ir.ui.view" id="delivery_route_driver_kanban_view">
4444+ <field name="name">delivery.route.driver.kanban</field>
4445+ <field name="model">delivery.route</field>
4446+ <field name="arch" type="xml">
4447+ <kanban version="7.0">
4448+ <field name="dts_id"/>
4449+ <field name="driver_id"/>
4450+ <field name="picker_id"/>
4451+ <field name="state"/>
4452+ <templates>
4453+ <t t-name="kanban-box">
4454+ <div t-attf-class="oe_kanban_card oe_kanban_global_click">
4455+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
4456+ <span class="oe_e">í</span>
4457+ <ul class="oe_dropdown_menu">
4458+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
4459+ </ul>
4460+ </div>
4461+ <div class="oe_kanban_content">
4462+ <div><b><field name="name"/></b></div>
4463+ <div>
4464+ <field name="date"/><br />
4465+ <field name="state"/>
4466+ </div>
4467+ </div>
4468+ <div class="oe_clear"></div>
4469+ </div>
4470+ </t>
4471+ </templates>
4472+ </kanban>
4473+ </field>
4474+ </record>
4475+ <record id="action_delivery_route_driver_kanban" model="ir.actions.act_window">
4476+ <field name="name">Delivery Route Driver Kanban</field>
4477+ <field name="type">ir.actions.act_window</field>
4478+ <field name="res_model">delivery.route</field>
4479+ <field name="view_type">tree</field>
4480+ <field name="view_mode">kanban,form</field>
4481+ </record>
4482+
4483+
4484+ <record model="ir.ui.view" id="delivery_route_line_kanban_view_fc">
4485+ <field name="name">delivery.route.line.kanban_fc</field>
4486+ <field name="model">delivery.route.line</field>
4487+ <field name="arch" type="xml">
4488+ <kanban version="7.0">
4489+ <field name="picking_id"/>
4490+ <field name="route_id"/>
4491+ <field name="address_id"/>
4492+ <field name="note"/>
4493+ <field name="sequence"/>
4494+ <field name="color"/>
4495+ <field name="neighborhood"/>
4496+ <field name="state"/>
4497+ <field name="customer_date"/>
4498+ <templates>
4499+ <t t-name="kanban-box">
4500+ <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">
4501+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
4502+ <span class="oe_e">í</span>
4503+ <ul class="oe_dropdown_menu">
4504+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
4505+ <t t-if="record.state.raw_value == 'draft'"><li><ul class="oe_kanban_colorpicker" data-field="color"/></li></t>
4506+ </ul>
4507+ </div>
4508+ <div class="oe_kanban_content">
4509+ <div>
4510+ <field name="color"/> -
4511+ <span t-if="record.neighborhood.raw_value != null"><field name="neighborhood"/> - </span>
4512+ <field name="street"/>
4513+ <div t-if="record.customer_date.raw_value != null"><field name="customer_date"/></div>
4514+ </div>
4515+ <!--div class="oe_kanban_bottom_right">
4516+ <a name="set_van_0" type="object" class="oe_kanban_color_0 oe_kanban_button">No</a>
4517+ <a name="set_van_1" type="object" class="oe_kanban_color_1 oe_kanban_button">1</a>
4518+ <a name="set_van_2" type="object" class="oe_kanban_color_2 oe_kanban_button">2</a>
4519+ <a name="set_van_3" type="object" class="oe_kanban_color_3 oe_kanban_button">3</a>
4520+ <a name="set_van_4" type="object" class="oe_kanban_color_4 oe_kanban_button">4</a>
4521+ <a name="set_van_5" type="object" class="oe_kanban_color_5 oe_kanban_button">5</a>
4522+ <a name="set_van_6" type="object" class="oe_kanban_color_6 oe_kanban_button">6</a>
4523+ <a name="set_van_7" type="object" class="oe_kanban_color_7 oe_kanban_button">7</a>
4524+ <a name="set_van_8" type="object" class="oe_kanban_color_8 oe_kanban_button">8</a>
4525+ <a name="set_van_9" type="object" class="oe_kanban_color_9 oe_kanban_button">9</a>
4526+ </div-->
4527+ <div class="oe_clear"></div>
4528+ </div>
4529+ <div class="oe_clear"></div>
4530+ </div>
4531+ </t>
4532+ </templates>
4533+ </kanban>
4534+ </field>
4535+ </record>
4536+
4537+
4538+ <record id="view_stock_change_dts_wizard" model="ir.ui.view">
4539+ <field name="name">Change DTS / PTS</field>
4540+ <field name="model">delivery.change.dts</field>
4541+ <field name="arch" type="xml">
4542+ <form string="Change DTS / PTS" version="7.0">
4543+ <group>
4544+ <field name="action"/>
4545+ <field name="dts_id" on_change="dts_id_change(dts_id, pts_id, context)" attrs="{'invisible':[('action','=','cleanup')]}"/>
4546+ <field name="pts_id" domain="[('dts_id','=',dts_id)]" attrs="{'invisible':[('action','=','cleanup')]}"/>
4547+ </group>
4548+ <footer>
4549+ <button name="change_dts" string="Update" type="object" class="oe_highlight"/>
4550+ or
4551+ <button string="Cancel" class="oe_link" special="cancel" />
4552+ </footer>
4553+ </form>
4554+ </field>
4555+ </record>
4556+
4557+ <act_window name="Change DTS / PTS"
4558+ res_model="delivery.change.dts"
4559+ src_model="stock.picking"
4560+ view_mode="form"
4561+ target="new"
4562+ key2="client_action_multi"
4563+ multi="True"
4564+ id="action_stock_change_dts_wizard"/>
4565+
4566+
4567+
4568+ <record model="ir.ui.view" id="delivery_driver_kanban_view">
4569+ <field name="name">delivery.driver.kanban</field>
4570+ <field name="model">delivery.driver</field>
4571+ <field name="arch" type="xml">
4572+ <kanban version="7.0" default_group_by="tmp_route_id">
4573+ <field name="tmp_route_id"/>
4574+ <field name="is_driver"/>
4575+ <field name="is_picker"/>
4576+ <field name="color"/>
4577+ <templates>
4578+ <t t-name="kanban-box">
4579+ <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">
4580+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
4581+ <span class="oe_e">í</span>
4582+ <ul class="oe_dropdown_menu">
4583+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
4584+ </ul>
4585+ </div>
4586+ <div class="oe_kanban_content">
4587+ <div><b><field name="name"/></b></div>
4588+ </div>
4589+ <div class="oe_clear"></div>
4590+ </div>
4591+ </t>
4592+ </templates>
4593+ </kanban>
4594+ </field>
4595+ </record>
4596+
4597+ <!--record id="view_add_picking_pack" model="ir.ui.view">
4598+ <field name="name">Add Picking to Pack</field>
4599+ <field name="model">add.picking.pack</field>
4600+ <field name="type">form</field>
4601+ <field name="arch" type="xml">
4602+ <form string="Pack Delivery notes">
4603+ <separator string="Pack the selected Delivery notes ?"/>
4604+ <newline/>
4605+ <button special="cancel" string="Cancel"/>
4606+ <button name="confirm_add" string="Confirm" type="object"/>
4607+ </form>
4608+ </field>
4609+ </record>
4610+
4611+ <act_window name="Add Picking to Pack"
4612+ src_model="stock.picking"
4613+ res_model="add.picking.pack"
4614+ id="action_add_picking_pack_wizard"
4615+ view_mode="form"
4616+ multi="True"
4617+ key2="client_action_multi"
4618+ target="new"/-->
4619+
4620+ <record id="view_to_be_deleted_soon" model="ir.ui.view">
4621+ <field name="name">TO BE DELETED SOON</field>
4622+ <field name="model">delivery.reset</field>
4623+ <field name="arch" type="xml">
4624+ <form string="RESET ALL DELIVERY" version="7.0">
4625+ <footer>
4626+ <button name="go" string="Confirm" type="object" class="oe_highlight"/>
4627+ or
4628+ <button string="Cancel" class="oe_link" special="cancel"/>
4629+ </footer>
4630+ </form>
4631+ </field>
4632+ </record>
4633+ <act_window name="RESET ALL DELIVERY"
4634+ res_model="delivery.reset"
4635+ view_mode="form"
4636+ target="new"
4637+ id="action_resetall"/>
4638+ <menuitem action="action_resetall" name="RESET ALL DELIVERY" id="menu_action_resetall" parent="delivery_routes.menu_delivery_config" sequence="125"/>
4639+
4640+
4641+
4642+ <!-- kanban view for stock picking with delivery-->
4643+ <record model="ir.ui.view" id="stock_picking_inout_kanban_elico">
4644+ <field name="name">stock.picking.out.kanban</field>
4645+ <field name="model">stock.picking</field>
4646+ <field name="arch" type="xml">
4647+ <kanban version="7.0" default_group_by="dts_id">
4648+ <field name="dts_id"/>
4649+ <field name="min_date"/>
4650+ <field name="origin"/>
4651+ <field name="partner_id"/>
4652+ <templates>
4653+ <t t-name="kanban-box">
4654+ <div t-attf-class="oe_kanban_card oe_kanban_global_click">
4655+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
4656+ <span class="oe_e">í</span>
4657+ <ul class="oe_dropdown_menu">
4658+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
4659+ <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
4660+ </ul>
4661+ </div>
4662+ <div class="oe_kanban_content">
4663+ <div><b><field name="origin"/></b></div>
4664+ <div>
4665+ <field name="street"/><br />
4666+ <field name="min_date"/>
4667+ </div>
4668+ </div>
4669+ <div class="oe_clear"></div>
4670+ </div>
4671+ </t>
4672+ </templates>
4673+ </kanban>
4674+ </field>
4675+ </record>
4676+
4677+ <record id="view_picking_search_kanban" model="ir.ui.view">
4678+ <field name="name">stock.picking.search.kanban</field>
4679+ <field name="model">stock.picking</field>
4680+ <field name="arch" type="xml">
4681+ <search string="PO + SO">
4682+ <field name="name" string="Incoming Shipments" filter_domain="['|',('name','ilike',self),('origin','ilike',self)]"/>
4683+ <filter icon="terp-check" name="available" string="Ready to Process" domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
4684+ <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Incoming Shipments already processed"/>
4685+ <separator/>
4686+ <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
4687+ <separator/>
4688+ <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>
4689+ <field name="stock_journal_id"/>
4690+ <field name="product_id"/>
4691+ <group expand="0" string="Group By...">
4692+ <filter icon="terp-stock_effects-object-colorize" name="state" string="Status" domain="[]" context="{'group_by':'state'}"/>
4693+ <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
4694+ <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
4695+ <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
4696+ <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"/>
4697+ <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"/>
4698+ <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"/>
4699+ </group>
4700+ </search>
4701+ </field>
4702+ </record>
4703+ <record id="action_picking_inout_kanban" model="ir.actions.act_window">
4704+ <field name="name">PO + SO / DTS</field>
4705+ <field name="res_model">stock.picking</field>
4706+ <field name="type">ir.actions.act_window</field>
4707+ <field name="view_type">tree</field>
4708+ <field name="view_mode">kanban,form</field>
4709+ <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>
4710+ <field name="context">{'contact_display': 'partner_address', 'update_pts':1, 'search_default_dts_min_today': 1}</field>
4711+ <field name="search_view_id" ref="view_picking_search_kanban"/>
4712+ </record>
4713+ <menuitem action="action_picking_inout_kanban" id="menu_action_picking_inout_kanban" parent="delivery_plan.menu_delivery_wizard" sequence="1"/>
4714+ <!-- stock picking with delivery end -->
4715+
4716+
4717+
4718+
4719+ <!-- kanban view for stock picking with delivery-->
4720+ <record model="ir.ui.view" id="stock_picking_inout_kanban_elico">
4721+ <field name="name">stock.picking.out.kanban</field>
4722+ <field name="model">stock.picking</field>
4723+ <field name="arch" type="xml">
4724+ <kanban version="7.0" default_group_by="dts_id">
4725+ <field name="dts_id"/>
4726+ <field name="min_date"/>
4727+ <field name="origin"/>
4728+ <field name="partner_id"/>
4729+ <templates>
4730+ <t t-name="kanban-box">
4731+ <div t-attf-class="oe_kanban_card oe_kanban_global_click">
4732+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
4733+ <span class="oe_e">í</span>
4734+ <ul class="oe_dropdown_menu">
4735+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
4736+ <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
4737+ </ul>
4738+ </div>
4739+ <div class="oe_kanban_content">
4740+ <div><b><field name="origin"/></b></div>
4741+ <div>
4742+ <field name="street"/><br />
4743+ <field name="min_date"/>
4744+ </div>
4745+ </div>
4746+ <div class="oe_clear"></div>
4747+ </div>
4748+ </t>
4749+ </templates>
4750+ </kanban>
4751+ </field>
4752+ </record>
4753+ <!--record model="ir.ui.view" id="stock_picking_in_kanban_elico">
4754+ <field name="name">stock.picking.in.kanban</field>
4755+ <field name="model">stock.picking.in</field>
4756+ <field name="arch" type="xml">
4757+ <kanban version="7.0" default_group_by="dts_id">
4758+ <field name="dts_id"/>
4759+ <field name="min_date"/>
4760+ <field name="origin"/>
4761+ <field name="partner_id"/>
4762+ <templates>
4763+ <t t-name="kanban-box">
4764+ <div t-attf-class="oe_kanban_card oe_kanban_global_click">
4765+ <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user">
4766+ <span class="oe_e">í</span>
4767+ <ul class="oe_dropdown_menu">
4768+ <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
4769+ <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
4770+ </ul>
4771+ </div>
4772+ <div class="oe_kanban_content">
4773+ <div><b><field name="origin"/></b></div>
4774+ <div>
4775+ (<field name="name"/>)<br />
4776+ <field name="partner_id"/><br />
4777+ <field name="min_date"/>
4778+ </div>
4779+ </div>
4780+ <div class="oe_clear"></div>
4781+ </div>
4782+ </t>
4783+ </templates>
4784+ </kanban>
4785+ </field>
4786+ </record-->
4787+
4788+ <record id="view_picking_search_kanban" model="ir.ui.view">
4789+ <field name="name">stock.picking.search.kanban</field>
4790+ <field name="model">stock.picking</field>
4791+ <field name="arch" type="xml">
4792+ <search string="PO + SO">
4793+ <field name="name" string="Incoming Shipments" filter_domain="['|',('name','ilike',self),('origin','ilike',self)]"/>
4794+ <filter icon="terp-check" name="available" string="Ready to Process" domain="[('state','=','assigned')]" help="Incoming Shipments Available"/>
4795+ <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Incoming Shipments already processed"/>
4796+ <separator/>
4797+ <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
4798+ <separator/>
4799+ <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>
4800+ <field name="stock_journal_id"/>
4801+ <field name="product_id"/>
4802+ <group expand="0" string="Group By...">
4803+ <filter icon="terp-stock_effects-object-colorize" name="state" string="Status" domain="[]" context="{'group_by':'state'}"/>
4804+ <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
4805+ <filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
4806+ <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
4807+ <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"/>
4808+ <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"/>
4809+ <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"/>
4810+ </group>
4811+ </search>
4812+ </field>
4813+ </record>
4814+ <record id="action_picking_inout_kanban" model="ir.actions.act_window">
4815+ <field name="name">PO + SO / DTS</field>
4816+ <field name="res_model">stock.picking</field>
4817+ <field name="type">ir.actions.act_window</field>
4818+ <field name="view_type">tree</field>
4819+ <field name="view_mode">kanban,form</field>
4820+ <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>
4821+ <field name="context">{'contact_display': 'partner_address', 'update_pts':1, 'search_default_dts_min_today': 1}</field>
4822+ <field name="search_view_id" ref="view_picking_search_kanban"/>
4823+ </record>
4824+ <menuitem action="action_picking_inout_kanban" id="menu_action_picking_inout_kanban" parent="delivery_plan.menu_delivery_wizard" sequence="1"/>
4825+ <!-- stock picking with delivery end -->
4826+
4827+ </data>
4828+</openerp>
4829\ No newline at end of file
4830
4831=== added directory 'delivery_routes'
4832=== added file 'delivery_routes/__init__.py'
4833--- delivery_routes/__init__.py 1970-01-01 00:00:00 +0000
4834+++ delivery_routes/__init__.py 2013-09-09 08:37:27 +0000
4835@@ -0,0 +1,34 @@
4836+# -*- encoding: utf-8 -*-
4837+##############################################################################
4838+#
4839+# OpenERP, Open Source Management Solution
4840+# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
4841+#
4842+# WARNING: This program as such is intended to be used by professional
4843+# programmers who take the whole responsability of assessing all potential
4844+# consequences resulting from its eventual inadequacies and bugs
4845+# End users who are looking for a ready-to-use solution with commercial
4846+# garantees and support are strongly adviced to contract a Free Software
4847+# Service Company
4848+#
4849+# This program is Free Software; you can redistribute it and/or
4850+# modify it under the terms of the GNU General Public License
4851+# as published by the Free Software Foundation; either version 2
4852+# of the License, or (at your option) any later version.
4853+#
4854+# This program is distributed in the hope that it will be useful,
4855+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4856+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4857+# GNU General Public License for more details.
4858+#
4859+# You should have received a copy of the GNU General Public License
4860+# along with this program; if not, write to the Free Software
4861+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4862+#
4863+##############################################################################
4864+import stock
4865+import delivery
4866+import purchase
4867+import wizard
4868+
4869+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4870
4871=== added file 'delivery_routes/__openerp__.py'
4872--- delivery_routes/__openerp__.py 1970-01-01 00:00:00 +0000
4873+++ delivery_routes/__openerp__.py 2013-09-09 08:37:27 +0000
4874@@ -0,0 +1,63 @@
4875+# -*- encoding: utf-8 -*-
4876+##############################################################################
4877+#
4878+# OpenERP, Open Source Management Solution
4879+# Copyright (C) 2011 Cubic ERP - Teradata SAC (<http://cubicerp.com>).
4880+# Copyright (C) 2013 Elico Corp (<http://www.elico-corp.com>).
4881+#
4882+# This program is free software: you can redistribute it and/or modify
4883+# it under the terms of the GNU Affero General Public License as
4884+# published by the Free Software Foundation, either version 3 of the
4885+# License, or (at your option) any later version.
4886+#
4887+# This program is distributed in the hope that it will be useful,
4888+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4889+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4890+# GNU Affero General Public License for more details.
4891+#
4892+# You should have received a copy of the GNU Affero General Public License
4893+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4894+#
4895+##############################################################################
4896+{
4897+ "name": "Delivery Routes",
4898+ "version": "1",
4899+ "description": """
4900+Manage delivery routes.
4901+=======================
4902+Based on Cubic ERP's Delivery Routes Module\n
4903+it add the following features:\n
4904+* Add group Customer Service
4905+* Add dts_id in purchase order, A purchase order with flag is_collected can have a delivery_route_line
4906+* Improve DTS , PTS.
4907+* Improve Delivery carrier and driver, picker. Add color for delivery driver and picker.
4908+* Add interface functions with other modules sales, purchase, stock
4909+* use 3-seg daily dts/pts to arrange delivery.
4910+""",
4911+ "author": "Elico Corp",
4912+ "website": "http://www.elico-corp.com",
4913+ "category": "Stock Management",
4914+ "depends": [
4915+ "delivery",
4916+ "stock",
4917+ "hr",
4918+ #'quality_control_elico',
4919+ ],
4920+ "data":[
4921+ "security/delivery_security.xml",
4922+ "security/ir.model.access.csv",
4923+ "wizard/fill_picking.xml",
4924+ "wizard/select_range_view.xml",
4925+ "delivery_view.xml",
4926+ "delivery_sequence.xml",
4927+ "stock_view.xml",
4928+ "purchase_view.xml",
4929+ "wizard/stock_view.xml",
4930+ ],
4931+ "demo_xml": [ ],
4932+ "active": False,
4933+ "installable": True,
4934+ "certificate" : "",
4935+ 'images': [],
4936+}
4937+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4938
4939=== added file 'delivery_routes/delivery.py'
4940--- delivery_routes/delivery.py 1970-01-01 00:00:00 +0000
4941+++ delivery_routes/delivery.py 2013-09-09 08:37:27 +0000
4942@@ -0,0 +1,660 @@
4943+# -*- coding: utf-8 -*-
4944+##############################################################################
4945+#
4946+# OpenERP, Open Source Management Solution
4947+# Copyright (c) 2012 Cubic ERP - Teradata SAC. (http://cubicerp.com).
4948+#
4949+# This program is free software: you can redistribute it and/or modify
4950+# it under the terms of the GNU Affero General Public License as
4951+# published by the Free Software Foundation, either version 3 of the
4952+# License, or (at your option) any later version.
4953+#
4954+# This program is distributed in the hope that it will be useful,
4955+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4956+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4957+# GNU Affero General Public License for more details.
4958+#
4959+# You should have received a copy of the GNU Affero General Public License
4960+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4961+#
4962+##############################################################################
4963+
4964+from osv import fields, osv
4965+import time
4966+from datetime import datetime
4967+import pytz
4968+from tools.translate import _
4969+from tools import ustr
4970+import logging
4971+_logger = logging.getLogger(__name__)
4972+
4973+
4974+class sale_order(osv.osv):
4975+ _inherit = "sale.order"
4976+
4977+ _columns = {
4978+ 'so_payment_method': fields.char('Payment Method', size=32),
4979+ }
4980+sale_order()
4981+
4982+class delivery_driver(osv.osv):
4983+ _name='delivery.driver'
4984+
4985+ _columns = {
4986+ 'partner_id': fields.many2one('res.partner','Partner',help='Fill this field if the driver is a outsourcing of the company'),
4987+ 'employee_id': fields.many2one('hr.employee','Employee',help='Fill this if the driver is a employee of the company'),
4988+ 'name': fields.char('Name', size=64, required=True),
4989+ 'carrier_id': fields.many2one('delivery.carrier','Carrier'),
4990+ 'outsourcing': fields.boolean('Outsourcing ?'),
4991+ 'route_ids': fields.one2many('delivery.route','driver_id','Delivery Routes'),
4992+ 'is_driver': fields.boolean('Is Driver ?'),
4993+ 'is_picker': fields.boolean('Is Picker ?'),
4994+ 'active': fields.boolean('Active ?'),
4995+ 'color': fields.integer('Color Index'),
4996+ 'tmp_route_id': fields.many2one('delivery.route_tmp','Temporary Delivery Route'),
4997+ }
4998+ _defaults = {
4999+ 'outsourcing': False,
5000+ 'is_driver': True,
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches