def _make_lc(self, move, amount): picking = move.picking_id lc = Form(self.env['stock.landed.cost']) lc.account_journal_id = self.stock_journal lc.picking_ids.add(move.picking_id) with lc.cost_lines.new() as cost_line: cost_line.product_id = self.productlc1 cost_line.price_unit = amount lc = lc.save() lc.compute_landed_cost() lc.button_validate() return lc
def _make_lc(self, move, amount): picking = move.picking_id lc = Form(self.env['stock.landed.cost']) lc.account_journal_id = self.env['account.journal'].search([('name', 'ilike', '%misc%')], limit=1) lc.picking_ids.add(move.picking_id) with lc.cost_lines.new() as cost_line: cost_line.product_id = self.productlc1 cost_line.price_unit = amount lc = lc.save() lc.compute_landed_cost() lc.button_validate() return lc