##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+# 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
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
'invoiced': fields.function(_invoiced, method=True, string='Paid',
fnct_search=_invoiced_search, type='boolean'),
- 'note': fields.text('Notes'),
+ 'note': fields.text('Notes', translate=True),
'amount_untaxed': fields.function(_amount_all, method=True, digits=(16, int(config['price_accuracy'])), string='Untaxed Amount',
store = {
'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',
journal_obj = self.pool.get('account.journal')
journal_ids = journal_obj.search(cr, uid, [('type', '=','sale'),('company_id', '=', order.company_id.id)], limit=1)
if not journal_ids:
- raise osv.except_osv(_('Error !'),
+ raise osv.except_osv(_('Error !'),
_('There is no sale journal defined for this company: "%s" (id:%d)') % (order.company_id.name, order.company_id.id))
inv = {
'name': order.client_order_ref or order.name,
'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True),
'discount': fields.float('Discount (%)', digits=(16, 2)),
'number_packages': fields.function(_number_packages, method=True, type='integer', string='Number Packages'),
- 'notes': fields.text('Notes'),
+ 'notes': fields.text('Notes', translate=True),
'th_weight': fields.float('Weight'),
- 'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled'), ('exception', 'Exception')], 'State', required=True, readonly=True),
+ 'state': fields.selection([('draft', 'Draft'),('confirmed', 'Confirmed'),('done', 'Done'),('cancel', 'Cancelled'),('exception', 'Exception')], 'State', required=True, readonly=True,
+ help=' * The \'Draft\' state is set automatically when sale order in draft state. \
+ \n* The \'Confirmed\' state is set automatically when sale order in confirm state. \
+ \n* The \'Exception\' state is set automatically when sale order is set as exception. \
+ \n* The \'Done\' state is set automatically when sale order is set as done. \
+ \n* The \'Cancelled\' state is set automatically when user cancel sale order.'),
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer'),
'salesman_id':fields.related('order_id','user_id',type='many2one',relation='res.users',string='Salesman'),
'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
class sale_config_picking_policy(osv.osv_memory):
_name = 'sale.config.picking_policy'
+ _inherit = 'res.config'
+
_columns = {
'name': fields.char('Name', size=64),
'picking_policy': fields.selection([
'step': lambda *a: 'one'
}
- def set_default(self, cr, uid, ids, context=None):
+ def execute(self, cr, uid, ids, context=None):
for o in self.browse(cr, uid, ids, context=context):
ir_values_obj = self.pool.get('ir.values')
ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], o.picking_policy)
location_id = md._get_id(cr, uid, 'stock', 'stock_location_output')
location_id = md.browse(cr, uid, location_id, context).res_id
self.pool.get('stock.location').write(cr, uid, [location_id], {'chained_auto_packing': 'transparent'})
-
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'ir.actions.configuration.wizard',
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
-
- def action_cancel(self, cr, uid, ids, context=None):
- return {
- 'view_type': 'form',
- "view_mode": 'form',
- 'res_model': 'ir.actions.configuration.wizard',
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
-
sale_config_picking_policy()