[IMP] purchase: usability improvements + linked the stock move to the procurement that created the PO line, in order to be able to propagate any information on it
bzr revid: qdp-launchpad@openerp.com-20131210151326-rrlfgnx27114gbq0
This commit is contained in:
parent
06bd943846
commit
9aa559a3a1
|
@ -606,7 +606,7 @@ class purchase_order(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def invoice_done(self, cr, uid, ids, context=None):
|
def invoice_done(self, cr, uid, ids, context=None):
|
||||||
self.write(cr, uid, ids, {'state':'approved'}, context=context)
|
self.write(cr, uid, ids, {'state': 'approved'}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def has_stockable_product(self, cr, uid, ids, *args):
|
def has_stockable_product(self, cr, uid, ids, *args):
|
||||||
|
@ -617,26 +617,26 @@ class purchase_order(osv.osv):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def wkf_action_cancel(self, cr, uid, ids, context=None):
|
def wkf_action_cancel(self, cr, uid, ids, context=None):
|
||||||
self.write(cr,uid,ids,{'state':'cancel'})
|
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||||
self.set_order_line_status(cr, uid, ids, 'cancel', context=context)
|
self.set_order_line_status(cr, uid, ids, 'cancel', context=context)
|
||||||
|
|
||||||
def action_cancel(self, cr, uid, ids, context=None):
|
def action_cancel(self, cr, uid, ids, context=None):
|
||||||
for purchase in self.browse(cr, uid, ids, context=context):
|
for purchase in self.browse(cr, uid, ids, context=context):
|
||||||
for pick in purchase.picking_ids:
|
for pick in purchase.picking_ids:
|
||||||
if pick.state not in ('draft','cancel'):
|
if pick.state not in ('draft', 'cancel'):
|
||||||
raise osv.except_osv(
|
raise osv.except_osv(
|
||||||
_('Unable to cancel this purchase order.'),
|
_('Unable to cancel the purchase order %s.') % (purchase.name),
|
||||||
_('First cancel all receptions related to this purchase order.'))
|
_('First cancel all receptions related to this purchase order.'))
|
||||||
self.pool.get('stock.picking') \
|
self.pool.get('stock.picking') \
|
||||||
.signal_button_cancel(cr, uid, map(attrgetter('id'), purchase.picking_ids))
|
.signal_button_cancel(cr, uid, map(attrgetter('id'), purchase.picking_ids))
|
||||||
for inv in purchase.invoice_ids:
|
for inv in purchase.invoice_ids:
|
||||||
if inv and inv.state not in ('cancel','draft'):
|
if inv and inv.state not in ('cancel', 'draft'):
|
||||||
raise osv.except_osv(
|
raise osv.except_osv(
|
||||||
_('Unable to cancel this purchase order.'),
|
_('Unable to cancel this purchase order.'),
|
||||||
_('You must first cancel all receptions related to this purchase order.'))
|
_('You must first cancel all receptions related to this purchase order.'))
|
||||||
self.pool.get('account.invoice') \
|
self.pool.get('account.invoice') \
|
||||||
.signal_invoice_cancel(cr, uid, map(attrgetter('id'), purchase.invoice_ids))
|
.signal_invoice_cancel(cr, uid, map(attrgetter('id'), purchase.invoice_ids))
|
||||||
self.write(cr,uid,ids,{'state':'cancel'})
|
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||||
self.set_order_line_status(cr, uid, ids, 'cancel', context=context)
|
self.set_order_line_status(cr, uid, ids, 'cancel', context=context)
|
||||||
self.signal_purchase_cancel(cr, uid, ids)
|
self.signal_purchase_cancel(cr, uid, ids)
|
||||||
return True
|
return True
|
||||||
|
@ -645,7 +645,7 @@ class purchase_order(osv.osv):
|
||||||
""" Convert date values expressed in user's timezone to
|
""" Convert date values expressed in user's timezone to
|
||||||
server-side UTC timestamp, assuming a default arbitrary
|
server-side UTC timestamp, assuming a default arbitrary
|
||||||
time of 12:00 AM - because a time is needed.
|
time of 12:00 AM - because a time is needed.
|
||||||
|
|
||||||
:param str userdate: date string in in user time zone
|
:param str userdate: date string in in user time zone
|
||||||
:return: UTC datetime string for server-side use
|
:return: UTC datetime string for server-side use
|
||||||
"""
|
"""
|
||||||
|
@ -672,7 +672,6 @@ class purchase_order(osv.osv):
|
||||||
if order.currency_id.id != order.company_id.currency_id.id:
|
if order.currency_id.id != order.company_id.currency_id.id:
|
||||||
#we don't round the price_unit, as we may want to store the standard price with more digits than allowed by the currency
|
#we don't round the price_unit, as we may want to store the standard price with more digits than allowed by the currency
|
||||||
price_unit = self.pool.get('res.currency').compute(cr, uid, order.currency_id.id, order.company_id.currency_id.id, price_unit, round=False, context=context)
|
price_unit = self.pool.get('res.currency').compute(cr, uid, order.currency_id.id, order.company_id.currency_id.id, price_unit, round=False, context=context)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': order_line.name or '',
|
'name': order_line.name or '',
|
||||||
'product_id': order_line.product_id.id,
|
'product_id': order_line.product_id.id,
|
||||||
|
@ -691,8 +690,9 @@ class purchase_order(osv.osv):
|
||||||
'purchase_line_id': order_line.id,
|
'purchase_line_id': order_line.id,
|
||||||
'company_id': order.company_id.id,
|
'company_id': order.company_id.id,
|
||||||
'price_unit': price_unit,
|
'price_unit': price_unit,
|
||||||
'picking_type_id': order.picking_type_id.id,
|
'picking_type_id': order.picking_type_id.id,
|
||||||
'group_id': group_id,
|
'group_id': group_id,
|
||||||
|
'procurement_id': order_line.procurement_ids and order_line.procurement_ids[0].id or False,
|
||||||
'route_ids': order.picking_type_id.warehouse_id and [(6, 0, [x.id for x in order.picking_type_id.warehouse_id.route_ids])] or [],
|
'route_ids': order.picking_type_id.warehouse_id and [(6, 0, [x.id for x in order.picking_type_id.warehouse_id.route_ids])] or [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
<button name="invoice_ok" states="except_invoice" string="Manually Corrected"/>
|
<button name="invoice_ok" states="except_invoice" string="Manually Corrected"/>
|
||||||
<button name="purchase_approve" states="confirmed" string="Approve Order" class="oe_highlight" groups="purchase.group_purchase_manager"/>
|
<button name="purchase_approve" states="confirmed" string="Approve Order" class="oe_highlight" groups="purchase.group_purchase_manager"/>
|
||||||
<button name="wkf_send_rfq" states="approved" string="Send PO by Email" type="object" context="{'send_rfq':False}"/>
|
<button name="wkf_send_rfq" states="approved" string="Send PO by Email" type="object" context="{'send_rfq':False}"/>
|
||||||
<button name="view_picking" string="Receptions" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/>
|
<button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/>
|
||||||
<button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','=','picking'), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/>
|
<button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','=','picking'), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/>
|
||||||
<button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" />
|
<button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" />
|
||||||
<button name="purchase_cancel" states="draft,confirmed,sent,bid" string="Cancel"/>
|
<button name="purchase_cancel" states="draft,confirmed,sent,bid" string="Cancel"/>
|
||||||
|
@ -418,7 +418,7 @@
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="Notes">
|
<page string="Notes">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
</page><page string="Invoices and Receptions">
|
</page><page string="Invoices and Incoming Shipments">
|
||||||
<field name="invoice_lines"/>
|
<field name="invoice_lines"/>
|
||||||
<field name="move_ids"/>
|
<field name="move_ids"/>
|
||||||
</page>
|
</page>
|
||||||
|
|
Loading…
Reference in New Issue