[FIX] multi company_default
bzr revid: fp@tinyerp.com-20091223171639-hgvyetizdgyh0itv
This commit is contained in:
parent
cfa877a961
commit
cbd41d602b
|
@ -321,7 +321,7 @@ class account_account(osv.osv):
|
|||
'active': lambda *a: True,
|
||||
'check_history': lambda *a: True,
|
||||
'currency_mode': lambda *a: 'current',
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', c),
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
|
|
|
@ -424,7 +424,7 @@ class account_move_line(osv.osv):
|
|||
'currency_id': _get_currency,
|
||||
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
|
||||
'period_id': lambda self, cr, uid, c: c.get('period_id', False),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)
|
||||
}
|
||||
_order = "date desc,id desc"
|
||||
_sql_constraints = [
|
||||
|
|
|
@ -318,7 +318,7 @@ class account_invoice(osv.osv):
|
|||
'state': lambda *a: 'draft',
|
||||
'journal_id': _get_journal,
|
||||
'currency_id': _get_currency,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', c),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c),
|
||||
'reference_type': lambda *a: 'none',
|
||||
'check_total': lambda *a: 0.0,
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class account_budget_post(osv.osv):
|
|||
}
|
||||
_defaults = {
|
||||
'sequence': lambda *a: 1,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c)
|
||||
}
|
||||
_order = "sequence, name"
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class account_voucher(osv.osv):
|
|||
'type': _get_type,
|
||||
'reference_type': lambda *a: 'none',
|
||||
'journal_id':_get_journal,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher', c),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher', context=c),
|
||||
'currency_id': _get_currency,
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ class hr_timesheet_sheet(osv.osv):
|
|||
'date_current' : lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'date_to' : _default_date_to,
|
||||
'state': lambda *a: 'new',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr_timesheet_sheet.sheet', context=c)
|
||||
}
|
||||
|
||||
def _sheet_date(self, cr, uid, ids):
|
||||
|
|
|
@ -70,7 +70,7 @@ class mrp_workcenter(osv.osv):
|
|||
'type': lambda *a: 'machine',
|
||||
'time_efficiency': lambda *a: 1.0,
|
||||
'capacity_per_cycle': lambda *a: 1.0,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.workcenter', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.workcenter', context=c)
|
||||
}
|
||||
mrp_workcenter()
|
||||
|
||||
|
@ -210,7 +210,7 @@ class mrp_bom(osv.osv):
|
|||
'product_qty': lambda *a: 1.0,
|
||||
'product_rounding': lambda *a: 1.0,
|
||||
'type': lambda *a: 'normal',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.bom', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.bom', context=c)
|
||||
}
|
||||
_order = "sequence"
|
||||
_sql_constraints = [
|
||||
|
@ -454,7 +454,7 @@ class mrp_production(osv.osv):
|
|||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', c),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
|
||||
}
|
||||
_order = 'date_planned asc, priority desc';
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
|
@ -844,7 +844,7 @@ class mrp_procurement(osv.osv):
|
|||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'close_move': lambda *a: 0,
|
||||
'procure_method': lambda *a: 'make_to_order',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
|
||||
}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
|
@ -1216,7 +1216,7 @@ class stock_warehouse_orderpoint(osv.osv):
|
|||
'qty_multiple': lambda *a: 1,
|
||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
|
||||
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
|
||||
}
|
||||
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
|
||||
if warehouse_id:
|
||||
|
|
|
@ -299,7 +299,7 @@ class product_template(osv.osv):
|
|||
return False
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.template', c),
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.template', context=c),
|
||||
# 'company_id': lambda self, cr, uid, context: False, # Visible by all
|
||||
'type': lambda *a: 'product',
|
||||
'list_price': lambda *a: 1,
|
||||
|
@ -639,7 +639,7 @@ class product_supplierinfo(osv.osv):
|
|||
'qty': lambda *a: 0.0,
|
||||
'sequence': lambda *a: 1,
|
||||
'delay': lambda *a: 1,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', context=c)
|
||||
}
|
||||
_order = 'sequence'
|
||||
product_supplierinfo()
|
||||
|
|
|
@ -127,7 +127,7 @@ class project(osv.osv):
|
|||
'priority': lambda *a: 1,
|
||||
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'state': lambda *a: 'open',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.project', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.project', context=c)
|
||||
}
|
||||
|
||||
_order = "parent_id,priority,name"
|
||||
|
@ -318,7 +318,7 @@ class task(osv.osv):
|
|||
'active': lambda *a: True,
|
||||
'date_start': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'project_id': _default_project,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c)
|
||||
}
|
||||
_order = "sequence, priority, date_deadline, id"
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ class purchase_order(osv.osv):
|
|||
'invoiced': lambda *a: 0,
|
||||
'partner_address_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['default'])['default'],
|
||||
'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', c),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c),
|
||||
}
|
||||
_name = "purchase.order"
|
||||
_description = "Purchase order"
|
||||
|
|
|
@ -257,7 +257,7 @@ class sale_order(osv.osv):
|
|||
'company_id': fields.many2one('res.company','Company',select=1),
|
||||
}
|
||||
_defaults = {
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'sale.order', c),
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'sale.order', context=c),
|
||||
'picking_policy': lambda *a: 'direct',
|
||||
'date_order': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'order_policy': lambda *a: 'manual',
|
||||
|
|
|
@ -175,7 +175,7 @@ class stock_location(osv.osv):
|
|||
'allocation_method': lambda *a: 'fifo',
|
||||
'chained_location_type': lambda *a: 'none',
|
||||
'chained_auto_packing': lambda *a: 'manual',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.location', c),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.location', context=c),
|
||||
'posx': lambda *a: 0,
|
||||
'posy': lambda *a: 0,
|
||||
'posz': lambda *a: 0,
|
||||
|
@ -484,7 +484,7 @@ class stock_picking(osv.osv):
|
|||
'type': lambda *a: 'in',
|
||||
'invoice_state': lambda *a: 'none',
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock_picking', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock_picking', context=c)
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
|
@ -1043,7 +1043,7 @@ class stock_move(osv.osv):
|
|||
'product_qty': lambda *a: 1.0,
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c)
|
||||
}
|
||||
|
||||
def _auto_init(self, cursor, context):
|
||||
|
@ -1392,7 +1392,7 @@ class stock_inventory(osv.osv):
|
|||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'state': lambda *a: 'draft',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', c)
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c)
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -1492,7 +1492,7 @@ class stock_warehouse(osv.osv):
|
|||
'lot_output_id': fields.many2one('stock.location', 'Location Output', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', c),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c),
|
||||
}
|
||||
stock_warehouse()
|
||||
|
||||
|
|
Loading…
Reference in New Issue