[FIX] stock_dropshipping: raise a warning in a specific invoice creation config
So far, we do not support the following combination: - route set on 'dropship' - PO invoicing set on 'picking' - SO invoicing set on 'picking' opw-634898
This commit is contained in:
parent
1beb4db6c0
commit
1610fc41ef
|
@ -1,6 +1,7 @@
|
|||
# coding: utf-8
|
||||
|
||||
from openerp import models, api
|
||||
from openerp import models, api, _
|
||||
from openerp.exceptions import Warning
|
||||
|
||||
|
||||
class sale_order_line(models.Model):
|
||||
|
@ -20,3 +21,16 @@ class sale_order_line(models.Model):
|
|||
res = True
|
||||
break
|
||||
return res
|
||||
|
||||
|
||||
class purchase_order(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
@api.multi
|
||||
def wkf_confirm_order(self):
|
||||
for po in self:
|
||||
if po.invoice_method == 'picking' and po.location_id.usage == 'customer':
|
||||
for proc in po.order_line.mapped('procurement_ids'):
|
||||
if proc.sale_line_id.order_id.order_policy == 'picking':
|
||||
raise Warning(_('In the case of a dropship route, it is not possible to have an invoicing control set on "Based on incoming shipments" and a sale order with an invoice creation on "On Delivery Order"'))
|
||||
super(purchase_order, self).wkf_confirm_order()
|
||||
|
|
Loading…
Reference in New Issue