Merge lp:~camptocamp/sale-reports/add-html-note-flow into lp:~sale-core-editors/sale-reports/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
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

Description of the change

Add sale_note_flow + html_sale_product_note
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 :

I updated __openerp__.py of both new modules.

LGTM

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
=== added directory 'html_sale_product_note'
=== added file 'html_sale_product_note/__init__.py'
--- html_sale_product_note/__init__.py 1970-01-01 00:00:00 +0000
+++ html_sale_product_note/__init__.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from . import product
22from . import sale_order
023
=== added file 'html_sale_product_note/__openerp__.py'
--- html_sale_product_note/__openerp__.py 1970-01-01 00:00:00 +0000
+++ html_sale_product_note/__openerp__.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,39 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{'name': 'HTML note in product reported in sale order report',
23 'version': '1.0.1',
24 'category': 'other',
25 'description': """
26Sale product note
27=================
28
29This module replaces sale description in product with a HTML field.
30It also adds this description into the HTML note
31of the sale order line when the product is set.""",
32 'author': 'Camptocamp',
33 'website': 'http://www.camptocamp.com',
34 'depends': ['product', 'sale', 'sale_order_webkit'],
35 'data': [],
36 'test': [],
37 'installable': True,
38 'active': False,
39 }
040
=== added file 'html_sale_product_note/product.py'
--- html_sale_product_note/product.py 1970-01-01 00:00:00 +0000
+++ html_sale_product_note/product.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,28 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import orm, fields
22
23
24class ProductTemplate(orm.Model):
25
26 _inherit = 'product.template'
27
28 _columns = {'description_sale': fields.html('Sale Description')}
029
=== added file 'html_sale_product_note/sale_order.py'
--- html_sale_product_note/sale_order.py 1970-01-01 00:00:00 +0000
+++ html_sale_product_note/sale_order.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,51 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import orm
22
23
24class SaleOrderLine(orm.Model):
25
26 _inherit = 'sale.order.line'
27
28 def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
29 uom=False, qty_uos=0, uos=False, name='', partner_id=False,
30 lang=False, update_tax=True, date_order=False, packaging=False,
31 fiscal_position=False, flag=False, context=None):
32
33 # Can you feel the pain?
34 res = super(SaleOrderLine, self).product_id_change(cr, uid, ids, pricelist,
35 product, qty=qty,
36 uom=uom, qty_uos=0,
37 uos=uos, name=name,
38 partner_id=partner_id,
39 lang=lang, update_tax=update_tax,
40 date_order=date_order,
41 packaging=packaging,
42 fiscal_position=fiscal_position,
43 flag=flag, context=context)
44 if not product:
45 return res
46 pobj = self.pool['product.product']
47 product_name = pobj.name_get(cr, uid, [product], context=context)[0][1]
48 product_note = pobj.read(cr, uid, product, ['description_sale'], context=context)
49 res['value']['name'] = product_name
50 res['value']['formatted_note'] = product_note['description_sale']
51 return res
052
=== added directory 'sale_note_flow'
=== added file 'sale_note_flow/__init__.py'
--- sale_note_flow/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_note_flow/__init__.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,21 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from . import sale
022
=== added file 'sale_note_flow/__openerp__.py'
--- sale_note_flow/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_note_flow/__openerp__.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,43 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{'name': 'HTML note from sale order in invoice',
23 'version': '1.0.0',
24 'category': 'other',
25 'description': """
26Sale order to invoice notes
27===========================
28
29This module forwards the `note` field of sale order lines to the
30`note` field of invoice line when an invoice in generated from a sale
31order.
32""",
33 'author': 'Camptocamp',
34 'website': 'http://www.camptocamp.com',
35 'depends': ['html_invoice_product_note',
36 'html_sale_product_note',
37 'invoice_webkit',
38 'sale_order_webkit'],
39 'data': [],
40 'test': [],
41 'installable': True,
42 'active': False,
43 }
044
=== added file 'sale_note_flow/sale.py'
--- sale_note_flow/sale.py 1970-01-01 00:00:00 +0000
+++ sale_note_flow/sale.py 2013-03-18 09:03:21 +0000
@@ -0,0 +1,44 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import orm
22
23
24class SaleOrder(orm.Model):
25
26 _inherit = "sale.order"
27
28 def _prepare_invoice(self, cr, uid, order, lines, context=None):
29 res = super(SaleOrder, self)._prepare_invoice(cr, uid, order,
30 lines, context=context)
31 res.update({'note1': order.note1, 'note2': order.note2})
32 return res
33
34
35class SaleOrderline(orm.Model):
36
37 _inherit = "sale.order.line"
38
39 def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
40 res = super(SaleOrderline, self)._prepare_order_line_invoice_line(cr, uid, line,
41 account_id=False,
42 context=context)
43 res.update({'formatted_note': line.formatted_note})
44 return res
045
=== modified file 'sale_order_webkit/sale.py'
--- sale_order_webkit/sale.py 2013-02-14 10:12:45 +0000
+++ sale_order_webkit/sale.py 2013-03-18 09:03:21 +0000
@@ -54,7 +54,7 @@
54 return {}54 return {}
55 try:55 try:
56 lang = self.browse(cursor, uid, inv_id)[0].partner_id.lang56 lang = self.browse(cursor, uid, inv_id)[0].partner_id.lang
57 except Exception, exc:57 except Exception as exc:
58 lang = 'en_US'58 lang = 'en_US'
59 cond = self.pool.get('sale.condition_text').browse(cursor, uid,59 cond = self.pool.get('sale.condition_text').browse(cursor, uid,
60 commentid, {'lang': lang})60 commentid, {'lang': lang})
@@ -65,20 +65,22 @@
6565
66 def set_footer(self, cursor, uid, inv_id, commentid):66 def set_footer(self, cursor, uid, inv_id, commentid):
67 return self._set_condition(cursor, uid, inv_id, commentid, 'note2')67 return self._set_condition(cursor, uid, inv_id, commentid, 'note2')
68 68
69 def print_quotation(self, cursor, uid, ids, context=None):69 def print_quotation(self, cursor, uid, ids, context=None):
70 '''70 '''
71 This function prints the sales order and mark it as sent, so that we can see more easily the next step of the workflow71 This function prints the sales order and mark it as sent,
72 so that we can see more easily the next step of the workflow
72 '''73 '''
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'
74 wf_service = netsvc.LocalService("workflow")75 wf_service = netsvc.LocalService("workflow")
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)
76 datas = {77 datas = {'model': 'sale.order',
77 'model': 'sale.order',
78 'ids': ids,78 'ids': ids,
79 'form': self.read(cursor, uid, ids[0], context=context),79 'form': self.read(cursor, uid, ids[0], context=context),
80 }80 }
81 return {'type': 'ir.actions.report.xml', 'report_name': 'sale.order.webkit', 'datas': datas, 'nodestroy': True}81 return {'type': 'ir.actions.report.xml',
82 'report_name': 'sale.order.webkit',
83 'datas': datas, 'nodestroy': True}
8284
8385
84class SaleOrderLine(orm.Model):86class SaleOrderLine(orm.Model):

Subscribers

People subscribed via source and target branches