changes
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
{
|
||||
'name': 'Fusion Plating — Invoicing',
|
||||
'version': '19.0.3.0.0',
|
||||
'version': '19.0.3.1.0',
|
||||
'category': 'Manufacturing/Plating',
|
||||
'summary': 'Invoice strategy engine with deposit, progress billing, net terms, COD/prepay, and account holds.',
|
||||
'description': """
|
||||
|
||||
@@ -19,25 +19,23 @@ class FpDelivery(models.Model):
|
||||
def action_mark_delivered(self):
|
||||
res = super().action_mark_delivered()
|
||||
SaleOrder = self.env['sale.order']
|
||||
MrpProduction = self.env['mrp.production']
|
||||
# Sub 11 — MRP gone; resolve via delivery.job_ref → fp.job.name → fp.job.origin.
|
||||
Job = self.env['fp.job'] if 'fp.job' in self.env else None
|
||||
for delivery in self:
|
||||
# Resolve the sale order via delivery.job_ref → MO.name → MO.origin
|
||||
so = False
|
||||
if delivery.job_ref:
|
||||
mo = MrpProduction.search(
|
||||
if delivery.job_ref and Job is not None:
|
||||
job = Job.sudo().search(
|
||||
[('name', '=', delivery.job_ref)], limit=1,
|
||||
)
|
||||
if mo and mo.origin:
|
||||
if job and job.origin:
|
||||
so = SaleOrder.search(
|
||||
[('name', '=', mo.origin)], limit=1,
|
||||
[('name', '=', job.origin)], limit=1,
|
||||
)
|
||||
if not so:
|
||||
# Fallback: find by partner + recently-confirmed with matching strategy
|
||||
continue
|
||||
strategy = so.x_fc_invoice_strategy
|
||||
if strategy not in ('progress', 'net_terms'):
|
||||
continue
|
||||
# Skip if already billed in full
|
||||
if so.invoice_status == 'invoiced':
|
||||
continue
|
||||
so._create_final_balance_invoice()
|
||||
|
||||
Reference in New Issue
Block a user