summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-03-26 13:50:27 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-03-26 13:50:27 +0700
commit935393a6a58b3df18f3361b36a6ea60647cd8be4 (patch)
treee4ec9d300aff98a38a8524c209a19f970aa24f23 /indoteknik_custom/models/sale_order.py
parentdb1780524b1e153338ced116f786b4d712d66aca (diff)
parentb2377426bec8aa334277aac48b0b25f0dfac420f (diff)
Merge branch 'purchasing-job' into production
# Conflicts: # indoteknik_custom/models/__init__.py # indoteknik_custom/models/sale_order.py
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
-rwxr-xr-xindoteknik_custom/models/sale_order.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index b7578da0..f9f849ca 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -8,6 +8,9 @@ _logger = logging.getLogger(__name__)
class SaleOrder(models.Model):
_inherit = "sale.order"
+
+ fullfillment_line = fields.One2many('sales.order.fullfillment', 'sales_order_id', string='Fullfillment')
+ order_sales_match_line = fields.One2many('sales.order.purchase.match', 'sales_order_id', string='Purchase Match Lines', states={'cancel': [('readonly', True)], 'done': [('readonly', True)]}, copy=True)
total_margin = fields.Float('Total Margin', compute='_compute_total_margin', help="Total Margin in Sales Order Header")
total_percent_margin = fields.Float('Total Percent Margin', compute='_compute_total_percent_margin', help="Total % Margin in Sales Order Header")
approval_status = fields.Selection([
@@ -93,6 +96,17 @@ class SaleOrder(models.Model):
('cust_manager', 'Customer Manager'),
('cust_director', 'Customer Director')
], string='Web Approval', copy=False)
+ compute_fullfillment = fields.Boolean(string='Compute Fullfillment', compute="_compute_fullfillment")
+
+ def _compute_fullfillment(self):
+ for rec in self:
+ for fullfillment in rec.fullfillment_line:
+ fullfillment.unlink()
+
+ for line in rec.order_line:
+ line._compute_reserved_from()
+
+ rec.compute_fullfillment = True
def _compute_eta_date(self):
max_leadtime = 0