[Add] purchase_tender: add the company_id in purchase tender
bzr revid: sbh@tinyerp.com-20100412051529-gh0x1l3kx2a69zq6
This commit is contained in:
@@ -37,12 +37,14 @@ class purchase_tender(osv.osv):
|
||||
'description': fields.text('Description'),
|
||||
'purchase_ids' : fields.one2many('purchase.order','tender_id','Purchase Orders'),
|
||||
'line_ids' : fields.one2many('purchase.tender.line','tender_id','Products to Purchase'),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'state': fields.selection([('draft','Draft'),('open','Open'),('cancel','Cancel'),('close','Close'),('in_progress','In progress'),('done','Done')], 'State', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'date_start': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'state': lambda *args: 'open',
|
||||
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.tender'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
}
|
||||
def tender_close(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_end': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
@@ -73,7 +75,8 @@ class purchase_tender_line(osv.osv):
|
||||
'product_id': fields.many2one('product.product', 'Product'),
|
||||
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
|
||||
'product_qty': fields.float('Date End', digits=(16,2)),
|
||||
'tender_id' : fields.many2one('purchase.tender','Purchase Tender', ondelete='cascade')
|
||||
'tender_id' : fields.many2one('purchase.tender','Purchase Tender', ondelete='cascade'),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
}
|
||||
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
|
||||
|
||||
@@ -90,7 +93,9 @@ class purchase_tender_line(osv.osv):
|
||||
value = {'product_uom_id': prod.uom_id.id}
|
||||
|
||||
return {'value': value}
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
}
|
||||
purchase_tender_line()
|
||||
|
||||
class purchase_order(osv.osv):
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Products">
|
||||
<field name="line_ids" colspan="4" nolabel="1">
|
||||
@@ -48,7 +49,9 @@
|
||||
<field name="product_id"/>
|
||||
<field name="product_uom_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</form>
|
||||
|
||||
</field>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
@@ -104,11 +107,12 @@
|
||||
<field name="user_id" select="1" widget="selection">
|
||||
<filter icon="terp-partner" domain="[('create_uid','=',uid)]" help="My Tender "/>
|
||||
</field>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="10">
|
||||
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Date " icon="terp-purchase" domain="[]" context="{'group_by':'date_start'}"/>
|
||||
<filter string="Date Start" icon="terp-purchase" domain="[]" context="{'group_by':'date_start'}"/>
|
||||
<filter string="Date End" icon="terp-purchase" domain="[]" context="{'group_by':'date_end'}"/>
|
||||
</group>
|
||||
</search>
|
||||
|
||||
Reference in New Issue
Block a user