-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
793bc7a
commit 089c8cd
Showing
15 changed files
with
223 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2022 Yiğit Budak (https://github.com/yibudak) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import models | ||
# from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# Copyright 2022 Yiğit Budak (https://github.com/yibudak) | ||
# Copyright 2025 Yiğit Budak, Ümithan Güldemir (https://github.com/yibudak) (https://github.com/umithan-guldemir) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Altinkaya Stock Lot Extensions", | ||
"summary": "Adds custom fields to stock.production.lot", | ||
"version": "13.0.1.0.0", | ||
"version": "16.0.1.0.0", | ||
"category": "stock", | ||
"website": "https://github.com/yibudak", | ||
"author": "Yiğit Budak", | ||
"author": "Yiğit Budak, Ümithan Güldemir", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": ["stock", "mrp"], | ||
"depends": ["stock", "mrp", "stock_inventory"], | ||
"data": [ | ||
"wizards/mrp_product_produce_view.xml", | ||
# "wizards/mrp_product_produce_view.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * altinkaya_stock_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-12-28 08:07+0000\n" | ||
"PO-Revision-Date: 2022-12-28 08:07+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model,name:altinkaya_stock_lot.model_stock_production_lot | ||
msgid "Lot/Serial" | ||
msgstr "" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model.fields,field_description:altinkaya_stock_lot.field_stock_production_lot__name | ||
msgid "Lot/Serial Number" | ||
msgstr "" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model,name:altinkaya_stock_lot.model_mrp_product_produce | ||
msgid "Record Production" | ||
msgstr "" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model,name:altinkaya_stock_lot.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model.fields,help:altinkaya_stock_lot.field_stock_production_lot__name | ||
msgid "Unique Lot/Serial Number" | ||
msgstr "" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: code:addons/altinkaya_stock_lot/wizards/mrp_product_produce.py:16 | ||
#, python-format | ||
msgid "You have to select a product." | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * altinkaya_stock_lot | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-12-28 08:07+0000\n" | ||
"PO-Revision-Date: 2022-12-28 08:07+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model,name:altinkaya_stock_lot.model_stock_production_lot | ||
msgid "Lot/Serial" | ||
msgstr "Lot/Seri" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model.fields,field_description:altinkaya_stock_lot.field_stock_production_lot__name | ||
msgid "Lot/Serial Number" | ||
msgstr "Lot/Seri Numarası" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model,name:altinkaya_stock_lot.model_mrp_product_produce | ||
msgid "Record Production" | ||
msgstr "Üretimi Kaydını İşle" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model,name:altinkaya_stock_lot.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "Transfer" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: model:ir.model.fields,help:altinkaya_stock_lot.field_stock_production_lot__name | ||
msgid "Unique Lot/Serial Number" | ||
msgstr "Benzersiz Lot / Seri Numarası" | ||
|
||
#. module: altinkaya_stock_lot | ||
#: code:addons/altinkaya_stock_lot/wizards/mrp_product_produce.py:16 | ||
#, python-format | ||
msgid "You have to select a product." | ||
msgstr "Üretilecek bir ürün seçmelisiniz." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2022 Yiğit Budak (https://github.com/yibudak) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import stock_lot | ||
from . import stock_move_line | ||
# from . import stock_quant |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2022 Yiğit Budak (https://github.com/yibudak) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
import random | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockProductionLot(models.Model): | ||
_inherit = "stock.lot" | ||
|
||
def _compute_lot_name(self): | ||
"""Generates a random lot number. Overrides the default method. | ||
We excluded some characters from the random string to avoid confusion.""" | ||
while True: | ||
unique = "".join( | ||
random.choice("ABCDEFGHJKLMNPRSTUVXYZ123456789") for i in range(5) | ||
) | ||
if not self.search([("name", "=", unique)], limit=1): | ||
break | ||
return unique | ||
|
||
name = fields.Char( | ||
"Lot/Serial Number", | ||
default=_compute_lot_name, | ||
required=True, | ||
readonly=True, | ||
help="Unique Lot/Serial Number", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
# Copyright 2022 Yiğit Budak (https://github.com/yibudak) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
from odoo import models, api | ||
from odoo import api, models | ||
|
||
|
||
class StockMoveLine(models.Model): | ||
_inherit = "stock.move.line" | ||
|
||
|
||
def _create_missing_lot(self): | ||
"""EXPERIMENTAL: Create a lot for the move line if it is missing.""" | ||
"""Create a lot for the move line if it is missing.""" | ||
for rec in self: | ||
if rec.product_id.tracking != "none" and not rec.lot_id: | ||
lot_id = self.env["stock.production.lot"].create( | ||
{"product_id": rec.product_id.id, "ref": rec.move_id.name or ""} | ||
lot_id = self.env["stock.lot"].create( | ||
{"product_id": rec.product_id.id, "ref": rec.move_id.reference or ""} | ||
) | ||
rec.lot_id = lot_id.id | ||
return True | ||
|
||
@api.model | ||
def create(self, vals): | ||
res = super(StockMoveLine, self).create(vals) | ||
def create(self, vals_list): | ||
res = super().create(vals_list) | ||
res._create_missing_lot() | ||
return res | ||
|
||
@api.model | ||
def write(self, vals): | ||
res = super(StockMoveLine, self).write(vals) | ||
res = super().write(vals) | ||
self._create_missing_lot() | ||
return res |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from odoo import api, models | ||
|
||
|
||
class StockQuant(models.Model): | ||
_inherit = "stock.quant" | ||
|
||
def _create_missing_lot(self, vals_list): | ||
"""EXPERIMENTAL: Create a lot for the move line if it is missing.""" | ||
for vals in vals_list: | ||
if not vals.get("lot_id") and vals.get("product_id") and (vals.get("quantity") or vals.get("inventory_quantity")): | ||
product_id = self.env["product.product"].browse(vals["product_id"]) | ||
if product_id.tracking != "none": | ||
lot_id = self.env["stock.lot"].create( | ||
{ | ||
"product_id": product_id.id, | ||
"ref": vals.get("stock_inventory_ids") or "", #todo: find a better ref | ||
"product_qty": vals.get("quantity") or vals.get("inventory_quantity"), | ||
} | ||
) | ||
vals["lot_id"] = lot_id.id | ||
|
||
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
self._create_missing_lot(vals_list) | ||
res = super().create(vals_list) | ||
|
||
return res |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright 2022 Yiğit Budak (https://github.com/yibudak) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
from . import mrp_product_produce |
Oops, something went wrong.