← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-724059-rha into lp:openobject-addons

 

Rifakat Haradwala (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-724059-rha into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  #724059 missing company information in payment.order and payment.line
  https://bugs.launchpad.net/bugs/724059

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-724059-rha/+merge/51109

Bug #724059 : missing company information in payment.order and payment.line
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-724059-rha/+merge/51109
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-724059-rha.
=== modified file 'account_payment/account_payment.py'
--- account_payment/account_payment.py	2011-02-01 11:04:30 +0000
+++ account_payment/account_payment.py	2011-02-24 11:56:50 +0000
@@ -94,6 +94,7 @@
             ], "Preferred date", change_default=True, required=True, states={'done': [('readonly', True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
         'date_created': fields.date('Creation date', readonly=True),
         'date_done': fields.date('Execution date', readonly=True),
+        'company_id': fields.many2one('res.company', 'Company', required=True),
     }
 
     _defaults = {
@@ -102,6 +103,7 @@
         'date_prefered': 'due',
         'date_created': lambda *a: time.strftime('%Y-%m-%d'),
         'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'),
+        'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
     }
 
     def set_to_draft(self, cr, uid, ids, *args):
@@ -343,7 +345,8 @@
         'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"),
         'create_date': fields.datetime('Created', readonly=True),
         'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True),
-        'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line')
+        'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line'),
+        'company_id': fields.many2one('res.company', 'Company', required=True),
     }
     _defaults = {
         'name': lambda obj, cursor, user, context: obj.pool.get('ir.sequence'
@@ -352,6 +355,7 @@
         'currency': _get_currency,
         'company_currency': _get_currency,
         'date': _get_date,
+        'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
     }
     _sql_constraints = [
         ('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'),

=== modified file 'account_payment/account_payment_view.xml'
--- account_payment/account_payment_view.xml	2011-02-01 15:50:23 +0000
+++ account_payment/account_payment_view.xml	2011-02-24 11:56:50 +0000
@@ -107,6 +107,7 @@
                       <field name="date_prefered"/>
                       <field name="date_scheduled" select="1" attrs="{'readonly':[('date_prefered','!=','fixed')]}" />
                       <button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
+                      <field name="company_id" widget='selection' groups="base.group_multi_company"/>
                     </group>
                     <field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id or False}" >
                         <form string="Payment Line">
@@ -128,7 +129,8 @@
                                     <field colspan="4" name="communication"/>
                                     <field colspan="4" name="communication2"/>
                                     <field name="name"/>
-                                     <field name="state"/>
+                                    <field name="state"/>
+                                    <field name="company_id" widget='selection' groups="base.group_multi_company"/>
                                 </page>
                                 <page string="Information">
 
@@ -179,6 +181,7 @@
                     <field name="reference"/>
                     <field name="mode"/>
                     <field name="user_id"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
                     <field name="date_created"/>
                     <field name="date_done"/>
                     <field name="total"/>

=== modified file 'account_payment/security/account_payment_security.xml'
--- account_payment/security/account_payment_security.xml	2011-01-14 00:11:01 +0000
+++ account_payment/security/account_payment_security.xml	2011-02-24 11:56:50 +0000
@@ -13,5 +13,19 @@
         <field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
     </record>
 
+    <record id="payment_order_comp_rule" model="ir.rule">
+        <field name="name">Payment order multi company rule</field>
+        <field model="ir.model" name="model_id" ref="model_payment_order"/>
+        <field eval="True" name="global"/>
+        <field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
+    </record>
+
+    <record id="payment_line_comp_rule" model="ir.rule">
+        <field name="name">Payment line multi company rule</field>
+        <field model="ir.model" name="model_id" ref="model_payment_line"/>
+        <field eval="True" name="global"/>
+        <field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
+    </record>
+
 </data>
 </openerp>


Follow ups