1、销售订单供货方式为委外加工时生成的采购单问题优化

This commit is contained in:
yuxianghui
2024-12-25 17:12:38 +08:00
parent 78fff46452
commit 14cc285ee2
3 changed files with 17 additions and 17 deletions

View File

@@ -170,9 +170,9 @@ class ReSaleOrder(models.Model):
def _compute_purchase_order_count(self):
for order in self:
order.purchase_order_count = len(order._get_purchase_orders().filtered(
lambda po: po.purchase_type not in ['consignment']))
lambda po: po.purchase_type not in ['outsourcing']))
order.consignment_purchase_order_count = len(order._get_purchase_orders().filtered(
lambda po: po.purchase_type in ['consignment']))
lambda po: po.purchase_type in ['outsourcing']))
def action_view_purchase_orders(self):
"""
@@ -180,7 +180,7 @@ class ReSaleOrder(models.Model):
"""
self.ensure_one()
purchase_order_ids = self._get_purchase_orders().filtered(
lambda po: po.purchase_type not in ['consignment']).ids
lambda po: po.purchase_type not in ['outsourcing']).ids
action = {
'res_model': 'purchase.order',
'type': 'ir.actions.act_window',
@@ -203,21 +203,21 @@ class ReSaleOrder(models.Model):
委外加工
"""
self.ensure_one()
consignment_purchase_order_ids = self._get_purchase_orders().filtered(
lambda po: po.purchase_type in ['consignment']).ids
outsourcing_purchase_order_ids = self._get_purchase_orders().filtered(
lambda po: po.purchase_type in ['outsourcing']).ids
action = {
'res_model': 'purchase.order',
'type': 'ir.actions.act_window',
}
if len(consignment_purchase_order_ids) == 1:
if len(outsourcing_purchase_order_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': consignment_purchase_order_ids[0],
'res_id': outsourcing_purchase_order_ids[0],
})
else:
action.update({
'name': _("%s生成委外加工订单", self.name),
'domain': [('id', 'in', consignment_purchase_order_ids)],
'domain': [('id', 'in', outsourcing_purchase_order_ids)],
'view_mode': 'tree,form',
})
return action