@ -0,0 +1,48 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
|
|||
Water Supply With Manufacturing Order |
|||
===================================== |
|||
This module helps you to manufacturing the products from the water supply |
|||
request form. |
|||
|
|||
Configuration |
|||
============= |
|||
* Added Water Supply user in user settings. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: (V18) Vishnu P, Contact : odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import models |
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
'name': "Water Supply With Manufacturing Order", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Manufacturing', |
|||
'summary': """This app allows you to create water supplying methods""", |
|||
'description': """This app allows you to create water supplying methods |
|||
allows us to create manufacture orders from water supply requests.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['account', 'mail', 'mrp'], |
|||
'data': [ |
|||
'security/water_supply_with_mo_groups.xml', |
|||
'security/ir.model.access.csv', |
|||
'data/ir_sequence_data.xml', |
|||
'views/water_supply_method_views.xml', |
|||
'views/water_usage_places_views.xml', |
|||
'views/water_usage_categories_views.xml', |
|||
'views/water_supply_request_views.xml', |
|||
'views/manufacturing_order_creation_views.xml', |
|||
'views/mrp_production_views.xml', |
|||
'views/water_supply_with_mo_menus.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': True, |
|||
} |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<!--Sequence number generation for water supply request--> |
|||
<record id="ir_sequence_water_supply_request" model="ir.sequence"> |
|||
<field name="name">Water Supply Request</field> |
|||
<field name="code">water_supply_request</field> |
|||
<field name="prefix">WS</field> |
|||
<field name="padding">4</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <water_supply_with_mo> |
|||
|
|||
#### 23.12.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial Commit for Water Supply With Manufacturing Order |
@ -0,0 +1,29 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import manufacturing_order_creation |
|||
from . import mrp_bom |
|||
from . import mrp_production |
|||
from . import stock_move |
|||
from . import water_supply_methods |
|||
from . import water_supply_request |
|||
from . import water_usage_categories |
|||
from . import water_usage_places |
@ -0,0 +1,76 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ManufacturingOrderCreation(models.Model): |
|||
"""The created manufacturing orders can be displayed and edited |
|||
through this model.This model set an as 'many2many' field in another |
|||
model.""" |
|||
_name = 'manufacturing.order.creation' |
|||
_description = 'Manufacturing Order Creation ' |
|||
_rec_name = 'product_id' |
|||
|
|||
product_id = fields.Many2one('product.product', |
|||
string='Product', help='Name of the product') |
|||
quantity = fields.Integer(string='Quantity', |
|||
help='Quantity of the product') |
|||
uom_id = fields.Many2one('uom.uom', string='UoM', |
|||
help='Unit of measure of the product') |
|||
bom_id = fields.Many2one('mrp.bom', |
|||
domain="[('product_id','=', product_id)]", |
|||
string='Bill of Material', |
|||
help='Bill of material of the product.') |
|||
mrp_id = fields.Many2one('mrp.production', |
|||
string='Manufacturing Order', |
|||
help='Manufacturing order of the product') |
|||
is_mo = fields.Boolean(string='Is Display', default=True, |
|||
help='If the value of the boolean field i s' |
|||
'false,then manufacturing order button ' |
|||
'will disappear') |
|||
supply_request_id = fields.Many2one('water.supply.request', |
|||
string='Supply Request', |
|||
help="Corresponding water supply " |
|||
"request") |
|||
|
|||
def action_creating_mo(self): |
|||
"""Displaying manufacturing order of the product. |
|||
The form view will display default values for the specified fields |
|||
based on the attributes of the current instance. |
|||
The view will be opened in the current window.""" |
|||
res = { |
|||
'name': 'mrp.production', |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'mrp.production', |
|||
'view_mode': 'form', |
|||
'view_id': self.env.ref( |
|||
'mrp.mrp_production_form_view').id, |
|||
'view_type': 'form', |
|||
'target': 'current', |
|||
'context': { |
|||
'default_product_id': self.product_id.id, |
|||
'default_product_qty': self.quantity, |
|||
'default_supply_id': self.supply_request_id.id, |
|||
'default_manufacturing_order_id': self.id |
|||
}, |
|||
} |
|||
return res |
@ -0,0 +1,35 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import api, models |
|||
|
|||
|
|||
class MrpBom(models.Model): |
|||
""" This class extends the standard MRP Bill of Materials (BOM) model |
|||
to incorporate changes related to variants.""" |
|||
_inherit = 'mrp.bom' |
|||
|
|||
@api.onchange("product_tmpl_id") |
|||
def _onchange_product_tmpl_id(self): |
|||
""" This method updates the product ID based on the selected |
|||
product template ID.""" |
|||
self.product_id = self.env['product.product'].search( |
|||
[('product_tmpl_id', '=', self.product_tmpl_id.id)]) |
@ -0,0 +1,50 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class MrpProduction(models.Model): |
|||
""" This class adds additional fields and overrides the 'create' method |
|||
for specific functionality.""" |
|||
_inherit = 'mrp.production' |
|||
|
|||
manufacturing_order_id = fields.Many2one('manufacturing.order.creation', |
|||
string='MO Order', |
|||
help='Manufacturing order.') |
|||
supply_id = fields.Many2one('water.supply.request', |
|||
string='Water Supply Request', |
|||
help='Displaying water supply request') |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals): |
|||
"""Create a new Manufacturing Production.""" |
|||
records = super(MrpProduction, self).create(vals) |
|||
for res in records: |
|||
default_mo_context_id = res._context.get( |
|||
'default_manufacturing_order_id') |
|||
default_manufacturing_order_id = self.env[ |
|||
'manufacturing.order.creation'].browse(default_mo_context_id) |
|||
default_manufacturing_order_id.mrp_id = res |
|||
default_manufacturing_order_id.bom_id = res.bom_id.id |
|||
if default_manufacturing_order_id.mrp_id: |
|||
default_manufacturing_order_id.write({'is_mo': False}) |
|||
return records |
@ -0,0 +1,31 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class StockMove(models.Model): |
|||
"""Inheriting stock.move model to add relational field""" |
|||
_inherit = 'stock.move' |
|||
|
|||
supply_id = fields.Many2one('water.supply.request', |
|||
string='Water Supply', |
|||
help='Water supply request') |
@ -0,0 +1,53 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class WaterSupplyMethods(models.Model): |
|||
"""Creating water supply methods. """ |
|||
_name = 'water.supply.methods' |
|||
_description = 'Water Supply Methods' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_rec_name = 'supply_name' |
|||
|
|||
code = fields.Char(string='Internal Code', help='Code of the supply' |
|||
' method') |
|||
supply_name = fields.Char(string='Supply Name', help='Supply name') |
|||
created_product_id = fields.Many2one('product.product', |
|||
string='Product Created', |
|||
help="Product created when method " |
|||
"is created") |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals_list): |
|||
"""Creating corresponding product for each method.""" |
|||
records = super(WaterSupplyMethods, self).create(vals_list) |
|||
for record in records: |
|||
product_records = { |
|||
'name': record.supply_name, |
|||
'type': 'consu', |
|||
'is_storable': True |
|||
} |
|||
created_product = self.env['product.product'].create( |
|||
product_records).id |
|||
record.created_product_id = created_product |
|||
return records |
@ -0,0 +1,249 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Vishnu P(odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import datetime |
|||
from odoo import api, fields, models, _ |
|||
from odoo.addons.stock.models.stock_move import PROCUREMENT_PRIORITIES |
|||
|
|||
|
|||
class WaterSupplyRequest(models.Model): |
|||
"""Model for water supply request form.""" |
|||
|
|||
_name = "water.supply.request" |
|||
_description = "Water Supply Request" |
|||
_inherit = ["mail.thread", "mail.activity.mixin"] |
|||
_date_name = "date_planned_start" |
|||
_order = "priority desc, date_planned_start asc,id" |
|||
_rec_name = "reference_no" |
|||
|
|||
@api.model |
|||
def _get_default_date_planned_start(self): |
|||
"""Method returns the specified deadline date as a datetime object.""" |
|||
if self.env.context.get("default_date_deadline"): |
|||
return fields.Datetime.to_datetime( |
|||
self.env.context.get("default_date_deadline") |
|||
) |
|||
return datetime.datetime.now() |
|||
|
|||
reference_no = fields.Char( |
|||
string="Sequence", readonly=True, default="New", help="Reference number" |
|||
) |
|||
responsible_user_id = fields.Many2one( |
|||
"res.users", |
|||
string="Responsible User", |
|||
default=lambda self: self.env.user, |
|||
help="Responsible person", |
|||
) |
|||
customer_name_id = fields.Many2one( |
|||
"res.partner", |
|||
string="Customer Name", |
|||
help="Name of the customer", |
|||
required=True, |
|||
) |
|||
customer_email = fields.Char( |
|||
related="customer_name_id.email", string="Customer Email", help="Customer email" |
|||
) |
|||
customer_phone = fields.Char( |
|||
related="customer_name_id.phone", |
|||
string="Customer Phone", |
|||
help="Phone number of" " the customer.", |
|||
) |
|||
customer_address = fields.Char( |
|||
related="customer_name_id.street", |
|||
string="Customer Address", |
|||
help="Customer address", |
|||
) |
|||
pickup_date = fields.Date( |
|||
string="Pickup Date", help="Date of the pickup", required=True |
|||
) |
|||
request_date = fields.Date( |
|||
string="Request Date", help="Date of the " "product request." |
|||
) |
|||
state = fields.Selection( |
|||
[("draft", "Draft"), ("created", "Created"), ("supplied", "Supplied")], |
|||
default="draft", |
|||
string="State", |
|||
help="State of the supply request.", |
|||
) |
|||
create_date = fields.Date( |
|||
string="Create Date", |
|||
default=fields.Date.today(), |
|||
help="Create date of water supply request", |
|||
) |
|||
is_closed = fields.Boolean( |
|||
string="Is Closed", |
|||
help="Boolean field for to check the " "current request is closed or not", |
|||
) |
|||
date_planned_start = fields.Datetime( |
|||
string="Scheduled Date", |
|||
copy=False, |
|||
default=_get_default_date_planned_start, |
|||
help="Date at which you plan to start the production.", |
|||
index=True, |
|||
required=True, |
|||
) |
|||
supply_method_ids = fields.Many2many( |
|||
"water.supply.methods", |
|||
string="Supply Methods", |
|||
help="Supply methods", |
|||
required=True, |
|||
) |
|||
usage_categories_ids = fields.Many2many( |
|||
"water.usage.categories", |
|||
string="Usage Categories", |
|||
help="Usage categories", |
|||
required=True, |
|||
) |
|||
usage_place_id = fields.Many2one( |
|||
"water.usage.places", string="Usage Place", help="Usage place", required=True |
|||
) |
|||
create_mo_ids = fields.One2many( |
|||
"manufacturing.order.creation", |
|||
"supply_request_id", |
|||
string="Creation Manufacturing Order", |
|||
help="Created manufacturing orders.", |
|||
) |
|||
mo_count = fields.Integer( |
|||
string="Manufacture Order Count", |
|||
compute="compute_mo_count", |
|||
help="For storing manufacturing order count.", |
|||
) |
|||
stock_move_count = fields.Integer( |
|||
string="Stock Move Count", |
|||
compute="compute_stock_move_count", |
|||
help="Store the stock move count.", |
|||
) |
|||
priority = fields.Selection( |
|||
PROCUREMENT_PRIORITIES, |
|||
string="Priority", |
|||
default="0", |
|||
help="Components will be reserved first for the MO " |
|||
"with the highest priorities.", |
|||
) |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals): |
|||
"""Creating sequence number.""" |
|||
records = super(WaterSupplyRequest, self).create(vals) |
|||
for record in records: |
|||
if record.reference_no == _("New"): |
|||
reference_no = self.env["ir.sequence"].next_by_code( |
|||
"water_supply_request" |
|||
) or _("New") |
|||
record.write({"reference_no": reference_no}) |
|||
return records |
|||
|
|||
@api.onchange("supply_method_ids") |
|||
def _onchange_supply_method_ids(self): |
|||
"""This method is triggered when the 'supply_method_ids' field is |
|||
changed. It fills the 'create_mo_ids' many2many field with |
|||
manufacturing order data based on the selected supply method's |
|||
information.""" |
|||
self.create_mo_ids = False |
|||
for record in self.supply_method_ids: |
|||
product = self.env["product.product"].browse(record.created_product_id.id) |
|||
bom = self.env["mrp.bom"].search([("product_id", "=", product.id)], limit=1) |
|||
self.create_mo_ids = [ |
|||
fields.Command.create( |
|||
{ |
|||
"product_id": product.id, |
|||
"quantity": bom.product_qty, |
|||
"uom_id": product.uom_id.id, |
|||
"bom_id": bom, |
|||
} |
|||
) |
|||
] |
|||
|
|||
def action_apply(self): |
|||
"""Stock move will occur when supply the product to the customer.""" |
|||
self.write({"state": "created"}) |
|||
src_location = self.env["stock.location"].search( |
|||
[("usage", "=", "internal"), ("name", "=", "Stock")], limit=1 |
|||
) |
|||
dest_location = self.env["stock.location"].search( |
|||
[("usage", "=", "customer")], limit=1 |
|||
) |
|||
for rec in self.create_mo_ids: |
|||
move = self.env["stock.move"].create( |
|||
[{ |
|||
"name": self.reference_no, |
|||
"origin": self.reference_no, |
|||
"location_id": src_location.id, |
|||
"location_dest_id": dest_location.id, |
|||
"product_id": rec.product_id.id, |
|||
"product_uom": rec.product_id.uom_id.id, |
|||
"product_uom_qty": rec.quantity, |
|||
"supply_id": self.id, |
|||
}] |
|||
) |
|||
move.write({"state": "done"}) |
|||
manufacturing_order = self.env["mrp.production"].search( |
|||
[("name", "=", self.create_mo_ids.mrp_id.mapped("name"))] |
|||
) |
|||
manufacturing_order.write({"supply_id": self}) |
|||
|
|||
def action_supply(self): |
|||
"""Enabling the boolean field if the request is supplied.""" |
|||
self.write({"state": "supplied"}) |
|||
if self.state == "supplied": |
|||
self.is_closed = True |
|||
|
|||
def action_stock_move(self): |
|||
"""Opens a window displaying stock moves related to the current |
|||
record.""" |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_window", |
|||
"name": "Stock Move", |
|||
"view_mode": "list,form", |
|||
"res_model": "stock.move", |
|||
"domain": [("supply_id", "=", self.id)], |
|||
} |
|||
|
|||
def action_mrp_production(self): |
|||
"""Display the production records associated with the current supply |
|||
order.""" |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_window", |
|||
"name": "Manufacturing Order", |
|||
"view_mode": "list,form", |
|||
"res_model": "mrp.production", |
|||
"domain": [("supply_id", "=", self.id)], |
|||
} |
|||
|
|||
def compute_mo_count(self): |
|||
"""This method calculates the number of manufacturing orders |
|||
associated with the current record and updates the 'mo_count' |
|||
field on each record accordingly.""" |
|||
for record in self: |
|||
record.mo_count = self.env["mrp.production"].search_count( |
|||
[("supply_id", "=", self.id)] |
|||
) |
|||
|
|||
def compute_stock_move_count(self): |
|||
"""This method iterates through the records in `self` and calculates |
|||
the number of stock moves associated with each record. It sets the |
|||
`stock_move_count` field of each record to the corresponding count.""" |
|||
for record in self: |
|||
record.stock_move_count = self.env["stock.move"].search_count( |
|||
[("supply_id", "=", self.id)] |
|||
) |
@ -0,0 +1,35 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class WaterUsageCategories(models.Model): |
|||
"""Creating water usage categories.""" |
|||
_name = 'water.usage.categories' |
|||
_description = 'Water Usage Categories' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_rec_name = 'usage_category_name' |
|||
|
|||
code = fields.Char(string='Usage Category Code', |
|||
help='Usage category code') |
|||
usage_category_name = fields.Char(string='Usage Category Name', |
|||
help='Usage category name') |
@ -0,0 +1,34 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Vishnu P (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class WaterUsagePlaces(models.Model): |
|||
"""Creating water usage places.""" |
|||
_name = 'water.usage.places' |
|||
_description = 'Water Usage Places' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_rec_name = 'usage_place_name' |
|||
|
|||
code = fields.Char(string='Code', help='Code of the water usage places') |
|||
usage_place_name = fields.Char(string='Usage Places Name', |
|||
help='Usage places name') |
|
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Creating water supplier user group--> |
|||
<record id="water_supply_with_mo_supplier_user" model="res.groups"> |
|||
<field name="name">Water Supplier User</field> |
|||
</record> |
|||
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 723 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 334 KiB |
After Width: | Height: | Size: 45 KiB |