bugfix_procurement_view
authorFabien Pinckaers <fp@tinyerp.com>
Sun, 15 Mar 2009 16:29:55 +0000 (17:29 +0100)
committerFabien Pinckaers <fp@tinyerp.com>
Sun, 15 Mar 2009 16:29:55 +0000 (17:29 +0100)
bzr revid: fp@tinyerp.com-20090315162955-lsx719z93ychmjv2

addons/account/account.py
addons/account/account_invoice_view.xml
addons/account/account_invoice_workflow.xml
addons/account/invoice.py
addons/crm/wizard/crm_wizard.py
addons/mrp/mrp.py
addons/mrp/mrp_view.xml

index 449a58f..69b46c6 100644 (file)
@@ -330,6 +330,9 @@ class account_account(osv.osv):
     _constraints = [
         (_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id'])
     ]
+    _sql_constraints = [
+        ('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
+    ]
     def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
         if not args:
             args = []
index cd383da..1410c9b 100644 (file)
                             <field name="company_id"/>
                             <field name="fiscal_position" groups="base.group_extended"/>
                             <newline/>
-                            <field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
+                            <field name="payment_term"/>
                             <field name="name" select="2"/>
                             <newline/>
                             <field name="number" select="2"/>
                             <field name="origin" select="2"/>
                             <field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id"/>
                             <field name="move_id"/>
-                            <field name="date_invoice" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)" select="1"/>
+                            <field name="date_invoice"/>
                             <field name="period_id"/>
                             <label align="0.0" colspan="2" string="(keep empty to use the current period)"/>
                             <separator colspan="4" string="Additionnal Information"/>
                         <field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term)" select="1"/>
                         <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
                         <field name="currency_id" on_change="onchange_currency_id(currency_id)" select="2"/>
-                        <field name="date_invoice" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)" select="1"/>
+                        <field name="date_invoice" select="1"/>
                         <field name="period_id"/>
                         <label align="0.0" colspan="2" string="(keep empty to use the current period)"/>
                     </group>
                         <page string="Invoice">
                             <field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
                             <field name="name" select="2"/>
-                            <field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
+                            <field name="payment_term"/>
                             <field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list"/>
                             <group col="1" colspan="2">
                                 <field name="tax_line" nolabel="1">
index d026408..1f41b9f 100644 (file)
@@ -34,7 +34,8 @@ write({'state':'proforma'})</field>
         <record id="act_open" model="workflow.activity">
             <field name="wkf_id" ref="wkf"/>
             <field name="name">open</field>
-            <field name="action">action_move_create()
+            <field name="action">action_date_assign()
+action_move_create()
 action_number()
 write({'state':'open'})</field>
             <field name="kind">function</field>
index d64ba93..5c977ed 100644 (file)
@@ -357,14 +357,6 @@ class account_invoice(osv.osv):
         if type in ('in_invoice', 'in_refund'):
             result['value']['partner_bank'] = bank_id
 
-        if payment_term != partner_payment_term:
-            if partner_payment_term:
-                to_update = self.onchange_payment_term_date_invoice(
-                    cr,uid,ids,partner_payment_term,date_invoice)
-                result['value'].update(to_update['value'])
-            else:
-                result['value']['date_due'] = False
-
         if partner_bank_id != bank_id:
             to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
             result['value'].update(to_update['value'])
@@ -378,17 +370,13 @@ class account_invoice(osv.osv):
             return {}
         res={}
         pt_obj= self.pool.get('account.payment.term')
-
         if not date_invoice :
             date_invoice = time.strftime('%Y-%m-%d')
-
         pterm_list= pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
-
         if pterm_list:
             pterm_list = [line[0] for line in pterm_list]
             pterm_list.sort()
             res= {'value':{'date_due': pterm_list[-1]}}
-
         return res
 
     def onchange_invoice_line(self, cr, uid, ids, lines):
@@ -498,6 +486,13 @@ class account_invoice(osv.osv):
                 })]
         return iml
 
+    def action_date_assign(self, cr, uid, ids, *args):
+        for inv in self.browse(cr, uid, ids):
+            res = self.onchange_payment_term_date_invoice(cr, uid, inv.id, inv.payment_term.id, inv.date_invoice)
+            if res and res['value']:
+                self.write(cr, uid, [inv.id], res['value'])
+        return True
+
     def action_move_create(self, cr, uid, ids, *args):
         ait_obj = self.pool.get('account.invoice.tax')
         cur_obj = self.pool.get('res.currency')
index 2f9d9dd..b0ae66e 100644 (file)
@@ -32,6 +32,8 @@ section_form = '''<?xml version="1.0"?>
     <field name="menu_name"/>
     <field name="menu_parent_id"/>
     <field name="section_id"/>
+    <label string="this wizard will create all sub-menus, within the selected menu." align="0.0" colspan="4"/>
+    <label string="You may want to create a new parent menu to put all the created menus in." align="0.0" colspan="4"/>
     <separator string="Select Views (empty for default)" colspan="4"/>
     <field name="view_form"/>
     <field name="view_tree"/>
index f6d4a68..f368eb1 100644 (file)
@@ -769,10 +769,10 @@ class mrp_procurement(osv.osv):
         'date_planned': fields.datetime('Scheduled date', required=True),
         'date_close': fields.datetime('Date Closed'),
         'product_id': fields.many2one('product.product', 'Product', required=True),
-        'product_qty': fields.float('Quantity', required=True),
-        'product_uom': fields.many2one('product.uom', 'Product UoM', required=True),
-        'product_uos_qty': fields.float('UoS Quantity'),
-        'product_uos': fields.many2one('product.uom', 'Product UoS'),
+        'product_qty': fields.float('Quantity', required=True, states={'draft':[('readonly',False)]}, readonly=True),
+        'product_uom': fields.many2one('product.uom', 'Product UoM', required=True, states={'draft':[('readonly',False)]}, readonly=True),
+        'product_uos_qty': fields.float('UoS Quantity', states={'draft':[('readonly',False)]}, readonly=True),
+        'product_uos': fields.many2one('product.uom', 'Product UoS', states={'draft':[('readonly',False)]}, readonly=True),
         'move_id': fields.many2one('stock.move', 'Reservation', ondelete='set null'),
 
         'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
index 2093c51..5f7f02f 100644 (file)
                     </page>
                     <page string="Note">
                         <separator colspan="4" string="Note" />
-                        <field name="name" colspan="4" />
+                        <field name="note" colspan="4" nolabel="1"/>
                     </page>
                     </notebook>
                 </form>