[IMP] sale:-display warning on Cancel button in sale.order.line,renamed call_make_invoices method and set the appearance of button in sale.ordere.line.
bzr revid: mtr@mtr-20100712064914-j4dg3e3rsci0otl3
This commit is contained in:
parent
2319136344
commit
9c051695eb
|
@ -829,12 +829,13 @@ class sale_order_line(osv.osv):
|
|||
'number_packages': fields.function(_number_packages, method=True, type='integer', string='Number Packages'),
|
||||
'notes': fields.text('Notes'),
|
||||
'th_weight': fields.float('Weight', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'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'),('invoiced','Invoiced')], '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.'),
|
||||
\n* The \'Cancelled\' state is set automatically when user cancel sale order\
|
||||
\n* The \'Invoiced\' state is set automatically when user creates sale order line invoice.'),
|
||||
'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, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -852,11 +853,11 @@ class sale_order_line(osv.osv):
|
|||
'product_packaging': False
|
||||
}
|
||||
|
||||
def call_make_invoices(self, cr, uid, ids, context):
|
||||
def create_sale_order_line_invoice(self, cr, uid, ids, context):
|
||||
line_make_invoice_obj = self.pool.get("sale.order.line.make.invoice")
|
||||
context.update({'active_ids' : ids,'active_id' : ids})
|
||||
invoice_call = line_make_invoice_obj.make_invoices(cr, uid, ids, context)
|
||||
return True
|
||||
invoice_id = line_make_invoice_obj.make_invoices(cr, uid, ids, context)
|
||||
return self.write(cr, uid, ids, {'state': 'invoiced'})
|
||||
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
|
@ -939,6 +940,10 @@ class sale_order_line(osv.osv):
|
|||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.invoiced:
|
||||
raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced !'))
|
||||
if line.order_id.picking_ids:
|
||||
raise osv.except_osv(
|
||||
_('Could not cancel sale order line!'),
|
||||
_('You must first cancel stock move attached to this sale order line.'))
|
||||
message = _('Sale order line') + " '" + line.name + "' "+_("is cancelled")
|
||||
self.log(cr, uid, id, message)
|
||||
return self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
|
|
|
@ -165,10 +165,10 @@
|
|||
<field name="state"/>
|
||||
<field name="invoiced"/>
|
||||
<button colspan="1"
|
||||
name="%(action_view_sale_order_line_make_invoice)d"
|
||||
name="create_sale_order_line_invoice"
|
||||
states="confirmed"
|
||||
string="Make Invoice"
|
||||
type="action"
|
||||
string="Create Invoice"
|
||||
type="object"
|
||||
icon="terp-document-new" />
|
||||
</group>
|
||||
</page>
|
||||
|
@ -398,22 +398,19 @@
|
|||
<field name="state"/>
|
||||
<group col="3" colspan="2">
|
||||
<button colspan="1"
|
||||
name="call_make_invoices"
|
||||
states="confirmed"
|
||||
name="create_sale_order_line_invoice"
|
||||
string="Create Invoice"
|
||||
type="object"
|
||||
icon="terp-document-new"
|
||||
attrs="{'invisible': [('invoiced', '=', 1)]}" />
|
||||
<button name="button_done"
|
||||
states="confirmed,exception"
|
||||
string="Done" type="object"
|
||||
icon="gtk-jump-to"
|
||||
attrs="{'invisible': [('invoiced', '=', 0)]}"/>
|
||||
<button name="button_cancel"
|
||||
states="confirmed,exception"
|
||||
attrs="{'invisible': [('invoiced', '=', 1)]}"/>
|
||||
<button name="button_cancel"
|
||||
states="draft,confirmed,exception"
|
||||
string="Cancel" type="object"
|
||||
icon="gtk-cancel"
|
||||
attrs="{'invisible': [('invoiced', '=', 1)]}" />
|
||||
icon="gtk-cancel"/>
|
||||
<button name="button_done"
|
||||
string="Done" type="object"
|
||||
states="invoiced,exception"
|
||||
icon="gtk-jump-to"/>
|
||||
</group>
|
||||
</page>
|
||||
<!-- <page string="Properties" groups="base.group_extended">-->
|
||||
|
|
Loading…
Reference in New Issue