@ -0,0 +1,48 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Bulk Order Management |
||||
|
===================== |
||||
|
Create Manufacturing Orders, Purchase Orders and Sales Orders in Bulk. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configuration is needed. |
||||
|
|
||||
|
Company |
||||
|
_______ |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Lesser General Public License, Version 3 (LGPL v3) |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
_______ |
||||
|
* Developers: (V17) Vishnu P, |
||||
|
(V18) Aysha Shalin |
||||
|
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) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
@ -0,0 +1,46 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'Bulk Order Management', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Sales,Purchases,Manufacturing', |
||||
|
'summary': """Create Manufacturing Orders, Purchase Orders and Sales Orders |
||||
|
in Bulk.""", |
||||
|
'description': """This module simplifies Odoo by allowing users to create |
||||
|
Sale, Purchase, and Manufacturing Orders all at once from a single app, |
||||
|
saving time and reducing complexity.""", |
||||
|
'author': "Cybrosys Techno Solutions", |
||||
|
'company': "Cybrosys Techno Solutions", |
||||
|
'maintainer': "Cybrosys Techno Solutions", |
||||
|
'website': "https://cybrosys.com", |
||||
|
'depends': ['sale_management', 'purchase', 'mrp'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'data/ir_sequence_data.xml', |
||||
|
'views/create_bulk_order_views.xml' |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': True, |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Sequence for the Bulk order management record - Sale Order --> |
||||
|
<record id="bulk_order_create_seq_so" model="ir.sequence"> |
||||
|
<field name="name">Create Bulk Sale Order</field> |
||||
|
<field name="code">create.bulk.so.order</field> |
||||
|
<field name="prefix">BLK/SO/%(year)s/%(month)s/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
</record> |
||||
|
<!-- Sequence for the Bulk order management record - Purchase Order --> |
||||
|
<record id="bulk_order_create_seq_po" model="ir.sequence"> |
||||
|
<field name="name">Create Bulk Purchase Order</field> |
||||
|
<field name="code">create.bulk.po.order</field> |
||||
|
<field name="prefix">BLK/PO/%(year)s/%(month)s/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
</record> |
||||
|
<!-- Sequence for the Bulk order management record - Manufacturing Order --> |
||||
|
<record id="bulk_order_create_seq_mo" model="ir.sequence"> |
||||
|
<field name="name">Create Bulk Manufacturing Order</field> |
||||
|
<field name="code">create.bulk.mo.order</field> |
||||
|
<field name="prefix">BLK/MO/%(year)s/%(month)s/</field> |
||||
|
<field name="padding">5</field> |
||||
|
<field name="number_increment">1</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,6 @@ |
|||||
|
## Module <bulk_create_mo_so_po> |
||||
|
|
||||
|
#### 09.04.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial Commit for Bulk Order Management |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import create_bulk_order |
||||
|
from . import manufacturing_order |
||||
|
from . import purchase_order |
||||
|
from . import sale_order |
@ -0,0 +1,238 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models, _ |
||||
|
from odoo.exceptions import UserError, ValidationError |
||||
|
|
||||
|
|
||||
|
class CreateBulkOrder(models.Model): |
||||
|
"""Creates the model create.bulk.order""" |
||||
|
_name = 'create.bulk.order' |
||||
|
_description = 'Create Bulk Order' |
||||
|
_inherit = ['mail.thread', 'mail.activity.mixin'] |
||||
|
|
||||
|
name = fields.Char(string='Name', readonly=True, default='New', copy=False, |
||||
|
tracking=True, help="Name of the bulk order") |
||||
|
partner_id = fields.Many2one('res.partner', |
||||
|
string='Customer', required=True, |
||||
|
help="Customer of the bulk order") |
||||
|
date = fields.Datetime(string='Date', default=fields.Datetime.now, |
||||
|
tracking=True, help="Date of the bulk order") |
||||
|
bulk_order_line_ids = fields.One2many('bulk.order.line', |
||||
|
'order_id', |
||||
|
string='Bulk Order Lines', |
||||
|
required=True, |
||||
|
help="Bulk orders in the bulk order") |
||||
|
order_type = fields.Selection( |
||||
|
[('sale', 'Sale Order'), ('purchase', 'Purchase Order'), |
||||
|
('manufacturing', 'Manufacturing Order')], string='Order Type', |
||||
|
default='sale', help="Order Type of the order") |
||||
|
state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm'), |
||||
|
('order_confirm', 'Order Created'), |
||||
|
('done', 'Done'), ('cancel', 'Cancel')], |
||||
|
string='State', default='draft', tracking=True, |
||||
|
help="State of the Bulk Order") |
||||
|
sale_order_ids = fields.One2many('sale.order', |
||||
|
'bulk_order_id', |
||||
|
string='Sale Orders', |
||||
|
help="Sale Orders linked to this bulk order") |
||||
|
purchase_order_ids = fields.One2many('purchase.order', |
||||
|
'bulk_order_id', |
||||
|
string='Purchase Orders', |
||||
|
help="Purchase Orders linked to this " |
||||
|
"bulk order") |
||||
|
manufacturing_order_ids = fields.One2many('mrp.production', |
||||
|
'bulk_order_id', |
||||
|
string='Manufacturing Orders', |
||||
|
help="Manufacturing Orders linked" |
||||
|
" to this bulk order") |
||||
|
sale_order_count = fields.Integer(string='Sale Order Count', |
||||
|
compute='_compute_sale_order_count', |
||||
|
help="Count of the sale order linked to " |
||||
|
"this bulk order") |
||||
|
purchase_order_count = fields.Integer(string='Purchase Order Count', |
||||
|
compute='_compute_purchase_order_count', |
||||
|
help="Count of the purchase order " |
||||
|
"linked to this bulk order") |
||||
|
manufacturing_order_count = fields.Integer( |
||||
|
string='Manufacturing Order Count', |
||||
|
compute='_compute_manufacturing_order_count', |
||||
|
help="Count of the manufacturing order linked to this bulk order") |
||||
|
|
||||
|
def action_confirm(self): |
||||
|
"""Method action_confirm to confirm the bulk order""" |
||||
|
for rec in self: |
||||
|
if not rec.name or rec.name == 'New': |
||||
|
if rec.order_type == 'sale': |
||||
|
rec.name = self.env['ir.sequence'].next_by_code( |
||||
|
'create.bulk.so.order') |
||||
|
elif rec.order_type == 'purchase': |
||||
|
rec.name = self.env['ir.sequence'].next_by_code( |
||||
|
'create.bulk.po.order') |
||||
|
elif rec.order_type == 'manufacturing': |
||||
|
rec.name = self.env['ir.sequence'].next_by_code( |
||||
|
'create.bulk.mo.order') |
||||
|
if not rec.bulk_order_line_ids: |
||||
|
raise UserError(_('Please add at least one product.')) |
||||
|
rec.state = 'confirm' |
||||
|
|
||||
|
def action_create_sale_order(self): |
||||
|
"""Method action_create_sale_order to create sale order from the bulk |
||||
|
order""" |
||||
|
for rec in self: |
||||
|
if not rec.partner_id: |
||||
|
raise UserError(_('Please select a customer.')) |
||||
|
order_line = [] |
||||
|
for line in rec.bulk_order_line_ids: |
||||
|
order_line.append((0, 0, { |
||||
|
'name': line.product_id.name, |
||||
|
'product_id': line.product_id.id, |
||||
|
'product_uom_qty': line.qty, |
||||
|
'price_unit': line.list_price, |
||||
|
})) |
||||
|
self.env['sale.order'].create({ |
||||
|
'partner_id': rec.partner_id.id, |
||||
|
'order_line': order_line, |
||||
|
'bulk_order_id': rec.id, |
||||
|
}) |
||||
|
rec.state = 'done' |
||||
|
|
||||
|
def action_create_purchase_order(self): |
||||
|
"""Method action_create_purchase_order to create the purchase order |
||||
|
from the bulk order""" |
||||
|
for rec in self: |
||||
|
if not rec.partner_id: |
||||
|
raise UserError(_('Please select a vendor.')) |
||||
|
order_line = [] |
||||
|
for line in rec.bulk_order_line_ids: |
||||
|
order_line.append((0, 0, { |
||||
|
'product_id': line.product_id.id, |
||||
|
'product_qty': line.qty, |
||||
|
'name': line.product_id.name, |
||||
|
'price_unit': line.product_cost, |
||||
|
})) |
||||
|
self.env['purchase.order'].create({ |
||||
|
'partner_id': rec.partner_id.id, |
||||
|
'order_line': order_line, |
||||
|
'bulk_order_id': rec.id, |
||||
|
}) |
||||
|
rec.state = 'done' |
||||
|
|
||||
|
def action_create_manufacturing_order(self): |
||||
|
"""Method action_create_manufacturing_order to create the |
||||
|
manufacturing order from the bulk order""" |
||||
|
for rec in self: |
||||
|
for line in rec.bulk_order_line_ids: |
||||
|
if not line.bom_id: |
||||
|
raise ValidationError( |
||||
|
_(f"There are no BOM for the product " |
||||
|
f"variant {line.product_id.name}, please create one " |
||||
|
f"BOM to create Manufacturing Order.")) |
||||
|
self.env['mrp.production'].create({ |
||||
|
'product_id': line.product_id.id, |
||||
|
'product_qty': line.qty, |
||||
|
'bom_id': line.bom_id.id, |
||||
|
'product_uom_id': line.product_id.uom_id.id, |
||||
|
'bulk_order_id': rec.id, |
||||
|
}) |
||||
|
rec.state = 'done' |
||||
|
|
||||
|
def action_reset_to_draft(self): |
||||
|
"""Method action_reset_to_draft to reset the bulk order into draft |
||||
|
state""" |
||||
|
for rec in self: |
||||
|
rec.state = 'draft' |
||||
|
|
||||
|
def _compute_sale_order_count(self): |
||||
|
"""Method _compute_sale_order_count to compute the sale order count""" |
||||
|
for rec in self: |
||||
|
rec.sale_order_count = len(rec.sale_order_ids) |
||||
|
|
||||
|
def _compute_purchase_order_count(self): |
||||
|
"""Method _compute_purchase_order_count to compute the purchase order |
||||
|
count""" |
||||
|
for rec in self: |
||||
|
rec.purchase_order_count = len(rec.purchase_order_ids) |
||||
|
|
||||
|
def _compute_manufacturing_order_count(self): |
||||
|
"""Method _compute_manufacturing_order_count to compute the |
||||
|
manufacturing order counts""" |
||||
|
for rec in self: |
||||
|
rec.manufacturing_order_count = len(rec.manufacturing_order_ids) |
||||
|
|
||||
|
def get_sale_order(self): |
||||
|
"""Method get_sale_order to get the sale orders linked to the bulk |
||||
|
order""" |
||||
|
for rec in self: |
||||
|
action = self.env.ref('sale.action_orders').read()[0] |
||||
|
action['domain'] = [('bulk_order_id', '=', rec.id)] |
||||
|
return action |
||||
|
|
||||
|
def get_purchase_order(self): |
||||
|
"""Method get_purchase_order to get the purchase orders linked to the |
||||
|
bulk order""" |
||||
|
for rec in self: |
||||
|
action = self.env.ref('purchase.purchase_rfq').read()[0] |
||||
|
action['domain'] = [('bulk_order_id', '=', rec.id)] |
||||
|
return action |
||||
|
|
||||
|
def get_manufacturing_order(self): |
||||
|
"""Method get_manufacturing_order to get the manufacturing orders |
||||
|
linked to the bulk order""" |
||||
|
for rec in self: |
||||
|
action = self.env.ref('mrp.mrp_production_action').read()[0] |
||||
|
action['domain'] = [('bulk_order_id', '=', rec.id)] |
||||
|
return action |
||||
|
|
||||
|
|
||||
|
class BulkOrderLine(models.Model): |
||||
|
"""Creates the model bulk.order.line""" |
||||
|
_name = 'bulk.order.line' |
||||
|
|
||||
|
name = fields.Char(string='Name', help="Name of the order line") |
||||
|
product_id = fields.Many2one('product.product', string='Product', |
||||
|
required=True, |
||||
|
help="Product in the order line") |
||||
|
qty = fields.Float(string='Quantity', required=True, |
||||
|
help="Quantity of the product", default=1) |
||||
|
order_id = fields.Many2one('create.bulk.order', string='Order', |
||||
|
help="Bulk order") |
||||
|
list_price = fields.Float(string='Price', help="Price of the product") |
||||
|
product_cost = fields.Float(string='Cost', help="Cost of the product") |
||||
|
bom_id = fields.Many2one('mrp.bom', string="Bill of Material", |
||||
|
help="Bill of Material for this product", |
||||
|
domain="[('product_id', '=', product_id)]") |
||||
|
|
||||
|
@api.onchange('product_id') |
||||
|
def _onchange_product_id(self): |
||||
|
if self.product_id: |
||||
|
self.list_price = self.product_id.list_price |
||||
|
self.product_cost = self.product_id.standard_price |
||||
|
else: |
||||
|
self.list_price = 0 |
||||
|
self.product_cost = 0 |
||||
|
|
||||
|
@api.onchange('bom_id') |
||||
|
def _onchange_bom_id(self): |
||||
|
if self.bom_id: |
||||
|
self.product_id = self.bom_id.product_tmpl_id.product_variant_id.id |
||||
|
else: |
||||
|
self.product_id = False |
@ -0,0 +1,31 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ManufacturingOrder(models.Model): |
||||
|
"""Inherits the model mrp.production to add the field bulk_order_id""" |
||||
|
_inherit = 'mrp.production' |
||||
|
|
||||
|
bulk_order_id = fields.Many2one('create.bulk.order', |
||||
|
string='Bulk Order', |
||||
|
help="Bulk order linked to this MRP Order") |
@ -0,0 +1,32 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class PurchaseOrder(models.Model): |
||||
|
"""Inherits the model purchase.order to add the field bulk_order_id""" |
||||
|
_inherit = 'purchase.order' |
||||
|
|
||||
|
bulk_order_id = fields.Many2one('create.bulk.order', |
||||
|
string='Bulk Order', |
||||
|
help="Bulk order linked to this purchase " |
||||
|
"order") |
@ -0,0 +1,31 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class SaleOrder(models.Model): |
||||
|
"""Inherits the model sale.order to add the field bulk_order_id""" |
||||
|
_inherit = 'sale.order' |
||||
|
|
||||
|
bulk_order_id = fields.Many2one('create.bulk.order', |
||||
|
string='Bulk Order', |
||||
|
help="Bulk order linked to this sale order") |
|
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: 92 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 395 KiB |
After Width: | Height: | Size: 734 KiB |
After Width: | Height: | Size: 45 KiB |
@ -0,0 +1,117 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Form view for the Bulk order management --> |
||||
|
<record id="create_bulk_order_view_form" model="ir.ui.view"> |
||||
|
<field name="name">create.bulk.order.view.form</field> |
||||
|
<field name="model">create.bulk.order</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Create Bulk Order"> |
||||
|
<header> |
||||
|
<button name="action_confirm" type="object" |
||||
|
string="Confirm" class="oe_highlight" |
||||
|
invisible="state != 'draft'"/> |
||||
|
<button name="action_create_sale_order" type="object" |
||||
|
string="Create Sale Order" |
||||
|
invisible="state != 'confirm' or order_type != 'sale'"/> |
||||
|
<button name="action_create_purchase_order" type="object" |
||||
|
string="Create Purchase Order" |
||||
|
invisible="state != 'confirm' or order_type != 'purchase'"/> |
||||
|
<button name="action_create_manufacturing_order" |
||||
|
type="object" |
||||
|
string="Create Manufacturing Order" |
||||
|
invisible="state != 'confirm' or order_type != 'manufacturing'"/> |
||||
|
<button name="action_reset_to_draft" type="object" |
||||
|
string="Reset to Draft" |
||||
|
invisible="state != 'confirm'"/> |
||||
|
<field name="state" widget="statusbar" |
||||
|
statusbar_visible="draft,confirm,done"/> |
||||
|
</header> |
||||
|
<sheet> |
||||
|
<div class="oe_button_box" name="button_box"> |
||||
|
<button name="get_sale_order" type="object" |
||||
|
class="oe_stat_button" icon="fa-shopping-cart" |
||||
|
invisible="state != 'done' or sale_order_count == 0 "> |
||||
|
<field name="sale_order_count" widget="statinfo" |
||||
|
string="Sale Orders"/> |
||||
|
</button> |
||||
|
<button name="get_purchase_order" type="object" |
||||
|
class="oe_stat_button" icon="fa-truck" |
||||
|
invisible="state != 'done' or purchase_order_count == 0"> |
||||
|
<field name="purchase_order_count" widget="statinfo" |
||||
|
string="Purchase Orders"/> |
||||
|
</button> |
||||
|
<button name="get_manufacturing_order" type="object" |
||||
|
class="oe_stat_button" icon="fa-cogs" |
||||
|
invisible="state != 'done' or manufacturing_order_count == 0"> |
||||
|
<field name="manufacturing_order_count" |
||||
|
widget="statinfo" |
||||
|
string="Manufacturing Orders"/> |
||||
|
</button> |
||||
|
</div> |
||||
|
<div class="oe_title"> |
||||
|
<h1> |
||||
|
<field name="name"/> |
||||
|
</h1> |
||||
|
</div> |
||||
|
<group readonly="state != 'draft'"> |
||||
|
<field name="partner_id" |
||||
|
readonly="state != 'draft'"/> |
||||
|
<field name="date" |
||||
|
readonly="state != 'draft'"/> |
||||
|
<field name="order_type" |
||||
|
readonly="state != 'draft'"/> |
||||
|
</group> |
||||
|
<notebook> |
||||
|
<page string="Order Lines"> |
||||
|
<field name="bulk_order_line_ids" |
||||
|
readonly="state != 'draft'"> |
||||
|
<list editable="bottom"> |
||||
|
<field name="product_id"/> |
||||
|
<field name="bom_id" |
||||
|
column_invisible="parent.order_type != 'manufacturing'"/> |
||||
|
<field name="list_price" |
||||
|
column_invisible="parent.order_type != 'sale'"/> |
||||
|
<field name="product_cost" |
||||
|
column_invisible="parent.order_type != 'purchase'"/> |
||||
|
<field name="qty"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
</page> |
||||
|
</notebook> |
||||
|
</sheet> |
||||
|
<chatter/> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Tree view for the Bulk order management --> |
||||
|
<record id="create_bulk_order_view_list" model="ir.ui.view"> |
||||
|
<field name="name">create.bulk.order.view.list</field> |
||||
|
<field name="model">create.bulk.order</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<list string="Create Bulk Order" sample="1"> |
||||
|
<field name="name"/> |
||||
|
<field name="partner_id"/> |
||||
|
<field name="order_type"/> |
||||
|
<field name="date"/> |
||||
|
<field name="state"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- Action for the Bulk order management --> |
||||
|
<record id="bulk_order_create_action" model="ir.actions.act_window"> |
||||
|
<field name="name">Create Bulk Order</field> |
||||
|
<field name="res_model">create.bulk.order</field> |
||||
|
<field name="view_mode">list,form</field> |
||||
|
<field name="view_id" ref="create_bulk_order_view_list"/> |
||||
|
</record> |
||||
|
<!-- Menu for the Bulk order management --> |
||||
|
<menuitem id="bulk_order_create_menu" name="Bulk Order Management" |
||||
|
web_icon="bulk_create_mo_so_po,static/description/icon.png"/> |
||||
|
<!-- Menu for the Bulk order management Orders --> |
||||
|
<menuitem id="bulk_order_create_menu_orders" name="Orders" |
||||
|
parent="bulk_order_create_menu"/> |
||||
|
<!-- Menu for the Bulk order management All Orders --> |
||||
|
<menuitem id="bulk_order_create_menu_all_orders" name="All Orders" |
||||
|
parent="bulk_order_create_menu_orders" |
||||
|
action="bulk_order_create_action"/> |
||||
|
</odoo> |