##############################################################################
#
# 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
_columns = {
'name': fields.char('Order Reference', size=64, required=True, select=True),
'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)]}),
- 'origin': fields.char('Origin', size=64),
- 'client_order_ref': fields.char('Customer Ref', size=64),
+ 'origin': fields.char('Origin', size=64, help="Reference of the document that generated this sale order request."),
+ 'client_order_ref': fields.char('Customer Reference', size=64),
'state': fields.selection([
('draft', 'Quotation'),
'user_id': fields.many2one('res.users', 'Salesman', states={'draft': [('readonly', False)]}, select=True),
'partner_id': fields.many2one('res.partner', 'Customer', readonly=True, states={'draft': [('readonly', False)]}, required=True, change_default=True, select=True),
'partner_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)]}),
- 'partner_order_id': fields.many2one('res.partner.address', 'Ordering Contact', readonly=True, required=True, states={'draft': [('readonly', False)]}, help="The name and address of the contact that requested the order or quotation."),
+ 'partner_order_id': fields.many2one('res.partner.address', 'Ordering Contact', readonly=True, required=True, states={'draft': [('readonly', False)]}, help="The name and address of the contact who requested the order or quotation."),
'partner_shipping_id': fields.many2one('res.partner.address', 'Shipping Address', readonly=True, required=True, states={'draft': [('readonly', False)]}),
'incoterm': fields.selection(_incoterm_get, 'Incoterm', size=3),
'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,
_name = 'sale.order.line'
_description = 'Sale Order line'
_columns = {
- 'order_id': fields.many2one('sale.order', 'Order Ref', required=True, ondelete='cascade', select=True),
+ 'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True),
'name': fields.char('Description', size=256, required=True, select=True),
- 'sequence': fields.integer('Sequence'),
+ 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of sale order lines."),
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the the shipping of the products to the customer"),
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
'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'),
+ 'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
}
_order = 'sequence, id'
_defaults = {
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()