changes
This commit is contained in:
@@ -12,19 +12,18 @@ class FpDelivery(models.Model):
|
||||
def action_mark_delivered(self):
|
||||
res = super().action_mark_delivered()
|
||||
Dispatch = self.env['fp.notification.template']
|
||||
Job = self.env.get('fp.job')
|
||||
for rec in self:
|
||||
if not rec.partner_id:
|
||||
continue
|
||||
so = False
|
||||
if rec.job_ref:
|
||||
# Delivery's job_ref is the MO name; find the SO via MO origin.
|
||||
mo = self.env['mrp.production'].search(
|
||||
[('name', '=', rec.job_ref)], limit=1,
|
||||
)
|
||||
if mo and mo.origin:
|
||||
so = self.env['sale.order'].search(
|
||||
[('name', '=', mo.origin)], limit=1,
|
||||
)
|
||||
# Native: fp.job direct link.
|
||||
if Job is not None and 'x_fc_job_id' in rec._fields and rec.x_fc_job_id:
|
||||
so = rec.x_fc_job_id.sale_order_id or False
|
||||
elif Job is not None and rec.job_ref:
|
||||
job = Job.search([('name', '=', rec.job_ref)], limit=1)
|
||||
if job:
|
||||
so = job.sale_order_id or False
|
||||
# Sub 6 — pass the delivery address so location-scoped
|
||||
# contacts receive the 'shipped' notification.
|
||||
Dispatch._dispatch(
|
||||
|
||||
Reference in New Issue
Block a user