mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 15:12:02 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
25
odoo-bringout-oca-ocb-sale_mrp/sale_mrp/models/stock_move.py
Normal file
25
odoo-bringout-oca-ocb-sale_mrp/sale_mrp/models/stock_move.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
def _prepare_procurement_values(self):
|
||||
res = super()._prepare_procurement_values()
|
||||
res['analytic_account_id'] = self.sale_line_id.order_id.analytic_account_id
|
||||
return res
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
def _compute_sale_price(self):
|
||||
kit_lines = self.filtered(lambda move_line: move_line.move_id.bom_line_id.bom_id.type == 'phantom')
|
||||
for move_line in kit_lines:
|
||||
unit_price = move_line.product_id.list_price
|
||||
qty = move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id)
|
||||
move_line.sale_price = unit_price * qty
|
||||
super(StockMoveLine, self - kit_lines)._compute_sale_price()
|
||||
Loading…
Add table
Add a link
Reference in a new issue