Merge lp:~akretion-team/sale-wkfl/7.0-add-sale_import_lines into lp:~sale-core-editors/sale-wkfl/7.0

Proposed by Raphaël Valyi - http://www.akretion.com
Status: Needs review
Proposed branch: lp:~akretion-team/sale-wkfl/7.0-add-sale_import_lines
Merge into: lp:~sale-core-editors/sale-wkfl/7.0
Prerequisite: lp:~akretion-team/sale-wkfl/7.0-add-sale_group
Diff against target: 277 lines (+251/-0)
5 files modified
sale_import_lines/__init__.py (+1/-0)
sale_import_lines/__openerp__.py (+44/-0)
sale_import_lines/i18n/pt_BR.po (+63/-0)
sale_import_lines/sale.py (+96/-0)
sale_import_lines/sale_view.xml (+47/-0)
To merge this branch: bzr merge lp:~akretion-team/sale-wkfl/7.0-add-sale_import_lines
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Review via email: mp+201021@code.launchpad.net

Description of the change

Adds sale_import_lines module:

Allows to import sale order lines (by customer, order, sale.group...)
into your new current quotation.

This is useful if you have quotations with many lines with similarities
from one quotation to another.

To post a comment you must log in.
42. By Raphaël Valyi - http://www.akretion.com

[REF] udate_xml -> data in __openerp__.py

43. By Raphaël Valyi - http://www.akretion.com

[FIX] string in form node

44. By Raphaël Valyi - http://www.akretion.com

[REF] relative import style

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/sale-workflow. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

44. By Raphaël Valyi - http://www.akretion.com

[REF] relative import style

43. By Raphaël Valyi - http://www.akretion.com

[FIX] string in form node

42. By Raphaël Valyi - http://www.akretion.com

[REF] udate_xml -> data in __openerp__.py

41. By Raphaël Valyi - http://www.akretion.com

[PEP8] line breaks in module description

40. By Raphaël Valyi - http://www.akretion.com

[REF] sale.pool.get -> self.pool[]

39. By Raphaël Valyi - http://www.akretion.com

[REF] further updates for v7 migration and dependence on sale instead of base_project_costing, so project_id -> analytic_account_id

38. By Raphaël Valyi - http://www.akretion.com

[REF] removed unused imports + copyrights

37. By Florian da Costa

[ADD] Brazilian Portuguese translation

36. By Akretion Bot <email address hidden>

[IMP] improved group creation

35. By Akretion Bot <email address hidden>

changed name: plural

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'sale_import_lines'
=== added file 'sale_import_lines/__init__.py'
--- sale_import_lines/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_import_lines/__init__.py 2014-01-10 17:37:52 +0000
@@ -0,0 +1,1 @@
1from . import sale
02
=== added file 'sale_import_lines/__openerp__.py'
--- sale_import_lines/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_import_lines/__openerp__.py 2014-01-10 17:37:52 +0000
@@ -0,0 +1,44 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2013 Akretion LDTA (<http://www.akretion.com>).
6# @author Raphaël Valyi
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 "name" : "Sale Order Line importation utilities",
24 "version": "1.0",
25 "author" : "Akretion",
26 "website" : "http://www.akretion.com",
27 "category" : "Others",
28 "depends" : ["sale", "sale_group"],
29 "description": """
30Allows to import sale order lines (by customer, order, sale.group...)
31into your new current quotation.
32
33This is useful if you have quotations with many lines with similarities
34from one quotation to another.
35 """,
36 "init_xml" : [],
37 "demo_xml" : [],
38 "test" : [],
39 "data": ["sale_view.xml"],
40 'installable': True,
41 'active': False,
42 'certificate': None,
43}
44# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
045
=== added directory 'sale_import_lines/i18n'
=== added file 'sale_import_lines/i18n/pt_BR.po'
--- sale_import_lines/i18n/pt_BR.po 1970-01-01 00:00:00 +0000
+++ sale_import_lines/i18n/pt_BR.po 2014-01-10 17:37:52 +0000
@@ -0,0 +1,63 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * sale_import_lines
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2013-06-10 18:17+0000\n"
10"PO-Revision-Date: 2013-06-10 18:17+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: sale_import_lines
19#: sql_constraint:sale.order:0
20msgid "Order Reference must be unique per Company!"
21msgstr "A Referência do Pedido deve ser única por empresa!"
22
23#. module: sale_import_lines
24#: field:sale_import_lines.wizard,group_id:0
25msgid "Sale Group"
26msgstr "Grupo de Venda"
27
28#. module: sale_import_lines
29#: field:sale_import_lines.wizard,order_line_ids:0
30msgid "Sale Order Lines"
31msgstr "Linhas de pedido de venda"
32
33#. module: sale_import_lines
34#: view:sale_import_lines.wizard:0
35msgid "Cancel"
36msgstr "Cancelar"
37
38#. module: sale_import_lines
39#: view:sale.order:0
40msgid "Import"
41msgstr "Importar"
42
43#. module: sale_import_lines
44#: view:sale_import_lines.wizard:0
45msgid "Validate"
46msgstr "Validar"
47
48#. module: sale_import_lines
49#: model:ir.model,name:sale_import_lines.model_sale_order
50msgid "Sales Order"
51msgstr "Pedido de Venda"
52
53#. module: sale_import_lines
54#: code:addons/sale_import_lines/sale.py:14
55#, python-format
56msgid "Sale Order Lines Importation Wizard"
57msgstr "Linhas de pedido de venda Importação Wizard"
58
59#. module: sale_import_lines
60#: model:ir.model,name:sale_import_lines.model_sale_import_lines_wizard
61msgid "sale_import_lines.wizard"
62msgstr "sale_import_lines.wizard"
63
064
=== added file 'sale_import_lines/sale.py'
--- sale_import_lines/sale.py 1970-01-01 00:00:00 +0000
+++ sale_import_lines/sale.py 2014-01-10 17:37:52 +0000
@@ -0,0 +1,96 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3# #
4# Copyright (C) 2013 Raphaël Valyi - Akretion #
5# #
6#This program is free software: you can redistribute it and/or modify #
7#it under the terms of the GNU Affero General Public License as published by #
8#the Free Software Foundation, either version 3 of the License, or #
9#(at your option) any later version. #
10# #
11#This program is distributed in the hope that it will be useful, #
12#but WITHOUT ANY WARRANTY; without even the implied warranty of #
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14#GNU Affero General Public License for more details. #
15# #
16#You should have received a copy of the GNU Affero General Public License #
17#along with this program. If not, see <http://www.gnu.org/licenses/>. #
18###############################################################################
19
20from osv import orm, fields
21from tools.translate import _
22
23
24class sale_order(orm.Model):
25 _inherit = "sale.order"
26
27 def button_lines_wizard_edit(self, cr, uid, ids, context=None):
28 analytic_account_id = self.read(cr, uid, ids, ['project_id'],
29 context)[0].get('project_id')
30 context['analytic_account_id'] = analytic_account_id and\
31 analytic_account_id[0]
32 return {
33 'context': context,
34 'name': _('Sale Order Lines Importation Wizard'),
35 'view_type': 'form',
36 'view_mode': 'form',
37 'res_model': 'sale_import_lines.wizard',
38 'type': 'ir.actions.act_window',
39 'target': 'new',
40 }
41
42
43class sale_order_line(orm.Model):
44 _inherit = 'sale.order.line'
45
46 _columns = {
47 'product_categ_id': fields.related('product_id', 'categ_id',
48 type='many2one', readonly=True,
49 relation='product.category',
50 store=True,
51 string='Product Category'),
52 }
53
54
55class sale_import_lines_wizard(orm.TransientModel):
56 _name = "sale_import_lines.wizard"
57 _rec_name = "group_id"
58
59 _columns = {
60 'group_id': fields.many2one('sale.order.line.group', 'Sale Group'),
61 'order_line_ids': fields.many2many('sale.order.line',
62 'sale_lines_wizard_order_line_rel',
63 'wizard_id', 'line_id',
64 'Sale Order Lines'),
65 }
66
67 def validate(self, cr, uid, ids, context=None):
68 order_obj = self.pool["sale.order"]
69 line_obj = self.pool["sale.order.line"]
70 order_id = context.get("active_id")
71 order = order_obj.browse(cr, uid, order_id, context)
72 for wizard in self.browse(cr, uid, ids):
73 so_lines = []
74 for line in wizard.order_line_ids:
75 new_line_id = line_obj.copy(cr, uid, line.id,
76 {"order_id": order_id}, context)
77 # NOTE, use web_context_tunnel module if you need to override
78 on_change_vals = line_obj.product_id_change(cr, uid, [],
79 order.pricelist_id.id, line.product_id.id,
80 line.product_uom_qty, line.product_id.uom_id.id,
81 line.product_uos_qty, line.product_uos, line.name,
82 order.partner_id.id, context.get('lang'), True,
83 order.date_order, False,
84 order.fiscal_position and order.fiscal_position.id,
85 False, context)
86
87 vals = {}
88 vals.update(on_change_vals['value'])
89 vals['tax_id'] = [(6, 0, on_change_vals['value']['tax_id'])]
90 vals['group_id'] = wizard.group_id and wizard.group_id.id
91 so_lines.append((1, new_line_id, vals))
92
93 order_obj.write(cr, uid, [order_id], {'order_line': so_lines},
94 context)
95
96 return {'type': 'ir.actions.act_window_close'}
097
=== added file 'sale_import_lines/sale_view.xml'
--- sale_import_lines/sale_view.xml 1970-01-01 00:00:00 +0000
+++ sale_import_lines/sale_view.xml 2014-01-10 17:37:52 +0000
@@ -0,0 +1,47 @@
1<openerp>
2 <data>
3
4 <record id="view_sale_order_import_form" model="ir.ui.view">
5 <field name="name">view_sale_order_import_form</field>
6 <field name="model">sale.order</field>
7 <field name="type">form</field>
8 <field name="inherit_id" ref="sale.view_order_form"/>
9 <field name="arch" type="xml">
10 <field name="order_line" position="before">
11 <button name="button_lines_wizard_edit" string="Import" type="object"/>
12 </field>
13 </field>
14 </record>
15
16 <record id="view_sale_import_lines_form" model="ir.ui.view">
17 <field name="name">view_sale_import_lines_form</field>
18 <field name="model">sale_import_lines.wizard</field>
19 <field name="type">form</field>
20 <field name="arch" type="xml">
21 <form string="Line Importer">
22 <group colspan="4" col="4">
23 <field name="order_line_ids" colspan="4"/>
24 <field name="group_id" colspan="2" context="{'analytic_account_id': context.get('analytic_account_id')}" domain="[('analytic_account_id', '=', context.get('analytic_account_id'))]"/>
25 </group>
26 <group>
27 <button special="cancel" string="Cancel" icon="gtk-cancel"/>
28 <button name="validate" string="Validate" type="object" icon="gtk-convert"/>
29 </group>
30 </form>
31 </field>
32 </record>
33
34 <record id="sales_import_sale_view_order_line_tree" model="ir.ui.view">
35 <field name="name">sales_import_sale_view_order_line_tree</field>
36 <field name="model">sale.order.line</field>
37 <field name="inherit_id" ref="sale.view_order_line_tree"/>
38 <field name="arch" type="xml">
39 <field name="product_id" position="after">
40 <field name="product_categ_id"/>
41 <field name="group_id"/>
42 </field>
43 </field>
44 </record>
45
46 </data>
47</openerp>

Subscribers

People subscribed via source and target branches