← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3

 

pso (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #438717 Error in account_anglo_saxon when using foreign currency
  https://bugs.launchpad.net/bugs/438717
  #539539 product - VAT definition - multicompany
  https://bugs.launchpad.net/bugs/539539
  #589256 Wrong tax calculation in point of sale (POS)
  https://bugs.launchpad.net/bugs/589256
  #617974 trunk - hr payment - rounding issue payment slip
  https://bugs.launchpad.net/bugs/617974
  #646350 [trunk] sale analysis - wrong average price
  https://bugs.launchpad.net/bugs/646350
  #663585 [6.0rc1] suggested improvements to PO and SO form view
  https://bugs.launchpad.net/bugs/663585
  #663967 [RC1] SO -History - can delete related invoice
  https://bugs.launchpad.net/bugs/663967
  #666592 save and close crash adding product in point of sale
  https://bugs.launchpad.net/bugs/666592
  #669360 hr_timeeshet_sheet : installation fails on 1st (and probably last) date of the month.
  https://bugs.launchpad.net/bugs/669360
  #669533 [hr_timesheet] Employee timesheet reports confuse employee id and user id
  https://bugs.launchpad.net/bugs/669533
  #672684 Manual Global Tax
  https://bugs.launchpad.net/bugs/672684
  #673835 Sales, Purchase and Invoice Analysis Problem
  https://bugs.launchpad.net/bugs/673835
  #689924 [sale_margin] purchase price is wrong
  https://bugs.launchpad.net/bugs/689924
  #691810 Cannot cancel invoice BUG
  https://bugs.launchpad.net/bugs/691810
  #692456 Sale Order Reference not unique
  https://bugs.launchpad.net/bugs/692456
  #692735 [6.0] sales - canceled SO should not be black (normal)
  https://bugs.launchpad.net/bugs/692735
  #692964 in hr_recruitment, add a column "Subject" in applicants list view
  https://bugs.launchpad.net/bugs/692964
  #692976 expenses list shouldn't be editable
  https://bugs.launchpad.net/bugs/692976
  #693788 payroll compute sheet error
  https://bugs.launchpad.net/bugs/693788
  #694107 Point of Sale Journals credits customer debtor account instead of product's income accounts (v6rc1)
  https://bugs.launchpad.net/bugs/694107

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44786

Hello,

I have added new module "product_multi_company".
This module defines several prices for product, one for each company.

Thanks,
pso.


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44786
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account/report/account_general_ledger.py'
--- account/report/account_general_ledger.py	2010-12-27 11:31:05 +0000
+++ account/report/account_general_ledger.py	2010-12-28 12:22:56 +0000
@@ -179,14 +179,20 @@
         if res_lines and self.init_balance:
             #FIXME: replace the label of lname with a string translatable
             sql = """
-                SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
+                SELECT 0 AS lid, '' AS ldate, '' AS lcode, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
                 '' AS move_name, '' AS mmove_id, '' AS period_code,
+                sum(case when a.currency_id is not null then
+                         l.amount_currency
+                        else
+                         0.0
+                        end) as amount_currency,
                 '' AS currency_code,
                 NULL AS currency_id,
                 '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,
                 '' AS partner_name
                 FROM account_move_line l
                 LEFT JOIN account_move m on (l.move_id=m.id)
+                LEFT JOIN account_account a ON (l.account_id=a.id)
                 LEFT JOIN res_currency c on (l.currency_id=c.id)
                 LEFT JOIN res_partner p on (l.partner_id=p.id)
                 LEFT JOIN account_invoice i on (m.id =i.move_id)
@@ -209,6 +215,8 @@
                     l['amount_currency'] = abs(l['amount_currency']) * -1
             if l['amount_currency'] != None:
                 self.tot_currency = self.tot_currency + l['amount_currency']
+            self.cr.execute("select distinct currency_id from account_invoice")
+            l['cur_id']=self.cr.fetchall()
         return res
 
     def _sum_debit_account(self, account):

=== modified file 'account/report/account_general_ledger.rml'
--- account/report/account_general_ledger.rml	2010-12-27 11:31:05 +0000
+++ account/report/account_general_ledger.rml	2010-12-28 12:22:56 +0000
@@ -518,7 +518,7 @@
               <para style="terp_default_Right_8">[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
             </td>
             <td>
-              <para style="terp_default_Right_8"><font>[[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]</font></para>
+              <para style="terp_default_Right_8"><font>[[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[  line['currency_code'] or '']]</font></para>
             </td>
           </tr>
         </blockTable>

=== modified file 'account/report/account_general_ledger_landscape.rml'
--- account/report/account_general_ledger_landscape.rml	2010-12-27 11:31:05 +0000
+++ account/report/account_general_ledger_landscape.rml	2010-12-28 12:22:56 +0000
@@ -508,7 +508,7 @@
             <para style="terp_default_Bold_8_Right">[[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
           </td>
           <td>
-            <para style="terp_default_Bold_8_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]]</para>
+            <para style="terp_default_Bold_8_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]]</para>
           </td>
         </tr>
       </blockTable>
@@ -550,7 +550,7 @@
               <para style="terp_default_Right_7">[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
             </td>
             <td>
-              <para style="terp_default_Right_7">[[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]</para>
+              <para style="terp_default_Right_7"><font>[[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[  line['currency_code'] or '']]</font></para>
             </td>
           </tr>
         </blockTable>

=== modified file 'account/report/account_partner_ledger.py'
--- account/report/account_partner_ledger.py	2010-12-27 11:31:05 +0000
+++ account/report/account_partner_ledger.py	2010-12-28 12:22:56 +0000
@@ -47,6 +47,7 @@
             'get_fiscalyear': self._get_fiscalyear,
             'get_journal': self._get_journal,
             'get_partners':self._get_partners,
+            'sum_currency_amount_account': self._sum_currency_amount_account,
             'get_intial_balance':self._get_intial_balance,
             'display_initial_balance':self._display_initial_balance,
             'display_currency':self._display_currency,
@@ -125,6 +126,10 @@
             return new
         else:
             return self.comma_me(new)
+        
+    def _get_currency(self):
+        self.cr.execute("select distinct currency_id from account_invoice")
+        return self.cr.fetchall() 
 
     def lines(self, partner):
         move_state = ['draft','posted']
@@ -137,7 +142,9 @@
         else:
             RECONCILE_TAG = "AND l.reconcile_id IS NULL"
         self.cr.execute(
-            "SELECT l.id, l.date, j.code, acc.code as a_code, acc.name as a_name, l.ref, m.name as move_name, l.name, l.debit, l.credit, l.amount_currency,l.currency_id, c.symbol AS currency_code " \
+            "SELECT l.id, l.date, j.code, acc.code as a_code, acc.name as a_name, l.ref, m.name as move_name, l.name, l.debit, l.credit," \
+            "sum(case when acc.currency_id is not null then l.amount_currency else 0.0 end) as amount_currency," \
+            "l.currency_id, c.symbol AS currency_code " \
             "FROM account_move_line l " \
             "LEFT JOIN account_journal j " \
                 "ON (l.journal_id = j.id) " \
@@ -149,7 +156,7 @@
                 "AND l.account_id IN %s AND " + self.query +" " \
                 "AND m.state IN %s " \
                 " " + RECONCILE_TAG + " "\
-                "ORDER BY l.date",
+                "GROUP BY l.id, l.date, j.code, acc.code, acc.name, l.ref, m.name, l.name, l.debit, l.credit, l.currency_id, c.symbol ORDER BY l.date",
                 (partner.id, tuple(self.account_ids), tuple(move_state)))
         res = self.cr.dictfetchall()
         sum = 0.0

=== modified file 'account/report/account_partner_ledger.rml'
--- account/report/account_partner_ledger.rml	2010-11-24 11:34:26 +0000
+++ account/report/account_partner_ledger.rml	2010-12-28 12:22:56 +0000
@@ -586,9 +586,7 @@
             <para style="terp_default_Bold_9_Right">[[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]]</para>
           </td>
           <td>
-            <para style="terp_default_Bold_9_Right">
-              <font color="white"> </font>
-            </para>
+            <para style="terp_default_Bold_9_Right">[[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]</para>
           </td>
         </tr>
       </blockTable>
@@ -609,9 +607,7 @@
               <para style="terp_default_Right_9">[[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]]</para>
             </td>
             <td>
-              <para style="terp_default_Right_9">
-                <font color="white"> </font>
-              </para>
+              <para style="terp_default_Right_9">[[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]</para>
             </td>
           </tr>
         </blockTable>
@@ -646,7 +642,7 @@
             </td>
             <td>
               <para style="terp_default_Right_8">
-                <font face="Helvetica" size="8.0">[[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]]</font>
+                <font face="Helvetica" size="8.0">[[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[  line['currency_code'] or '']] </font>
               </para>
             </td>
           </tr>

=== modified file 'account/report/account_partner_ledger_other.rml'
--- account/report/account_partner_ledger_other.rml	2010-12-27 11:31:05 +0000
+++ account/report/account_partner_ledger_other.rml	2010-12-28 12:22:56 +0000
@@ -593,9 +593,7 @@
             <para style="terp_default_Bold_9_Right">[[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]]</para>
           </td>
           <td>
-            <para style="terp_default_Bold_9_Right">
-              <font color="white"> </font>
-            </para>
+            <para style="terp_default_Bold_9_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]]</para>
           </td>
         </tr>
       </blockTable>

=== added directory 'product_multi_company'
=== added file 'product_multi_company/__init__.py'
--- product_multi_company/__init__.py	1970-01-01 00:00:00 +0000
+++ product_multi_company/__init__.py	2010-12-28 12:22:56 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.     
+#
+##############################################################################
+
+import product_multi_company
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== added file 'product_multi_company/__openerp__.py'
--- product_multi_company/__openerp__.py	1970-01-01 00:00:00 +0000
+++ product_multi_company/__openerp__.py	2010-12-28 12:22:56 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.     
+#
+##############################################################################
+
+{
+    "name" : "Product multi company ",
+    "version" : "1.1",
+    "author" : "OpenERP SA",
+    "category" : "Generic Modules/Inventory Control",
+    "depends" : [ "product"],
+    "init_xml" : [],
+    "demo_xml" : [],
+    "description": """
+        This module defines several prices, one for each company.
+    """,
+    'update_xml': [],
+    'test':[],
+    'installable': True,
+    'active': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== added directory 'product_multi_company/i18n'
=== added file 'product_multi_company/i18n/en_US.po'
--- product_multi_company/i18n/en_US.po	1970-01-01 00:00:00 +0000
+++ product_multi_company/i18n/en_US.po	2010-12-28 12:22:56 +0000
@@ -0,0 +1,32 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* product_multi_company
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.0-rc1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2010-12-28 12:10:13+0000\n"
+"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company
+#: model:ir.model,name:product_multi_company.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_multi_company
+#: constraint:product.template:0
+msgid "Error: The default UOM and the purchase UOM must be in the same category."
+msgstr ""
+
+#. module: product_multi_company
+#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo
+msgid "pricelist.partnerinfo"
+msgstr ""
+

=== added file 'product_multi_company/i18n/fr.po'
--- product_multi_company/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ product_multi_company/i18n/fr.po	2010-12-28 12:22:56 +0000
@@ -0,0 +1,32 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* product_multi_company
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.0-rc1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2010-12-28 12:10:13+0000\n"
+"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company
+#: model:ir.model,name:product_multi_company.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_multi_company
+#: constraint:product.template:0
+msgid "Error: The default UOM and the purchase UOM must be in the same category."
+msgstr ""
+
+#. module: product_multi_company
+#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo
+msgid "pricelist.partnerinfo"
+msgstr ""
+

=== added file 'product_multi_company/i18n/product_multi_company.pot'
--- product_multi_company/i18n/product_multi_company.pot	1970-01-01 00:00:00 +0000
+++ product_multi_company/i18n/product_multi_company.pot	2010-12-28 12:22:56 +0000
@@ -0,0 +1,32 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* product_multi_company
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.0-rc1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2010-12-28 12:10:13+0000\n"
+"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company
+#: model:ir.model,name:product_multi_company.model_product_template
+msgid "Product Template"
+msgstr ""
+
+#. module: product_multi_company
+#: constraint:product.template:0
+msgid "Error: The default UOM and the purchase UOM must be in the same category."
+msgstr ""
+
+#. module: product_multi_company
+#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo
+msgid "pricelist.partnerinfo"
+msgstr ""
+

=== added file 'product_multi_company/product_multi_company.py'
--- product_multi_company/product_multi_company.py	1970-01-01 00:00:00 +0000
+++ product_multi_company/product_multi_company.py	2010-12-28 12:22:56 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 osv, fields
+
+class product_template(osv.osv):
+    _inherit = "product.template"
+    _columns={
+        'list_price': fields.property('product.template',
+            type='float',
+            string='Public Price',
+            method=True,
+            view_load=True,
+            required=True, size=64),
+        'standard_price': fields.property('product.template',
+            type='float',
+            string='Standard Price',
+            method=True,
+            view_load=True,
+            required=True, size=64,
+            help="Product's cost for accounting stock valuation. It is the base price for the supplier price."),
+        }
+product_template()
+
+class pricelist_partnerinfo(osv.osv):
+    _inherit = 'pricelist.partnerinfo' 
+    _columns = {
+        'price': fields.property('pricelist.partnerinfo',
+            type='float',
+            string='Seller Price',
+            method=True,
+            view_load=True,
+            required=True, size=64,
+            help="This price will be considered as a price for the supplier UoM if any or the default Unit of Measure of the product otherwise"),
+    }
+pricelist_partnerinfo()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file


Follow ups