← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~ruchir.shukla/margin-analysis/margin-analysis-migrate-V7 into lp:margin-analysis

 

Ruchir Shukla(BizzAppDev) has proposed merging lp:~ruchir.shukla/margin-analysis/margin-analysis-migrate-V7 into lp:margin-analysis.

Requested reviews:
  Margin Analysis Core Editors (margin-analysis-core-editors)

For more details, see:
https://code.launchpad.net/~ruchir.shukla/margin-analysis/margin-analysis-migrate-V7/+merge/196278

Support for V7 view make it working on V7
-- 
https://code.launchpad.net/~ruchir.shukla/margin-analysis/margin-analysis-migrate-V7/+merge/196278
Your team Margin Analysis Core Editors is requested to review the proposed merge of lp:~ruchir.shukla/margin-analysis/margin-analysis-migrate-V7 into lp:margin-analysis.
=== modified file 'product_cost_incl_bom/__openerp__.py'
--- product_cost_incl_bom/__openerp__.py	2013-09-11 08:08:22 +0000
+++ product_cost_incl_bom/__openerp__.py	2013-11-22 13:23:22 +0000
@@ -33,10 +33,10 @@
 """,
  'website': 'http://www.camptocamp.com/',
  'init_xml': [],
- 'update_xml': [],
+ 'update_xml': ["product_view.xml"],
  'demo_xml': [],
  'tests': [],
- 'installable': False,
+ 'installable': True,
  'auto_install': False,
  'license': 'AGPL-3',
  'application': False}

=== modified file 'product_cost_incl_bom/i18n/nl.po'
--- product_cost_incl_bom/i18n/nl.po	2012-12-23 13:22:43 +0000
+++ product_cost_incl_bom/i18n/nl.po	2013-11-22 13:23:22 +0000
@@ -1,10 +1,10 @@
-# Translation of OpenERP Server.
+# Translation of BAS-ERP Server.
 # This file contains the translation of the following modules:
 # 	* product_cost_incl_bom
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: OpenERP Server 6.1\n"
+"Project-Id-Version: BAS-ERP Server 6.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2012-12-23 10:17+0000\n"
 "PO-Revision-Date: 2012-12-23 14:20+0100\n"
@@ -34,3 +34,8 @@
 "of all standard price of its components. it take also care of the bom "
 "costing like cost per cylce."
 msgstr "Dit is de kostprijs inclusief eventuele kosten."
+
+#. module: product_cost_incl_bom
+#: field:product.product,fixed_cost_price:0
+msgid "Fixed Cost Price"
+msgstr "Vaste kosten"

=== modified file 'product_cost_incl_bom/product_cost_incl_bom.py'
--- product_cost_incl_bom/product_cost_incl_bom.py	2012-07-12 13:56:17 +0000
+++ product_cost_incl_bom/product_cost_incl_bom.py	2013-11-22 13:23:22 +0000
@@ -49,14 +49,14 @@
             #if not hasattr(pr, 'standard_price'): return False
             bom_id = bom_obj._bom_find(cursor, user, pr.id, product_uom=None, properties=bom_properties)
             if not bom_id: # no BoM: use standard_price
-                res[pr.id] = pr.standard_price
+                res[pr.id] = pr.standard_price + pr.fixed_cost_price
                 continue
             bom = bom_obj.browse(cursor, user, bom_id)
             sub_products, routes = bom_obj._bom_explode(cursor, user, bom,
                                                         factor=1,
                                                         properties=bom_properties,
                                                         addthis=True)
-            price = 0.
+            price = pr.fixed_cost_price
             for sub_product_dict in sub_products:
                 sub_product = self.browse(cursor, user, sub_product_dict['product_id'])
                 std_price = sub_product.standard_price
@@ -88,6 +88,8 @@
         return res
 
     _columns = {
+        'fixed_cost_price': fields.float(
+            'Fixed Cost Price', digits_compute = dp.get_precision('Sale Price')),
         'cost_price': fields.function(_cost_price,
                                       method=True,
                                       string='Cost Price (incl. BoM)',
@@ -96,3 +98,5 @@
                                       "the sum of all standard price of its components. it take also care of the "
                                       "bom costing like cost per cylce.")
         }
+        
+Product()

=== added file 'product_cost_incl_bom/product_view.xml'
--- product_cost_incl_bom/product_view.xml	1970-01-01 00:00:00 +0000
+++ product_cost_incl_bom/product_view.xml	2013-11-22 13:23:22 +0000
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <record model="ir.ui.view" id="product_cost_incl_costs_form">
+      <field name="name">product.product_cost_incl_costs.view.form</field>
+      <field name="type">form</field>
+      <field name="model">product.product</field>
+      <field name="priority" eval="800"/>
+      <field name="inherit_id" ref="product.product_normal_form_view" />
+      <field name="arch" type="xml">
+        <field name="cost_price" position="replace">
+        </field>
+        <field name="list_price" position="replace"/>
+        <label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user" position="replace"/>
+        <field name="standard_price"
+            attrs="{'readonly':[('cost_method','=','average')]}"
+            groups="base.group_extended"
+            position="replace"/>
+        <button name="%(stock.action_view_change_standard_price)d" string="- update"
+                            type="action" attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"
+                            class="oe_link" groups="product.group_costing_method"
+                    position="replace"/>
+        <field name="cost_method" position="replace"  version="7.0">
+            <field name="list_price"/>
+            <field name="cost_method" />
+            <label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user"/>
+            <div groups="base.group_user">
+                <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}" nolabel="1"/>
+                <button name="%(stock.action_view_change_standard_price)d" string="- update"
+                    type="action" attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"
+                    class="oe_link" groups="product.group_costing_method"/>
+            </div>
+                
+            <field name="fixed_cost_price" />
+            <newline/>
+            <field name="cost_price"/>
+            
+        </field>
+      </field>
+    </record>
+
+    <record model="ir.ui.view" id="product_cost_incl_costs_tree">
+      <field name="name">product.product_cost_incl_costs.view.tree</field>
+      <field name="type">tree</field>
+      <field name="model">product.product</field>
+      <field name="priority" eval="80"/>
+      <field name="inherit_id" ref="product.product_product_tree_view" />
+      <field name="arch" type="xml">
+        <field name="cost_price" position="before">
+          <field name="fixed_cost_price"/><!-- FIXME groups setting! -->
+        </field>
+      </field>
+    </record>
+  </data>
+</openerp>

=== modified file 'product_cost_incl_costs_without_bom/__init__.py'
--- product_cost_incl_costs_without_bom/__init__.py	2012-12-30 12:22:27 +0000
+++ product_cost_incl_costs_without_bom/__init__.py	2013-11-22 13:23:22 +0000
@@ -1,8 +1,7 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
-#    Copyright 2012 Camptocamp SA
-#    Copyright 2012 Endian Solutions BV
+#    Copyright 2013 BAS Solutions
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -15,9 +14,8 @@
 #    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/>.
-#
 ##############################################################################
+
 import product
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'product_cost_incl_costs_without_bom/__openerp__.py'
--- product_cost_incl_costs_without_bom/__openerp__.py	2013-09-11 08:08:22 +0000
+++ product_cost_incl_costs_without_bom/__openerp__.py	2013-11-22 13:23:22 +0000
@@ -1,8 +1,6 @@
-# -*- coding: utf-8 -*-
 ##############################################################################
 #
-#    Copyright 2012 Camptocamp SA
-#    Copyright 2012 Endian Solutions BV
+#    Copyright 2013 BAS Solutions
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -15,25 +13,26 @@
 #    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/>.
-#
 ##############################################################################
-{'name' : 'Product Cost field',
- 'version' : '0.1',
- 'author' : 'Grishma Shukla',
- 'maintainer': 'Endian Solutions',
- 'category': 'Products',
- 'complexity': "normal",  
- 'depends' : ['product_get_cost_field',
+
+{	
+		'name' : 'Product Cost field',
+	 	'version' : '0.1',
+    "author": "BAS Solutions",
+    "website": "http://www.bas-solutions.nl";,
+		'category': 'Products',
+ 		'complexity': "normal",  
+		'depends' : [
+              'product_get_cost_field',
+              'stock',
               ],
- 'description': """
- This module adds an Fixed cost field to the product form. So you can calculate a costprice with added costs, without the use of a BoM.
- """,
- 'website': 'www.endiansolutions.nl',
- 'init_xml': [],
- 'update_xml': ['product_view.xml'],
- 'demo_xml': [],
- 'tests': [],
- 'installable': False,
- 'application': False
+		'description': """
+		Add costfields to product.
+		""",
+		'init_xml': [],
+		'update_xml': ['product_view.xml'],
+		'demo_xml': [],
+		'tests': [],
+		'installable': True,
+		'application': False
  }

=== modified file 'product_cost_incl_costs_without_bom/i18n/nl.po'
--- product_cost_incl_costs_without_bom/i18n/nl.po	2012-12-30 12:22:27 +0000
+++ product_cost_incl_costs_without_bom/i18n/nl.po	2013-11-22 13:23:22 +0000
@@ -1,10 +1,10 @@
-# Translation of OpenERP Server.
+# Translation of BAS-ERP Server.
 # This file contains the translation of the following modules:
-# 	* product_cost_incl_costs
+# 	* product_cost_incl_costs_without_bom
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: OpenERP Server 6.1\n"
+"Project-Id-Version: BAS-ERP Server 6.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2012-12-23 12:21+0000\n"
 "PO-Revision-Date: 2012-12-23 14:20+0100\n"
@@ -17,19 +17,19 @@
 "Plural-Forms: \n"
 "X-Generator: Poedit 1.5.4\n"
 
-#. module: product_cost_incl_costs
-#: model:ir.model,name:product_cost_incl_costs.model_product_product
+#. module: product_cost_incl_costs_without_bom
+#: model:ir.model,name:product_cost_incl_costs_without_bom.model_product_product
 msgid "Product"
 msgstr "Product"
 
-#. module: product_cost_incl_costs
+#. module: product_cost_incl_costs_without_bom
 #: constraint:product.product:0
 msgid "Error: Invalid ean code"
 msgstr "Fout: ongeldige ean code"
 
-#. module: product_cost_incl_costs
+#. module: product_cost_incl_costs_without_bom
 #: field:product.product,fix_cost_price:0
-msgid "Fix Cost Price"
+msgid "Fixed Cost Price"
 msgstr "Vaste kosten"
 
 #. module: product_get_cost_field

=== modified file 'product_cost_incl_costs_without_bom/product.py'
--- product_cost_incl_costs_without_bom/product.py	2013-02-04 08:39:12 +0000
+++ product_cost_incl_costs_without_bom/product.py	2013-11-22 13:23:22 +0000
@@ -1,7 +1,25 @@
 # -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright 2013 BAS Solutions
+#
+#    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
+##############################################################################
+
 from openerp.osv.orm import Model
 from openerp.osv import fields
 import decimal_precision as dp
+from openerp.tools.translate import _
 import logging
 
 class product_product(Model):
@@ -21,7 +39,7 @@
         'cost_price': fields.function(_cost_price,
                                       string='Cost Price',
                                       digits_compute=dp.get_precision('Sale Price'),
-                                      help="The cost price is the standard price unless you install the product_cost_incl_bom module.")
+                                      help=_("The cost price is the standard price unless you install the product_cost_incl_bom module."))
         }
-
+product_product()
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'product_cost_incl_costs_without_bom/product_view.xml'
--- product_cost_incl_costs_without_bom/product_view.xml	2013-02-02 15:43:02 +0000
+++ product_cost_incl_costs_without_bom/product_view.xml	2013-11-22 13:23:22 +0000
@@ -11,30 +11,31 @@
         <field name="cost_price" position="replace">
         </field>
         <field name="list_price" position="replace"/>
-        <label string="Cost Price :" align="1.0" position="replace"/>
+        <label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user" position="replace"/>
         <field name="standard_price"
             attrs="{'readonly':[('cost_method','=','average')]}"
             groups="base.group_extended"
             position="replace"/>
-        <button name="%(stock.action_view_change_standard_price)d" string="Update"
-                    type="action" icon="gtk-execute"
-                    attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"
+        <button name="%(stock.action_view_change_standard_price)d" string="- update"
+                            type="action" attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"
+                            class="oe_link" groups="product.group_costing_method"
                     position="replace"/>
-        <field name="cost_method" groups="base.group_extended" position="replace">
-            <group col="2" colspan="2">
+        <field name="cost_method" position="replace"  version="7.0">
             <field name="list_price"/>
-            <field name="cost_method" groups="base.group_extended" />
-            <label string="Cost Price :" align="1.0"/>
-            <group col="2" colspan="1">
+            <field name="cost_method" />
+            <label string="Cost Price" for="standard_price" align="1.0" groups="base.group_user"/>
+            <div groups="base.group_user">
                 <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}" nolabel="1"/>
-                <button name="%(stock.action_view_change_standard_price)d" string="Update"
-                    type="action" icon="gtk-execute" attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"/>
-            </group>
-          <field name="fixed_cost_price" />
-          <field name="cost_price"/>
-          </group>
+                <button name="%(stock.action_view_change_standard_price)d" string="- update"
+                    type="action" attrs="{'invisible':[('cost_method','&lt;&gt;','average')]}"
+                    class="oe_link" groups="product.group_costing_method"/>
+            </div>
+                
+            <field name="fixed_cost_price" />
+            <newline/>
+            <field name="cost_price"/>
+            
         </field>
-
       </field>
     </record>
 

=== modified file 'product_get_cost_field/__openerp__.py'
--- product_get_cost_field/__openerp__.py	2013-10-10 12:05:11 +0000
+++ product_get_cost_field/__openerp__.py	2013-11-22 13:23:22 +0000
@@ -30,10 +30,10 @@
  Provides an overridable method on product which compute the cost_price field of a product. 
  By default it just return the value of standard_price field, but using the product_cost_incl_bom
  module, it will return the costing from the bom.
-
+ 
  As it is a generic module, you can also setup your own way of computing the cost_price for your 
  product.
-
+ 
  All our modules to compute margin are based on it, so you'll ba able to use them in your own way.
  """,
  'website': 'http://www.camptocamp.com/',

=== modified file 'product_get_cost_field/i18n/nl.po'
--- product_get_cost_field/i18n/nl.po	2013-11-05 16:09:21 +0000
+++ product_get_cost_field/i18n/nl.po	2013-11-22 13:23:22 +0000
@@ -1,10 +1,10 @@
-# Translation of OpenERP Server.
+# Translation of BAS-ERP Server.
 # This file contains the translation of the following modules:
 # 	* product_get_cost_field
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: OpenERP Server 6.1\n"
+"Project-Id-Version: BAS-ERP Server 6.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2012-12-23 10:21+0000\n"
 "PO-Revision-Date: 2012-12-23 11:28+0100\n"
@@ -35,3 +35,7 @@
 msgid "Cost Price (incl. BoM)"
 msgstr "Kostprijs (incl. kosten)"
 
+#. module: product_get_cost_field
+#: constraint:product.product:0
+msgid "Error: Invalid ean code"
+msgstr "Fout: ongeldige ean code"

=== modified file 'product_get_cost_field/product_get_cost_field.py'
--- product_get_cost_field/product_get_cost_field.py	2013-10-10 12:05:11 +0000
+++ product_get_cost_field/product_get_cost_field.py	2013-11-22 13:23:22 +0000
@@ -28,23 +28,14 @@
 class Product(Model):
     _inherit = 'product.product'
 
-    def _compute_purchase_price(self, cr, uid, ids,
-                                context=None):
-        res = {}
-        products = self.browse(cr, uid, ids)
-        if isinstance(ids, (int, long)):
-            res = products.standard_price
-        elif isinstance(ids, list):
-            for product in self.browse(cr, uid, ids, context=context):
-                res[product.id] = product.standard_price
-        return res
-
     def _cost_price(self, cr, uid, ids, field_name, arg, context=None):
         if context is None:
             context = {}
         logger = logging.getLogger('product.get_cost_field')
         logger.debug("get cost field _cost_price %s, %s, %s", field_name, arg, context)
-        res = self._compute_purchase_price(cr, uid, ids, context=context)
+        res = {}
+        for product in self.browse(cr, uid, ids):
+            res[product.id] = product.standard_price
         return res
 
     def get_cost_field(self, cr, uid, ids, context=None):

=== modified file 'product_historical_margin/__openerp__.py'
--- product_historical_margin/__openerp__.py	2013-09-11 08:08:22 +0000
+++ product_historical_margin/__openerp__.py	2013-11-22 13:23:22 +0000
@@ -58,7 +58,7 @@
                 ],
  'demo_xml': [],
  'tests': [],
- 'installable': False,
+ 'installable': True,
  'auto_install': False,
  'license': 'AGPL-3',
  'application': False

=== modified file 'product_historical_margin/i18n/nl.po'
--- product_historical_margin/i18n/nl.po	2012-12-23 12:12:06 +0000
+++ product_historical_margin/i18n/nl.po	2013-11-22 13:23:22 +0000
@@ -40,7 +40,7 @@
 #. module: product_historical_margin
 #: field:historical.margin,from_date:0
 msgid "From"
-msgstr "Van"
+msgstr "T/m"
 
 #. module: product_historical_margin
 #: field:account.invoice.line,subtotal_cost_price:0

=== modified file 'product_historical_margin/invoice.py'
--- product_historical_margin/invoice.py	2012-11-14 15:53:00 +0000
+++ product_historical_margin/invoice.py	2013-11-22 13:23:22 +0000
@@ -26,10 +26,11 @@
 class account_invoice(Model):
     _inherit = 'account.invoice'
 
-    def _refund_cleanup_lines(self, cr, uid, lines):
+    def _refund_cleanup_lines(self, cr, uid, lines, context={}):
         for line in lines:
             del line['invoice_user_id']
-        return super(account_invoice, self)._refund_cleanup_lines(cr, uid, lines)
+        return super(account_invoice, self)._refund_cleanup_lines(
+            cr, uid, lines, context=context)
 
 
 class account_invoice_line(Model):

=== modified file 'product_historical_margin/wizard/historical_margin_view.xml'
--- product_historical_margin/wizard/historical_margin_view.xml	2012-07-12 13:56:17 +0000
+++ product_historical_margin/wizard/historical_margin_view.xml	2013-11-22 13:23:22 +0000
@@ -7,17 +7,17 @@
             <field name="model">historical.margin</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="Historical Margin Properties">
+                <form string="Historical Margin Properties" version="7.0">
                     <group colspan="4">
                         <field name="from_date" />
                         <field name="to_date"/>
                         <field name="product_ids" invisible="1"/>
                     </group>
                     <separator string="" colspan="4"/>
-                    <group colspan="4" col="6">
+                    <footer>
                         <button icon="gtk-cancel" special="cancel" string="Cancel"/>
                         <button icon="terp-gtk-go-back-rtl" string="Compute margins" name="action_open_window" type="object"/>
-                    </group>
+                    </footer>
                 </form>
             </field>
         </record>
@@ -30,13 +30,13 @@
             <field name="view_id" ref="view_historical_margin"/>
             <field name="target">new</field>
         </record>
-        
-        
+
+
         <menuitem icon="STOCK_INDENT" action="action_product_margin_view"
             id="menu_action_product_margin_tree"
-            parent="account.menu_finance_statistic_report_statement" />
-
-        
+            parent="account.menu_finance_reporting" />
+
+
         <!-- Remove it for right management <act_window name="Product Historical Margins"
                     res_model="historical.margin"
                     src_model="product.product"

=== modified file 'product_historical_margin_report/__openerp__.py'
--- product_historical_margin_report/__openerp__.py	2013-09-11 08:08:22 +0000
+++ product_historical_margin_report/__openerp__.py	2013-11-22 13:23:22 +0000
@@ -34,7 +34,7 @@
  'update_xml': ['product_historical_margin_report_view.xml'],
  'demo_xml': [],
  'tests': [],
- 'installable': False,
+ 'installable': True,
  'auto_install': False,
  'license': 'AGPL-3',
  'application': True}

=== modified file 'product_historical_margin_report/product_historical_margin_report.py'
--- product_historical_margin_report/product_historical_margin_report.py	2012-07-12 13:56:17 +0000
+++ product_historical_margin_report/product_historical_margin_report.py	2013-11-22 13:23:22 +0000
@@ -63,8 +63,6 @@
                     ai.state,
                     pt.categ_id,
                     ai.date_due as date_due,
-                    ai.address_contact_id as address_contact_id,
-                    ai.address_invoice_id as address_invoice_id,
                     ai.account_id as account_id,
                     ail.account_id as account_line_id,
                     ai.partner_bank_id as partner_bank_id,
@@ -152,8 +150,6 @@
                     ai.state,
                     pt.categ_id,
                     ai.date_due,
-                    ai.address_contact_id,
-                    ai.address_invoice_id,
                     ai.account_id,
                     ail.account_id,
                     ai.partner_bank_id,

=== modified file 'product_standard_margin/product_std_margin_view.xml'
--- product_standard_margin/product_std_margin_view.xml	2013-10-14 18:42:41 +0000
+++ product_standard_margin/product_std_margin_view.xml	2013-11-22 13:23:22 +0000
@@ -7,12 +7,13 @@
       <field name="model">product.product</field>
       <field name="inherit_id" ref="product.product_normal_form_view" />
       <field name="arch" type="xml">
-        <xpath expr="//field[@name='standard_price']/.." position="after">
-          <group name="Margin">
-            <field name="standard_margin" />
-            <field name="standard_margin_rate" />
-          </group>
-        </xpath>
+        <xpath expr="//group[@name='Weights']" position="after">
+              <group name="Margin">
+                  <separator string="Margin" colspan="2"/>
+                  <field name="standard_margin" />
+                  <field name="standard_margin_rate" />
+              </group>
+          </xpath>
       </field>
     </record>
 


Follow ups