Merge lp:~camptocamp/sale-reports/add-html-note-flow into lp:~sale-core-editors/sale-reports/7.0
- add-html-note-flow
- Merge into 7.0
Proposed by
Nicolas Bessi - Camptocamp
Status: | Merged |
---|---|
Approved by: | Guewen Baconnier @ Camptocamp |
Approved revision: | 17 |
Merged at revision: | 16 |
Proposed branch: | lp:~camptocamp/sale-reports/add-html-note-flow |
Merge into: | lp:~sale-core-editors/sale-reports/7.0 |
Diff against target: |
326 lines (+257/-7) 8 files modified
html_sale_product_note/__init__.py (+22/-0) html_sale_product_note/__openerp__.py (+39/-0) html_sale_product_note/product.py (+28/-0) html_sale_product_note/sale_order.py (+51/-0) sale_note_flow/__init__.py (+21/-0) sale_note_flow/__openerp__.py (+43/-0) sale_note_flow/sale.py (+44/-0) sale_order_webkit/sale.py (+9/-7) |
To merge this branch: | bzr merge lp:~camptocamp/sale-reports/add-html-note-flow |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guewen Baconnier @ Camptocamp | Approve | ||
Alexandre Fayolle - camptocamp | code review, no test | Approve | |
Review via email: mp+153371@code.launchpad.net |
Commit message
Description of the change
Add sale_note_flow + html_sale_
Some pep8
To post a comment you must log in.
- 17. By Alexandre Fayolle - camptocamp
-
[IMP] updated __openerp__.py of both new modules
* improved description
* merged init_xml/update_xml in data, removed demo_xml
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : | # |
review:
Approve
(code review, no test)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'html_sale_product_note' | |||
2 | === added file 'html_sale_product_note/__init__.py' | |||
3 | --- html_sale_product_note/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ html_sale_product_note/__init__.py 2013-03-18 09:03:21 +0000 | |||
5 | @@ -0,0 +1,22 @@ | |||
6 | 1 | # -*- coding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
10 | 5 | # @author Nicolas Bessi | ||
11 | 6 | # | ||
12 | 7 | # This program is free software: you can redistribute it and/or modify | ||
13 | 8 | # it under the terms of the GNU Affero General Public License as | ||
14 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
15 | 10 | # License, or (at your option) any later version. | ||
16 | 11 | # | ||
17 | 12 | # This program is distributed in the hope that it will be useful, | ||
18 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | 15 | # GNU Affero General Public License for more details. | ||
21 | 16 | # | ||
22 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
23 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | 19 | # | ||
25 | 20 | ############################################################################## | ||
26 | 21 | from . import product | ||
27 | 22 | from . import sale_order | ||
28 | 0 | 23 | ||
29 | === added file 'html_sale_product_note/__openerp__.py' | |||
30 | --- html_sale_product_note/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
31 | +++ html_sale_product_note/__openerp__.py 2013-03-18 09:03:21 +0000 | |||
32 | @@ -0,0 +1,39 @@ | |||
33 | 1 | # -*- coding: utf-8 -*- | ||
34 | 2 | ############################################################################## | ||
35 | 3 | # | ||
36 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
37 | 5 | # @author Nicolas Bessi | ||
38 | 6 | # | ||
39 | 7 | # This program is free software: you can redistribute it and/or modify | ||
40 | 8 | # it under the terms of the GNU Affero General Public License as | ||
41 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
42 | 10 | # License, or (at your option) any later version. | ||
43 | 11 | # | ||
44 | 12 | # This program is distributed in the hope that it will be useful, | ||
45 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
46 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
47 | 15 | # GNU Affero General Public License for more details. | ||
48 | 16 | # | ||
49 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
50 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
51 | 19 | # | ||
52 | 20 | ############################################################################## | ||
53 | 21 | |||
54 | 22 | {'name': 'HTML note in product reported in sale order report', | ||
55 | 23 | 'version': '1.0.1', | ||
56 | 24 | 'category': 'other', | ||
57 | 25 | 'description': """ | ||
58 | 26 | Sale product note | ||
59 | 27 | ================= | ||
60 | 28 | |||
61 | 29 | This module replaces sale description in product with a HTML field. | ||
62 | 30 | It also adds this description into the HTML note | ||
63 | 31 | of the sale order line when the product is set.""", | ||
64 | 32 | 'author': 'Camptocamp', | ||
65 | 33 | 'website': 'http://www.camptocamp.com', | ||
66 | 34 | 'depends': ['product', 'sale', 'sale_order_webkit'], | ||
67 | 35 | 'data': [], | ||
68 | 36 | 'test': [], | ||
69 | 37 | 'installable': True, | ||
70 | 38 | 'active': False, | ||
71 | 39 | } | ||
72 | 0 | 40 | ||
73 | === added file 'html_sale_product_note/product.py' | |||
74 | --- html_sale_product_note/product.py 1970-01-01 00:00:00 +0000 | |||
75 | +++ html_sale_product_note/product.py 2013-03-18 09:03:21 +0000 | |||
76 | @@ -0,0 +1,28 @@ | |||
77 | 1 | # -*- coding: utf-8 -*- | ||
78 | 2 | ############################################################################## | ||
79 | 3 | # | ||
80 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
81 | 5 | # @author Nicolas Bessi | ||
82 | 6 | # | ||
83 | 7 | # This program is free software: you can redistribute it and/or modify | ||
84 | 8 | # it under the terms of the GNU Affero General Public License as | ||
85 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
86 | 10 | # License, or (at your option) any later version. | ||
87 | 11 | # | ||
88 | 12 | # This program is distributed in the hope that it will be useful, | ||
89 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
90 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
91 | 15 | # GNU Affero General Public License for more details. | ||
92 | 16 | # | ||
93 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
94 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
95 | 19 | # | ||
96 | 20 | ############################################################################## | ||
97 | 21 | from openerp.osv import orm, fields | ||
98 | 22 | |||
99 | 23 | |||
100 | 24 | class ProductTemplate(orm.Model): | ||
101 | 25 | |||
102 | 26 | _inherit = 'product.template' | ||
103 | 27 | |||
104 | 28 | _columns = {'description_sale': fields.html('Sale Description')} | ||
105 | 0 | 29 | ||
106 | === added file 'html_sale_product_note/sale_order.py' | |||
107 | --- html_sale_product_note/sale_order.py 1970-01-01 00:00:00 +0000 | |||
108 | +++ html_sale_product_note/sale_order.py 2013-03-18 09:03:21 +0000 | |||
109 | @@ -0,0 +1,51 @@ | |||
110 | 1 | # -*- coding: utf-8 -*- | ||
111 | 2 | ############################################################################## | ||
112 | 3 | # | ||
113 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
114 | 5 | # @author Nicolas Bessi | ||
115 | 6 | # | ||
116 | 7 | # This program is free software: you can redistribute it and/or modify | ||
117 | 8 | # it under the terms of the GNU Affero General Public License as | ||
118 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
119 | 10 | # License, or (at your option) any later version. | ||
120 | 11 | # | ||
121 | 12 | # This program is distributed in the hope that it will be useful, | ||
122 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
123 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
124 | 15 | # GNU Affero General Public License for more details. | ||
125 | 16 | # | ||
126 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
127 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
128 | 19 | # | ||
129 | 20 | ############################################################################## | ||
130 | 21 | from openerp.osv import orm | ||
131 | 22 | |||
132 | 23 | |||
133 | 24 | class SaleOrderLine(orm.Model): | ||
134 | 25 | |||
135 | 26 | _inherit = 'sale.order.line' | ||
136 | 27 | |||
137 | 28 | def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, | ||
138 | 29 | uom=False, qty_uos=0, uos=False, name='', partner_id=False, | ||
139 | 30 | lang=False, update_tax=True, date_order=False, packaging=False, | ||
140 | 31 | fiscal_position=False, flag=False, context=None): | ||
141 | 32 | |||
142 | 33 | # Can you feel the pain? | ||
143 | 34 | res = super(SaleOrderLine, self).product_id_change(cr, uid, ids, pricelist, | ||
144 | 35 | product, qty=qty, | ||
145 | 36 | uom=uom, qty_uos=0, | ||
146 | 37 | uos=uos, name=name, | ||
147 | 38 | partner_id=partner_id, | ||
148 | 39 | lang=lang, update_tax=update_tax, | ||
149 | 40 | date_order=date_order, | ||
150 | 41 | packaging=packaging, | ||
151 | 42 | fiscal_position=fiscal_position, | ||
152 | 43 | flag=flag, context=context) | ||
153 | 44 | if not product: | ||
154 | 45 | return res | ||
155 | 46 | pobj = self.pool['product.product'] | ||
156 | 47 | product_name = pobj.name_get(cr, uid, [product], context=context)[0][1] | ||
157 | 48 | product_note = pobj.read(cr, uid, product, ['description_sale'], context=context) | ||
158 | 49 | res['value']['name'] = product_name | ||
159 | 50 | res['value']['formatted_note'] = product_note['description_sale'] | ||
160 | 51 | return res | ||
161 | 0 | 52 | ||
162 | === added directory 'sale_note_flow' | |||
163 | === added file 'sale_note_flow/__init__.py' | |||
164 | --- sale_note_flow/__init__.py 1970-01-01 00:00:00 +0000 | |||
165 | +++ sale_note_flow/__init__.py 2013-03-18 09:03:21 +0000 | |||
166 | @@ -0,0 +1,21 @@ | |||
167 | 1 | # -*- coding: utf-8 -*- | ||
168 | 2 | ############################################################################## | ||
169 | 3 | # | ||
170 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
171 | 5 | # @author Nicolas Bessi | ||
172 | 6 | # | ||
173 | 7 | # This program is free software: you can redistribute it and/or modify | ||
174 | 8 | # it under the terms of the GNU Affero General Public License as | ||
175 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
176 | 10 | # License, or (at your option) any later version. | ||
177 | 11 | # | ||
178 | 12 | # This program is distributed in the hope that it will be useful, | ||
179 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
180 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
181 | 15 | # GNU Affero General Public License for more details. | ||
182 | 16 | # | ||
183 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
184 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
185 | 19 | # | ||
186 | 20 | ############################################################################## | ||
187 | 21 | from . import sale | ||
188 | 0 | 22 | ||
189 | === added file 'sale_note_flow/__openerp__.py' | |||
190 | --- sale_note_flow/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
191 | +++ sale_note_flow/__openerp__.py 2013-03-18 09:03:21 +0000 | |||
192 | @@ -0,0 +1,43 @@ | |||
193 | 1 | # -*- coding: utf-8 -*- | ||
194 | 2 | ############################################################################## | ||
195 | 3 | # | ||
196 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
197 | 5 | # @author Nicolas Bessi | ||
198 | 6 | # | ||
199 | 7 | # This program is free software: you can redistribute it and/or modify | ||
200 | 8 | # it under the terms of the GNU Affero General Public License as | ||
201 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
202 | 10 | # License, or (at your option) any later version. | ||
203 | 11 | # | ||
204 | 12 | # This program is distributed in the hope that it will be useful, | ||
205 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
206 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
207 | 15 | # GNU Affero General Public License for more details. | ||
208 | 16 | # | ||
209 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
210 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
211 | 19 | # | ||
212 | 20 | ############################################################################## | ||
213 | 21 | |||
214 | 22 | {'name': 'HTML note from sale order in invoice', | ||
215 | 23 | 'version': '1.0.0', | ||
216 | 24 | 'category': 'other', | ||
217 | 25 | 'description': """ | ||
218 | 26 | Sale order to invoice notes | ||
219 | 27 | =========================== | ||
220 | 28 | |||
221 | 29 | This module forwards the `note` field of sale order lines to the | ||
222 | 30 | `note` field of invoice line when an invoice in generated from a sale | ||
223 | 31 | order. | ||
224 | 32 | """, | ||
225 | 33 | 'author': 'Camptocamp', | ||
226 | 34 | 'website': 'http://www.camptocamp.com', | ||
227 | 35 | 'depends': ['html_invoice_product_note', | ||
228 | 36 | 'html_sale_product_note', | ||
229 | 37 | 'invoice_webkit', | ||
230 | 38 | 'sale_order_webkit'], | ||
231 | 39 | 'data': [], | ||
232 | 40 | 'test': [], | ||
233 | 41 | 'installable': True, | ||
234 | 42 | 'active': False, | ||
235 | 43 | } | ||
236 | 0 | 44 | ||
237 | === added file 'sale_note_flow/sale.py' | |||
238 | --- sale_note_flow/sale.py 1970-01-01 00:00:00 +0000 | |||
239 | +++ sale_note_flow/sale.py 2013-03-18 09:03:21 +0000 | |||
240 | @@ -0,0 +1,44 @@ | |||
241 | 1 | # -*- coding: utf-8 -*- | ||
242 | 2 | ############################################################################## | ||
243 | 3 | # | ||
244 | 4 | # Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com) | ||
245 | 5 | # @author Nicolas Bessi | ||
246 | 6 | # | ||
247 | 7 | # This program is free software: you can redistribute it and/or modify | ||
248 | 8 | # it under the terms of the GNU Affero General Public License as | ||
249 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
250 | 10 | # License, or (at your option) any later version. | ||
251 | 11 | # | ||
252 | 12 | # This program is distributed in the hope that it will be useful, | ||
253 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
254 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
255 | 15 | # GNU Affero General Public License for more details. | ||
256 | 16 | # | ||
257 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
258 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
259 | 19 | # | ||
260 | 20 | ############################################################################## | ||
261 | 21 | from openerp.osv import orm | ||
262 | 22 | |||
263 | 23 | |||
264 | 24 | class SaleOrder(orm.Model): | ||
265 | 25 | |||
266 | 26 | _inherit = "sale.order" | ||
267 | 27 | |||
268 | 28 | def _prepare_invoice(self, cr, uid, order, lines, context=None): | ||
269 | 29 | res = super(SaleOrder, self)._prepare_invoice(cr, uid, order, | ||
270 | 30 | lines, context=context) | ||
271 | 31 | res.update({'note1': order.note1, 'note2': order.note2}) | ||
272 | 32 | return res | ||
273 | 33 | |||
274 | 34 | |||
275 | 35 | class SaleOrderline(orm.Model): | ||
276 | 36 | |||
277 | 37 | _inherit = "sale.order.line" | ||
278 | 38 | |||
279 | 39 | def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None): | ||
280 | 40 | res = super(SaleOrderline, self)._prepare_order_line_invoice_line(cr, uid, line, | ||
281 | 41 | account_id=False, | ||
282 | 42 | context=context) | ||
283 | 43 | res.update({'formatted_note': line.formatted_note}) | ||
284 | 44 | return res | ||
285 | 0 | 45 | ||
286 | === modified file 'sale_order_webkit/sale.py' | |||
287 | --- sale_order_webkit/sale.py 2013-02-14 10:12:45 +0000 | |||
288 | +++ sale_order_webkit/sale.py 2013-03-18 09:03:21 +0000 | |||
289 | @@ -54,7 +54,7 @@ | |||
290 | 54 | return {} | 54 | return {} |
291 | 55 | try: | 55 | try: |
292 | 56 | lang = self.browse(cursor, uid, inv_id)[0].partner_id.lang | 56 | lang = self.browse(cursor, uid, inv_id)[0].partner_id.lang |
294 | 57 | except Exception, exc: | 57 | except Exception as exc: |
295 | 58 | lang = 'en_US' | 58 | lang = 'en_US' |
296 | 59 | cond = self.pool.get('sale.condition_text').browse(cursor, uid, | 59 | cond = self.pool.get('sale.condition_text').browse(cursor, uid, |
297 | 60 | commentid, {'lang': lang}) | 60 | commentid, {'lang': lang}) |
298 | @@ -65,20 +65,22 @@ | |||
299 | 65 | 65 | ||
300 | 66 | def set_footer(self, cursor, uid, inv_id, commentid): | 66 | def set_footer(self, cursor, uid, inv_id, commentid): |
301 | 67 | return self._set_condition(cursor, uid, inv_id, commentid, 'note2') | 67 | return self._set_condition(cursor, uid, inv_id, commentid, 'note2') |
303 | 68 | 68 | ||
304 | 69 | def print_quotation(self, cursor, uid, ids, context=None): | 69 | def print_quotation(self, cursor, uid, ids, context=None): |
305 | 70 | ''' | 70 | ''' |
307 | 71 | This function prints the sales order and mark it as sent, so that we can see more easily the next step of the workflow | 71 | This function prints the sales order and mark it as sent, |
308 | 72 | so that we can see more easily the next step of the workflow | ||
309 | 72 | ''' | 73 | ''' |
310 | 73 | assert len(ids) == 1, 'This option should only be used for a single id at a time' | 74 | assert len(ids) == 1, 'This option should only be used for a single id at a time' |
311 | 74 | wf_service = netsvc.LocalService("workflow") | 75 | wf_service = netsvc.LocalService("workflow") |
312 | 75 | wf_service.trg_validate(uid, 'sale.order', ids[0], 'quotation_sent', cursor) | 76 | wf_service.trg_validate(uid, 'sale.order', ids[0], 'quotation_sent', cursor) |
315 | 76 | datas = { | 77 | datas = {'model': 'sale.order', |
314 | 77 | 'model': 'sale.order', | ||
316 | 78 | 'ids': ids, | 78 | 'ids': ids, |
317 | 79 | 'form': self.read(cursor, uid, ids[0], context=context), | 79 | 'form': self.read(cursor, uid, ids[0], context=context), |
320 | 80 | } | 80 | } |
321 | 81 | return {'type': 'ir.actions.report.xml', 'report_name': 'sale.order.webkit', 'datas': datas, 'nodestroy': True} | 81 | return {'type': 'ir.actions.report.xml', |
322 | 82 | 'report_name': 'sale.order.webkit', | ||
323 | 83 | 'datas': datas, 'nodestroy': True} | ||
324 | 82 | 84 | ||
325 | 83 | 85 | ||
326 | 84 | class SaleOrderLine(orm.Model): | 86 | class SaleOrderLine(orm.Model): |
I updated __openerp__.py of both new modules.
LGTM