| 1 |
|
| 2 |
|
| 3 |
from odoo import models |
| 4 |
|
| 5 |
|
| 6 |
class SaleOrderLine(models.Model): |
| 7 |
_inherit = 'sale.order.line' |
| 8 |
|
| 9 |
def _purchase_service_prepare_line_values(self, purchase_order, quantity=False): |
| 10 |
purchase_line_vals = super()._purchase_service_prepare_line_values(purchase_order, quantity) |
| 11 |
analytic_distribution = self.order_id.project_id._get_analytic_distribution() |
| 12 |
if not self.analytic_distribution and analytic_distribution: |
| 13 |
purchase_line_vals['analytic_distribution'] = analytic_distribution |
| 14 |
return purchase_line_vals |
| 15 |
|
| 16 |
def _purchase_service_prepare_order_values(self, supplierinfo): |
| 17 |
return { |
| 18 |
**super()._purchase_service_prepare_order_values(supplierinfo), |
| 19 |
'project_id': self.order_id.project_id.id, |
| 20 |
} |