← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~akretion-team/sale-wkfl/7.0-add-sale_group into lp:sale-wkfl

 

Raphaël Valyi - http://www.akretion.com has proposed merging lp:~akretion-team/sale-wkfl/7.0-add-sale_group into lp:sale-wkfl.

Requested reviews:
  Sale Core Editors (sale-core-editors)

For more details, see:
https://code.launchpad.net/~akretion-team/sale-wkfl/7.0-add-sale_group/+merge/201017

Adds the very simple sale_group module that adds a group_id on sale.order.line
groups belong to an account.analytic.account and hence to a project.

This module could have been added to sale_report project instead, but in fact, I will next push another module (sale_import_lines) that depends on this one and that makes much more sense in this project, so it's better not mixing project dependencies.
-- 
https://code.launchpad.net/~akretion-team/sale-wkfl/7.0-add-sale_group/+merge/201017
Your team Sale Core Editors is requested to review the proposed merge of lp:~akretion-team/sale-wkfl/7.0-add-sale_group into lp:sale-wkfl.
=== added directory 'sale_group'
=== added file 'sale_group/__init__.py'
--- sale_group/__init__.py	1970-01-01 00:00:00 +0000
+++ sale_group/__init__.py	2014-01-09 14:45:56 +0000
@@ -0,0 +1,1 @@
+import sale

=== added file 'sale_group/__openerp__.py'
--- sale_group/__openerp__.py	1970-01-01 00:00:00 +0000
+++ sale_group/__openerp__.py	2014-01-09 14:45:56 +0000
@@ -0,0 +1,17 @@
+{
+    "name": "Sale Order Line Group",
+    "version": "1.0",
+    "author": "Akretion",
+    "website": "http://www.openerp.com";,
+    "category": "",
+    "depends": ["sale"],
+    "description": "Simple module allowing you to order your sale order lines with groups that belngs to the order analytic account, that is that indirectly belongs to sale order project.",
+    "init_xml": [],
+    "demo_xml": [],
+    "test": [],
+    "update_xml": ["sale_view.xml",],
+    'images': [],
+    'installable': True,
+    'active': False,
+    'certificate': None,
+}

=== added directory 'sale_group/i18n'
=== added file 'sale_group/i18n/pt_BR.po'
--- sale_group/i18n/pt_BR.po	1970-01-01 00:00:00 +0000
+++ sale_group/i18n/pt_BR.po	2014-01-09 14:45:56 +0000
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* sale_group
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-06-10 18:21+0000\n"
+"PO-Revision-Date: 2013-06-10 18:21+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: sale_group
+#: field:sale.order.line.group,project_id:0
+msgid "Project name"
+msgstr "Nome do Projeto"
+
+#. module: sale_group
+#: field:sale.order.line.group,name:0
+msgid "Group Name"
+msgstr "Nome du Grupo"
+
+#. module: sale_group
+#: model:ir.model,name:sale_group.model_sale_order_line_group
+msgid "sale.order.line.group"
+msgstr "sale.order.line.group"
+
+#. module: sale_group
+#: field:sale.order.line,group_id:0
+msgid "Group"
+msgstr "Grupo"
+
+#. module: sale_group
+#: model:ir.model,name:sale_group.model_sale_order_line
+msgid "Sales Order Line"
+msgstr "Linha de Pedido de Vendas"
+

=== added file 'sale_group/sale.py'
--- sale_group/sale.py	1970-01-01 00:00:00 +0000
+++ sale_group/sale.py	2014-01-09 14:45:56 +0000
@@ -0,0 +1,46 @@
+# -*- encoding: utf-8 -*-
+###############################################################################
+#                                                                             #
+# Copyright (C) 2013  Raphaël Valyi - Akretion                                #
+#                                                                             #
+#This program is free software: you can redistribute it and/or modify         #
+#it under the terms of the GNU Affero General Public License as published by  #
+#the Free Software Foundation, either version 3 of the License, or            #
+#(at your option) any later version.                                          #
+#                                                                             #
+#This program is distributed in the hope that it will be useful,              #
+#but WITHOUT ANY WARRANTY; without even the implied warranty of               #
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
+#GNU Affero General Public License for more details.                          #
+#                                                                             #
+#You should have received a copy of the GNU Affero General Public License     #
+#along with this program.  If not, see <http://www.gnu.org/licenses/>.        #
+###############################################################################
+
+
+from osv import orm, fields
+
+class sale_order_line(orm.Model):
+    _inherit = "sale.order.line"
+
+    _columns = {
+        'group_id': fields.many2one('sale.order.line.group', 'Group'),
+    }
+
+    _order = 'sequence, group_id, id'
+
+
+class sale_order_line_group(orm.Model):
+    _name = "sale.order.line.group"
+
+    _columns = {
+        'name': fields.char("Group Name", size=64, required=True),
+        'analytic_account_id': fields.many2one('account.analytic.account',
+                                               'Analytic Account',
+                                               required=True),
+    }
+
+    _defaults = {
+        'analytic_account_id': lambda self, cr, uid,
+                               c: c.get('analytic_account_id')
+    }

=== added file 'sale_group/sale_view.xml'
--- sale_group/sale_view.xml	1970-01-01 00:00:00 +0000
+++ sale_group/sale_view.xml	2014-01-09 14:45:56 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<openerp>
+    <data>
+        <record model="ir.ui.view" id="view_sale_order_line_form">
+            <field name="name">sale.order.line.form</field>
+            <field name="model">sale.order</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="sale.view_order_form"/>
+            <field name="arch" type="xml">
+              <xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="before">
+                <field name="group_id" context="{'analytic_account_id': parent.project_id}" domain="[('analytic_account_id', '=', parent.project_id)]" groups="sale.group_analytic_accounting"/>
+              </xpath>
+
+              <xpath expr="//field[@name='order_line']/form/label[@for='name']" position="before">
+                <group>
+                  <group>
+                    <field name="group_id" context="{'analytic_account_id': parent.project_id}" domain="[('analytic_account_id', '=', parent.project_id)]" groups="sale.group_analytic_accounting"/>
+                  </group>
+                </group>
+              </xpath>
+            </field>
+        </record>
+    </data>
+</openerp>


Follow ups