Merge lp:~openobject-italia-core-devs/openobject-italia/7.0-l10n_it_sale-pep8 into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
- 7.0-l10n_it_sale-pep8
- Merge into italian-addons-7.0
Status: | Needs review |
---|---|
Proposed branch: | lp:~openobject-italia-core-devs/openobject-italia/7.0-l10n_it_sale-pep8 |
Merge into: | lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0 |
Diff against target: |
515 lines (+144/-107) 12 files modified
l10n_it_sale/__init__.py (+2/-2) l10n_it_sale/__openerp__.py (+5/-8) l10n_it_sale/account/__init__.py (+2/-3) l10n_it_sale/account/invoice.py (+28/-20) l10n_it_sale/partner/__init__.py (+1/-1) l10n_it_sale/partner/partner.py (+10/-7) l10n_it_sale/sale/__init__.py (+1/-2) l10n_it_sale/sale/sale.py (+28/-22) l10n_it_sale/stock/__init__.py (+1/-3) l10n_it_sale/stock/picking.py (+57/-32) l10n_it_sale/wizard/__init__.py (+1/-1) l10n_it_sale/wizard/assign_ddt.py (+8/-6) |
To merge this branch: | bzr merge lp:~openobject-italia-core-devs/openobject-italia/7.0-l10n_it_sale-pep8 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Leonardo Pistone (community) | Needs Fixing | ||
Andrea Cometa (community) | Approve | ||
andrea_cg (community) | Approve | ||
Review via email: mp+220483@code.launchpad.net |
Commit message
Description of the change
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
aggiungo che ho dovuto creare qualche variabile in più con nomi abbreviati per rimanere nelle 79 cols
Lorenzo Battistini (elbati) wrote : | # |
Se preferisci
http://
può diventare ad esempio
http://
E
http://
può diventare
http://
Discorso simile per picking.py
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
Non ci avrei mai pensato da solo...
+1
- 241. By Davide Corio
-
[IMP] code cleanup
- 242. By Davide Corio
-
[IMP] code cleanup
- 243. By Davide Corio
-
[IMP] code cleanup
Lorenzo Battistini (elbati) wrote : | # |
Grazie Davide.
Ah, solo un'altra cosa: riga 157 come mai hai tolto lo spazio?
- 244. By Davide Corio
-
[FIX] missing space
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
Umh... non te lo so dire :)
rimesso spazio
Leonardo Pistone (lepistone) wrote : | # |
l'F401 possiamo ignorarlo solo negli __init__.py. Ci sono altri import inutili che sono davvero inutili.
o in alternativa, non lo ignoriamo del tutto e mettiamo # noqa negli import di __init__.py.
ciao
Lorenzo Battistini (elbati) wrote : | # |
This project is now hosted on https:/
Unmerged revisions
- 244. By Davide Corio
-
[FIX] missing space
- 243. By Davide Corio
-
[IMP] code cleanup
- 242. By Davide Corio
-
[IMP] code cleanup
- 241. By Davide Corio
-
[IMP] code cleanup
- 240. By Davide Corio
-
[IMP] pep8
Preview Diff
1 | === modified file 'l10n_it_sale/__init__.py' | |||
2 | --- l10n_it_sale/__init__.py 2013-03-13 08:21:42 +0000 | |||
3 | +++ l10n_it_sale/__init__.py 2014-05-22 13:05:57 +0000 | |||
4 | @@ -1,6 +1,6 @@ | |||
5 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
6 | 2 | ############################################################################## | 2 | ############################################################################## |
8 | 3 | # | 3 | # |
9 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
10 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
11 | 6 | # | 6 | # |
12 | @@ -21,6 +21,6 @@ | |||
13 | 21 | 21 | ||
14 | 22 | import sale | 22 | import sale |
15 | 23 | import stock | 23 | import stock |
17 | 24 | import account | 24 | import account |
18 | 25 | import partner | 25 | import partner |
19 | 26 | import wizard | 26 | import wizard |
20 | 27 | 27 | ||
21 | === modified file 'l10n_it_sale/__openerp__.py' | |||
22 | --- l10n_it_sale/__openerp__.py 2013-03-14 11:11:29 +0000 | |||
23 | +++ l10n_it_sale/__openerp__.py 2014-05-22 13:05:57 +0000 | |||
24 | @@ -1,6 +1,6 @@ | |||
25 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
26 | 2 | ############################################################################## | 2 | ############################################################################## |
28 | 3 | # | 3 | # |
29 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
30 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
31 | 6 | # | 6 | # |
32 | @@ -32,8 +32,8 @@ | |||
33 | 32 | 'author': 'OpenERP Italian Community', | 32 | 'author': 'OpenERP Italian Community', |
34 | 33 | 'website': 'http://www.openerp-italia.org', | 33 | 'website': 'http://www.openerp-italia.org', |
35 | 34 | 'license': 'AGPL-3', | 34 | 'license': 'AGPL-3', |
38 | 35 | "depends" : ['stock', 'sale', 'account', 'delivery'], | 35 | "depends": ['stock', 'sale', 'account', 'delivery'], |
39 | 36 | "data" : [ | 36 | "data": [ |
40 | 37 | 'wizard/assign_ddt.xml', | 37 | 'wizard/assign_ddt.xml', |
41 | 38 | 'stock/picking_view.xml', | 38 | 'stock/picking_view.xml', |
42 | 39 | 'stock/carriage_condition_view.xml', | 39 | 'stock/carriage_condition_view.xml', |
43 | @@ -46,11 +46,8 @@ | |||
44 | 46 | 'sale/sale_view.xml', | 46 | 'sale/sale_view.xml', |
45 | 47 | "security/ir.model.access.csv", | 47 | "security/ir.model.access.csv", |
46 | 48 | 'partner/partner_view.xml', | 48 | 'partner/partner_view.xml', |
50 | 49 | 'account/invoice_view.xml', | 49 | 'account/invoice_view.xml'], |
51 | 50 | ], | 50 | "demo": [], |
49 | 51 | "demo" : [], | ||
52 | 52 | "active": False, | 51 | "active": False, |
53 | 53 | "installable": True | 52 | "installable": True |
54 | 54 | } | 53 | } |
55 | 55 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
56 | 56 | |||
57 | 57 | 54 | ||
58 | === modified file 'l10n_it_sale/account/__init__.py' | |||
59 | --- l10n_it_sale/account/__init__.py 2013-03-13 08:21:42 +0000 | |||
60 | +++ l10n_it_sale/account/__init__.py 2014-05-22 13:05:57 +0000 | |||
61 | @@ -1,6 +1,6 @@ | |||
62 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
63 | 2 | ############################################################################## | 2 | ############################################################################## |
65 | 3 | # | 3 | # |
66 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
67 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
68 | 6 | # | 6 | # |
69 | @@ -19,5 +19,4 @@ | |||
70 | 19 | # | 19 | # |
71 | 20 | ############################################################################## | 20 | ############################################################################## |
72 | 21 | 21 | ||
75 | 22 | import invoice | 22 | import invoice |
74 | 23 | |||
76 | 24 | 23 | ||
77 | === modified file 'l10n_it_sale/account/invoice.py' | |||
78 | --- l10n_it_sale/account/invoice.py 2013-03-14 11:11:29 +0000 | |||
79 | +++ l10n_it_sale/account/invoice.py 2014-05-22 13:05:57 +0000 | |||
80 | @@ -1,6 +1,6 @@ | |||
81 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
82 | 2 | ############################################################################## | 2 | ############################################################################## |
84 | 3 | # | 3 | # |
85 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
86 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
87 | 6 | # | 6 | # |
88 | @@ -20,32 +20,40 @@ | |||
89 | 20 | ############################################################################## | 20 | ############################################################################## |
90 | 21 | 21 | ||
91 | 22 | import netsvc | 22 | import netsvc |
94 | 23 | import pooler, tools | 23 | import pooler |
95 | 24 | 24 | import tools | |
96 | 25 | from openerp.osv import orm, fields | 25 | from openerp.osv import orm, fields |
98 | 26 | from tools.translate import _ | 26 | |
99 | 27 | 27 | ||
100 | 28 | class account_invoice(orm.Model): | 28 | class account_invoice(orm.Model): |
102 | 29 | 29 | ||
103 | 30 | _inherit = 'account.invoice' | 30 | _inherit = 'account.invoice' |
105 | 31 | 31 | ||
106 | 32 | _columns = { | 32 | _columns = { |
111 | 33 | # 'order_id':fields.many2one('sale.order','Sale Order'), | 33 | 'carriage_condition_id': fields.many2one( |
112 | 34 | 'carriage_condition_id': fields.many2one('stock.picking.carriage_condition', 'Carriage condition'), | 34 | 'stock.picking.carriage_condition', 'Carriage condition'), |
113 | 35 | 'goods_description_id': fields.many2one('stock.picking.goods_description', 'Description of goods'), | 35 | 'goods_description_id': fields.many2one( |
114 | 36 | 'transportation_reason_id': fields.many2one('stock.picking.transportation_reason', 'Reason for transportation'), | 36 | 'stock.picking.goods_description', 'Description of goods'), |
115 | 37 | 'transportation_reason_id': fields.many2one( | ||
116 | 38 | 'stock.picking.transportation_reason', | ||
117 | 39 | 'Reason for transportation'), | ||
118 | 37 | } | 40 | } |
119 | 38 | 41 | ||
124 | 39 | def onchange_partner_id(self, cr, uid, ids, type, partner_id, | 42 | def onchange_partner_id( |
125 | 40 | date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): | 43 | self, cr, uid, ids, type, partner_id, date_invoice=False, |
126 | 41 | result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, | 44 | payment_term=False, partner_bank_id=False, company_id=False): |
127 | 42 | date_invoice, payment_term, partner_bank_id, company_id) | 45 | result = super(account_invoice, self).onchange_partner_id( |
128 | 46 | cr, uid, ids, type, partner_id, date_invoice, payment_term, | ||
129 | 47 | partner_bank_id, company_id) | ||
130 | 43 | if partner_id: | 48 | if partner_id: |
131 | 44 | partner = self.pool.get('res.partner').browse(cr, uid, partner_id) | 49 | partner = self.pool.get('res.partner').browse(cr, uid, partner_id) |
135 | 45 | result['value']['carriage_condition_id'] = partner.carriage_condition_id.id | 50 | result['value'][ |
136 | 46 | result['value']['goods_description_id'] = partner.goods_description_id.id | 51 | 'carriage_condition_id' |
137 | 47 | result['value']['transportation_reason_id'] = partner.transportation_reason_id.id | 52 | ] = partner.carriage_condition_id.id |
138 | 53 | result['value'][ | ||
139 | 54 | 'goods_description_id' | ||
140 | 55 | ] = partner.goods_description_id.id | ||
141 | 56 | result['value'][ | ||
142 | 57 | 'transportation_reason_id' | ||
143 | 58 | ] = partner.transportation_reason_id.id | ||
144 | 48 | return result | 59 | return result |
145 | 49 | |||
146 | 50 | account_invoice() | ||
147 | 51 | |||
148 | 52 | 60 | ||
149 | === modified file 'l10n_it_sale/partner/__init__.py' | |||
150 | --- l10n_it_sale/partner/__init__.py 2013-03-13 08:21:42 +0000 | |||
151 | +++ l10n_it_sale/partner/__init__.py 2014-05-22 13:05:57 +0000 | |||
152 | @@ -1,6 +1,6 @@ | |||
153 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
154 | 2 | ############################################################################## | 2 | ############################################################################## |
156 | 3 | # | 3 | # |
157 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
158 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
159 | 6 | # | 6 | # |
160 | 7 | 7 | ||
161 | === modified file 'l10n_it_sale/partner/partner.py' | |||
162 | --- l10n_it_sale/partner/partner.py 2013-03-14 11:11:29 +0000 | |||
163 | +++ l10n_it_sale/partner/partner.py 2014-05-22 13:05:57 +0000 | |||
164 | @@ -1,6 +1,6 @@ | |||
165 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
166 | 2 | ############################################################################## | 2 | ############################################################################## |
168 | 3 | # | 3 | # |
169 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
170 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
171 | 6 | # | 6 | # |
172 | @@ -21,11 +21,14 @@ | |||
173 | 21 | 21 | ||
174 | 22 | from openerp.osv import orm, fields | 22 | from openerp.osv import orm, fields |
175 | 23 | 23 | ||
176 | 24 | |||
177 | 24 | class res_partner(orm.Model): | 25 | class res_partner(orm.Model): |
178 | 25 | _inherit = "res.partner" | 26 | _inherit = "res.partner" |
185 | 26 | _columns = { | 27 | _columns = { |
186 | 27 | 'carriage_condition_id': fields.many2one('stock.picking.carriage_condition', 'Carriage condition'), | 28 | 'carriage_condition_id': fields.many2one( |
187 | 28 | 'goods_description_id': fields.many2one('stock.picking.goods_description', 'Description of goods'), | 29 | 'stock.picking.carriage_condition', 'Carriage condition'), |
188 | 29 | 'transportation_reason_id': fields.many2one('stock.picking.transportation_reason', 'Reason for transportation'), | 30 | 'goods_description_id': fields.many2one( |
189 | 30 | } | 31 | 'stock.picking.goods_description', 'Description of goods'), |
190 | 31 | res_partner() | 32 | 'transportation_reason_id': fields.many2one( |
191 | 33 | 'stock.picking.transportation_reason', | ||
192 | 34 | 'Reason for transportation')} | ||
193 | 32 | 35 | ||
194 | === modified file 'l10n_it_sale/sale/__init__.py' | |||
195 | --- l10n_it_sale/sale/__init__.py 2013-03-13 08:21:42 +0000 | |||
196 | +++ l10n_it_sale/sale/__init__.py 2014-05-22 13:05:57 +0000 | |||
197 | @@ -1,6 +1,6 @@ | |||
198 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
199 | 2 | ############################################################################## | 2 | ############################################################################## |
201 | 3 | # | 3 | # |
202 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
203 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
204 | 6 | # | 6 | # |
205 | @@ -20,4 +20,3 @@ | |||
206 | 20 | ############################################################################## | 20 | ############################################################################## |
207 | 21 | 21 | ||
208 | 22 | import sale | 22 | import sale |
209 | 23 | |||
210 | 24 | 23 | ||
211 | === modified file 'l10n_it_sale/sale/sale.py' | |||
212 | --- l10n_it_sale/sale/sale.py 2013-03-14 11:11:29 +0000 | |||
213 | +++ l10n_it_sale/sale/sale.py 2014-05-22 13:05:57 +0000 | |||
214 | @@ -1,6 +1,6 @@ | |||
215 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
216 | 2 | ############################################################################## | 2 | ############################################################################## |
218 | 3 | # | 3 | # |
219 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
220 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
221 | 6 | # | 6 | # |
222 | @@ -19,41 +19,47 @@ | |||
223 | 19 | # | 19 | # |
224 | 20 | ############################################################################## | 20 | ############################################################################## |
225 | 21 | 21 | ||
226 | 22 | import time | ||
227 | 23 | from openerp.osv import orm, fields | 22 | from openerp.osv import orm, fields |
228 | 24 | 23 | ||
229 | 24 | |||
230 | 25 | class sale_order(orm.Model): | 25 | class sale_order(orm.Model): |
231 | 26 | _inherit = "sale.order" | 26 | _inherit = "sale.order" |
233 | 27 | _columns = { | 27 | _columns = { |
234 | 28 | 'validity': fields.date('Validity'), | 28 | 'validity': fields.date('Validity'), |
235 | 29 | } | 29 | } |
236 | 30 | 30 | ||
237 | 31 | def _make_invoice(self, cr, uid, order, lines, context={}): | 31 | def _make_invoice(self, cr, uid, order, lines, context={}): |
246 | 32 | inv_id = super(sale_order, self)._make_invoice(cr, uid, order, lines, context) | 32 | inv_id = super(sale_order, self)._make_invoice( |
247 | 33 | partner = self.pool.get('res.partner').browse(cr , uid, order.partner_id.id) | 33 | cr, uid, order, lines, context) |
248 | 34 | self.pool.get('account.invoice').write(cr, uid, inv_id, { | 34 | partner = self.pool.get('res.partner').browse( |
249 | 35 | # 'order_id': order.id, | 35 | cr, uid, order.partner_id.id) |
250 | 36 | 'carriage_condition_id': partner.carriage_condition_id.id, | 36 | self.pool.get('account.invoice').write( |
251 | 37 | 'goods_description_id': partner.goods_description_id.id, | 37 | cr, uid, inv_id, { |
252 | 38 | 'transportation_reason_id': partner.transportation_reason_id.id, | 38 | 'carriage_condition_id': |
253 | 39 | }) | 39 | partner.carriage_condition_id.id, |
254 | 40 | 'goods_description_id': | ||
255 | 41 | partner.goods_description_id.id, | ||
256 | 42 | 'transportation_reason_id': | ||
257 | 43 | partner.transportation_reason_id.id, | ||
258 | 44 | }) | ||
259 | 40 | return inv_id | 45 | return inv_id |
260 | 41 | 46 | ||
261 | 42 | def action_ship_create(self, cr, uid, ids, *args): | 47 | def action_ship_create(self, cr, uid, ids, *args): |
262 | 43 | super(sale_order, self).action_ship_create(cr, uid, ids, *args) | 48 | super(sale_order, self).action_ship_create(cr, uid, ids, *args) |
263 | 44 | for order in self.browse(cr, uid, ids, context={}): | 49 | for order in self.browse(cr, uid, ids, context={}): |
265 | 45 | partner = self.pool.get('res.partner').browse(cr , uid, order.partner_id.id) | 50 | partner = self.pool.get('res.partner').browse( |
266 | 51 | cr, uid, order.partner_id.id) | ||
267 | 46 | picking_obj = self.pool.get('stock.picking') | 52 | picking_obj = self.pool.get('stock.picking') |
269 | 47 | picking_ids = picking_obj.search(cr, uid, [('sale_id', '=', order.id)]) | 53 | picking_ids = picking_obj.search( |
270 | 54 | cr, uid, [('sale_id', '=', order.id)]) | ||
271 | 48 | for picking_id in picking_ids: | 55 | for picking_id in picking_ids: |
277 | 49 | picking_obj.write(cr, uid, picking_id, { | 56 | picking_obj.write( |
278 | 50 | # 'order_id': order.id, | 57 | cr, uid, picking_id, { |
279 | 51 | 'carriage_condition_id': partner.carriage_condition_id.id, | 58 | 'carriage_condition_id': |
280 | 52 | 'goods_description_id': partner.goods_description_id.id, | 59 | partner.carriage_condition_id.id, |
281 | 53 | 'transportation_reason_id': partner.transportation_reason_id.id, | 60 | 'goods_description_id': |
282 | 61 | partner.goods_description_id.id, | ||
283 | 62 | 'transportation_reason_id': | ||
284 | 63 | partner.transportation_reason_id.id, | ||
285 | 54 | }) | 64 | }) |
286 | 55 | return True | 65 | return True |
287 | 56 | |||
288 | 57 | sale_order() | ||
289 | 58 | |||
290 | 59 | |||
291 | 60 | 66 | ||
292 | === modified file 'l10n_it_sale/stock/__init__.py' | |||
293 | --- l10n_it_sale/stock/__init__.py 2013-03-13 08:21:42 +0000 | |||
294 | +++ l10n_it_sale/stock/__init__.py 2014-05-22 13:05:57 +0000 | |||
295 | @@ -1,6 +1,6 @@ | |||
296 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
297 | 2 | ############################################################################## | 2 | ############################################################################## |
299 | 3 | # | 3 | # |
300 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
301 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
302 | 6 | # | 6 | # |
303 | @@ -20,5 +20,3 @@ | |||
304 | 20 | ############################################################################## | 20 | ############################################################################## |
305 | 21 | 21 | ||
306 | 22 | import picking | 22 | import picking |
307 | 23 | |||
308 | 24 | |||
309 | 25 | 23 | ||
310 | === modified file 'l10n_it_sale/stock/picking.py' | |||
311 | --- l10n_it_sale/stock/picking.py 2014-01-23 12:58:16 +0000 | |||
312 | +++ l10n_it_sale/stock/picking.py 2014-05-22 13:05:57 +0000 | |||
313 | @@ -1,6 +1,6 @@ | |||
314 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
315 | 2 | ############################################################################## | 2 | ############################################################################## |
317 | 3 | # | 3 | # |
318 | 4 | # Copyright (C) 2010-2012 Associazione OpenERP Italia | 4 | # Copyright (C) 2010-2012 Associazione OpenERP Italia |
319 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
320 | 6 | # | 6 | # |
321 | @@ -20,10 +20,12 @@ | |||
322 | 20 | ############################################################################## | 20 | ############################################################################## |
323 | 21 | 21 | ||
324 | 22 | import netsvc | 22 | import netsvc |
326 | 23 | import pooler, tools | 23 | import pooler |
327 | 24 | import tools | ||
328 | 24 | 25 | ||
329 | 25 | from openerp.osv import orm, fields | 26 | from openerp.osv import orm, fields |
330 | 26 | 27 | ||
331 | 28 | |||
332 | 27 | class stock_picking_carriage_condition(orm.Model): | 29 | class stock_picking_carriage_condition(orm.Model): |
333 | 28 | """ | 30 | """ |
334 | 29 | Carriage condition | 31 | Carriage condition |
335 | @@ -31,10 +33,12 @@ | |||
336 | 31 | _name = "stock.picking.carriage_condition" | 33 | _name = "stock.picking.carriage_condition" |
337 | 32 | _description = "Carriage Condition" | 34 | _description = "Carriage Condition" |
338 | 33 | _columns = { | 35 | _columns = { |
340 | 34 | 'name':fields.char('Carriage Condition', size=64, required=True, readonly=False), | 36 | 'name': fields.char( |
341 | 37 | 'Carriage Condition', size=64, required=True, readonly=False), | ||
342 | 35 | 'note': fields.text('Note'), | 38 | 'note': fields.text('Note'), |
343 | 36 | } | 39 | } |
344 | 37 | 40 | ||
345 | 41 | |||
346 | 38 | class stock_picking_goods_description(orm.Model): | 42 | class stock_picking_goods_description(orm.Model): |
347 | 39 | """ | 43 | """ |
348 | 40 | Description of Goods | 44 | Description of Goods |
349 | @@ -43,9 +47,10 @@ | |||
350 | 43 | _description = "Description of Goods" | 47 | _description = "Description of Goods" |
351 | 44 | 48 | ||
352 | 45 | _columns = { | 49 | _columns = { |
356 | 46 | 'name':fields.char('Description of Goods', size=64, required=True, readonly=False), | 50 | 'name': fields.char( |
357 | 47 | 'note': fields.text('Note'), | 51 | 'Description of Goods', size=64, required=True, readonly=False), |
358 | 48 | } | 52 | 'note': fields.text('Note')} |
359 | 53 | |||
360 | 49 | 54 | ||
361 | 50 | class stock_picking_reason(orm.Model): | 55 | class stock_picking_reason(orm.Model): |
362 | 51 | """ | 56 | """ |
363 | @@ -55,51 +60,71 @@ | |||
364 | 55 | _description = 'Reason for transportation' | 60 | _description = 'Reason for transportation' |
365 | 56 | 61 | ||
366 | 57 | _columns = { | 62 | _columns = { |
368 | 58 | 'name':fields.char('Reason For Transportation', size=64, required=True, readonly=False), | 63 | 'name': fields.char( |
369 | 64 | 'Reason For Transportation', size=64, required=True, | ||
370 | 65 | readonly=False), | ||
371 | 59 | 'note': fields.text('Note'), | 66 | 'note': fields.text('Note'), |
372 | 60 | } | 67 | } |
373 | 61 | 68 | ||
374 | 69 | |||
375 | 62 | class stock_picking_out(orm.Model): | 70 | class stock_picking_out(orm.Model): |
376 | 63 | _inherit = "stock.picking.out" | 71 | _inherit = "stock.picking.out" |
383 | 64 | _columns = { | 72 | _columns = { |
384 | 65 | 'carriage_condition_id': fields.many2one('stock.picking.carriage_condition', 'Carriage condition'), | 73 | 'carriage_condition_id': fields.many2one( |
385 | 66 | 'goods_description_id': fields.many2one('stock.picking.goods_description', 'Description of goods'), | 74 | 'stock.picking.carriage_condition', 'Carriage condition'), |
386 | 67 | 'transportation_reason_id': fields.many2one('stock.picking.transportation_reason', 'Reason for transportation'), | 75 | 'goods_description_id': fields.many2one( |
387 | 68 | 'ddt_number': fields.char('DDT', size=64), | 76 | 'stock.picking.goods_description', 'Description of goods'), |
388 | 69 | 'ddt_date': fields.date('DDT date'), | 77 | 'transportation_reason_id': fields.many2one( |
389 | 78 | 'stock.picking.transportation_reason', | ||
390 | 79 | 'Reason for transportation'), | ||
391 | 80 | 'ddt_number': fields.char('DDT', size=64), | ||
392 | 81 | 'ddt_date': fields.date('DDT date'), | ||
393 | 70 | } | 82 | } |
394 | 71 | 83 | ||
399 | 72 | def action_invoice_create(self, cursor, user, ids, journal_id=False, | 84 | def action_invoice_create( |
400 | 73 | group=False, type='out_invoice', context=None): | 85 | self, cursor, user, ids, journal_id=False, group=False, |
401 | 74 | res = super(stock_picking_out, self).action_invoice_create(cursor, user, ids, journal_id, | 86 | type='out_invoice', context=None): |
402 | 75 | group, type, context) | 87 | res = super(stock_picking_out, self).action_invoice_create( |
403 | 88 | cursor, user, ids, journal_id, group, type, context) | ||
404 | 76 | for picking in self.browse(cursor, user, ids, context=context): | 89 | for picking in self.browse(cursor, user, ids, context=context): |
409 | 77 | self.pool.get('account.invoice').write(cursor, user, res[picking.id], { | 90 | self.pool.get('account.invoice').write( |
410 | 78 | 'carriage_condition_id': picking.carriage_condition_id.id, | 91 | cursor, user, res[picking.id], { |
411 | 79 | 'goods_description_id': picking.goods_description_id.id, | 92 | 'carriage_condition_id': |
412 | 80 | 'transportation_reason_id': picking.transportation_reason_id.id, | 93 | picking.carriage_condition_id.id, |
413 | 94 | 'goods_description_id': | ||
414 | 95 | picking.goods_description_id.id, | ||
415 | 96 | 'transportation_reason_id': | ||
416 | 97 | picking.transportation_reason_id.id, | ||
417 | 81 | }) | 98 | }) |
418 | 82 | return res | 99 | return res |
419 | 83 | 100 | ||
421 | 84 | #----------------------------------------------------------------------------- | 101 | # ------------------------------------------------------------------------- |
422 | 85 | # EVITARE LA COPIA DI 'NUMERO DDT' | 102 | # EVITARE LA COPIA DI 'NUMERO DDT' |
424 | 86 | #----------------------------------------------------------------------------- | 103 | # ------------------------------------------------------------------------- |
425 | 87 | def copy(self, cr, uid, id, default=None, context=None): | 104 | def copy(self, cr, uid, id, default=None, context=None): |
426 | 88 | if default is None: | 105 | if default is None: |
427 | 89 | default = {} | 106 | default = {} |
428 | 90 | default.update({'ddt_number': ''}) | 107 | default.update({'ddt_number': ''}) |
430 | 91 | return super(stock_picking_out, self).copy(cr, uid, id, default, context=context) | 108 | return super(stock_picking_out, self).copy( |
431 | 109 | cr, uid, id, default, context=context) | ||
432 | 92 | 110 | ||
435 | 93 | # Redefinition of the new fields in order to update the model stock.picking in the orm | 111 | # Redefinition of the new fields in order to update the model stock.picking in |
436 | 94 | # FIXME: this is a temporary workaround because of a framework bug (ref: lp996816). | 112 | # the orm |
437 | 113 | # FIXME: this is a temporary workaround because of a framework bug: lp996816 | ||
438 | 95 | # It should be removed as soon as | 114 | # It should be removed as soon as |
439 | 96 | # the bug is fixed | 115 | # the bug is fixed |
440 | 116 | |||
441 | 117 | |||
442 | 97 | class stock_picking(orm.Model): | 118 | class stock_picking(orm.Model): |
443 | 98 | _inherit = 'stock.picking' | 119 | _inherit = 'stock.picking' |
450 | 99 | _columns = { | 120 | _columns = { |
451 | 100 | 'carriage_condition_id': fields.many2one('stock.picking.carriage_condition', 'Carriage condition'), | 121 | 'carriage_condition_id': fields.many2one( |
452 | 101 | 'goods_description_id': fields.many2one('stock.picking.goods_description', 'Description of goods'), | 122 | 'stock.picking.carriage_condition', 'Carriage condition'), |
453 | 102 | 'transportation_reason_id': fields.many2one('stock.picking.transportation_reason', 'Reason for transportation'), | 123 | 'goods_description_id': fields.many2one( |
454 | 103 | 'ddt_number': fields.char('DDT', size=64), | 124 | 'stock.picking.goods_description', 'Description of goods'), |
455 | 104 | 'ddt_date': fields.date('DDT date'), | 125 | 'transportation_reason_id': fields.many2one( |
456 | 126 | 'stock.picking.transportation_reason', | ||
457 | 127 | 'Reason for transportation'), | ||
458 | 128 | 'ddt_number': fields.char('DDT', size=64), | ||
459 | 129 | 'ddt_date': fields.date('DDT date'), | ||
460 | 105 | } | 130 | } |
461 | 106 | 131 | ||
462 | === modified file 'l10n_it_sale/wizard/__init__.py' | |||
463 | --- l10n_it_sale/wizard/__init__.py 2013-03-13 08:21:42 +0000 | |||
464 | +++ l10n_it_sale/wizard/__init__.py 2014-05-22 13:05:57 +0000 | |||
465 | @@ -1,6 +1,6 @@ | |||
466 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
467 | 2 | ############################################################################## | 2 | ############################################################################## |
469 | 3 | # | 3 | # |
470 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
471 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
472 | 6 | # | 6 | # |
473 | 7 | 7 | ||
474 | === modified file 'l10n_it_sale/wizard/assign_ddt.py' | |||
475 | --- l10n_it_sale/wizard/assign_ddt.py 2013-06-16 12:53:29 +0000 | |||
476 | +++ l10n_it_sale/wizard/assign_ddt.py 2014-05-22 13:05:57 +0000 | |||
477 | @@ -1,6 +1,6 @@ | |||
478 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
479 | 2 | ############################################################################## | 2 | ############################################################################## |
481 | 3 | # | 3 | # |
482 | 4 | # Copyright (C) 2010 Associazione OpenERP Italia | 4 | # Copyright (C) 2010 Associazione OpenERP Italia |
483 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
484 | 6 | # | 6 | # |
485 | @@ -19,23 +19,25 @@ | |||
486 | 19 | # | 19 | # |
487 | 20 | ############################################################################## | 20 | ############################################################################## |
488 | 21 | 21 | ||
490 | 22 | from openerp.osv import orm, fields | 22 | from openerp.osv import orm |
491 | 23 | from tools.translate import _ | 23 | from tools.translate import _ |
492 | 24 | import time | 24 | import time |
493 | 25 | 25 | ||
494 | 26 | |||
495 | 26 | class wizard_assign_ddt(orm.TransientModel): | 27 | class wizard_assign_ddt(orm.TransientModel): |
496 | 27 | 28 | ||
497 | 28 | _name = "wizard.assign.ddt" | 29 | _name = "wizard.assign.ddt" |
498 | 29 | 30 | ||
499 | 30 | def assign_ddt(self, cr, uid, ids, context=None): | 31 | def assign_ddt(self, cr, uid, ids, context=None): |
500 | 31 | picking_obj = self.pool.get('stock.picking.out') | 32 | picking_obj = self.pool.get('stock.picking.out') |
502 | 32 | for picking in picking_obj.browse(cr, uid, context.get('active_ids', []), context=context): | 33 | for picking in picking_obj.browse( |
503 | 34 | cr, uid, context.get('active_ids', []), context=context): | ||
504 | 33 | if picking.ddt_number: | 35 | if picking.ddt_number: |
505 | 34 | raise orm.except_orm('Error', _('DTT number already assigned')) | 36 | raise orm.except_orm('Error', _('DTT number already assigned')) |
506 | 35 | picking.write({ | 37 | picking.write({ |
510 | 36 | 'ddt_number': self.pool.get('ir.sequence').get(cr, uid, 'stock.ddt'), | 38 | 'ddt_number': self.pool.get('ir.sequence').get( |
511 | 37 | 'ddt_date': time.strftime('%Y-%m-%d'), | 39 | cr, uid, 'stock.ddt'), |
512 | 38 | }) | 40 | 'ddt_date': time.strftime('%Y-%m-%d')}) |
513 | 39 | return { | 41 | return { |
514 | 40 | 'type': 'ir.actions.act_window_close', | 42 | 'type': 'ir.actions.act_window_close', |
515 | 41 | } | 43 | } |
ho escluso F401, siccome mi era parso di leggere che si preferisce tollerare il controllo piuttosto che riempire il codice di assert