@ -0,0 +1,49 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Laundry Management |
|||
=================== |
|||
Laundry Management |
|||
|
|||
Configuration |
|||
=============== |
|||
For every user set the Laundry User group. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V18) Ammu Raj, Ayana kp, |
|||
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,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 |
|||
from . import reports |
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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': 'Laundry Management', |
|||
'version': '18.0.1.0.0', |
|||
"category": "Industries", |
|||
'summary': """Complete Laundry Service Management""", |
|||
'description': 'This module is very useful to manage all process of laundry' |
|||
'service', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['sale_management', 'account', ], |
|||
'data': [ |
|||
'data/laundry_management_data.xml', |
|||
'data/ir_sequenca_data.xml', |
|||
'security/laundry_management_security.xml', |
|||
'security/ir.model.access.csv', |
|||
'views/laundry_order_views.xml', |
|||
'views/washing_washing_views.xml', |
|||
'views/washing_type_views.xml', |
|||
'views/report_laundry_order_views.xml', |
|||
'views/washing_work_views.xml', |
|||
'views/label_templates.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': True, |
|||
} |
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<record id="ir_sequence_laundry" model="ir.sequence"> |
|||
<field name="name">Laundry Order Code</field> |
|||
<field name="code">laundry.order</field> |
|||
<field eval="4" name="padding"/> |
|||
<field name="prefix">LO</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!--Demo service product--> |
|||
<odoo> |
|||
<record id="product_product_laundry_service" model="product.product"> |
|||
<field name="name">Laundry Service</field> |
|||
<field name="type">service</field> |
|||
<field name="invoice_policy">order</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,7 @@ |
|||
## Module <laundry_management> |
|||
|
|||
#### 04.11.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial commit for Laundry Management |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 laundry_order |
|||
from . import sale_advance_payment |
|||
from . import washing_type |
|||
from . import washing_washing |
|||
from . import washing_work |
@ -0,0 +1,264 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 datetime import datetime |
|||
from odoo import api, Command, fields, models, _ |
|||
|
|||
|
|||
class LaundryOrder(models.Model): |
|||
"""laundry orders generating model""" |
|||
_name = 'laundry.order' |
|||
_inherit = 'mail.thread' |
|||
_description = "Laundry Order" |
|||
_order = 'order_date desc, id desc' |
|||
|
|||
name = fields.Char(string="Label", copy=False, help="Name of the record") |
|||
sale_id = fields.Many2one('sale.order', |
|||
help="sequence name of sale order") |
|||
invoice_status = fields.Selection(string='Invoice Status', related='sale_id.invoice_status', |
|||
store=True, help="Status of invoice") |
|||
invoice_count = fields.Integer(compute='_compute_invoice_count', |
|||
string='#Invoice', |
|||
help="Number of invoice count") |
|||
work_count = fields.Integer(compute='_compute_work_count', string='# Works', |
|||
help="Number of work count") |
|||
partner_id = fields.Many2one('res.partner', string='Customer', |
|||
readonly=True, |
|||
required=True, |
|||
change_default=True, index=True, |
|||
help="Name of customer" |
|||
) |
|||
partner_invoice_id = fields.Many2one('res.partner', |
|||
string='Invoice Address', |
|||
readonly=True, required=True, |
|||
help="Invoice address for current" |
|||
"sales order.") |
|||
partner_shipping_id = fields.Many2one('res.partner', |
|||
string='Delivery Address', |
|||
readonly=True, required=True, |
|||
help="Delivery address for current" |
|||
"sales order.") |
|||
order_date = fields.Datetime(string='Date', readonly=True, index=True, |
|||
copy=False, default=fields.Datetime.now, |
|||
help="Date of order") |
|||
laundry_person_id = fields.Many2one('res.users', string='Laundry Person', |
|||
required=True, |
|||
help="Name of laundry person") |
|||
order_line_ids = fields.One2many('laundry.order.line', 'laundry_id', |
|||
required=True, ondelete='cascade', |
|||
help="Order lines of laundry orders") |
|||
total_amount = fields.Float(compute='_compute_total_amount', string='Total', |
|||
store=True, |
|||
help="To get the Total amount") |
|||
currency_id = fields.Many2one("res.currency", string="Currency", |
|||
help="Name of currency") |
|||
note = fields.Text(string='Terms and conditions', |
|||
help='Add terms and conditions') |
|||
state = fields.Selection([ |
|||
('draft', 'Draft'), |
|||
('order', 'Laundry Order'), |
|||
('process', 'Processing'), |
|||
('done', 'Done'), |
|||
('return', 'Returned'), |
|||
('cancel', 'Cancelled'), |
|||
], string='Status', readonly=True, copy=False, index=True, |
|||
track_visibility='onchange', default='draft', help="State of the Order") |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals_list): |
|||
"""Creating the record of Laundry order.""" |
|||
for vals in vals_list: |
|||
vals['name'] = self.env['ir.sequence'].next_by_code('laundry.order') |
|||
return super().create(vals_list) |
|||
|
|||
@api.depends('order_line_ids') |
|||
def _compute_total_amount(self): |
|||
"""Computing the total of total_amount in order lines.""" |
|||
total = 0 |
|||
for order in self: |
|||
for line in order.order_line_ids: |
|||
total += line.amount |
|||
order.total_amount = total |
|||
|
|||
def confirm_order(self): |
|||
"""Confirming the order and after confirming order,it will create the |
|||
washing model""" |
|||
self.state = 'order' |
|||
product_id = self.env.ref( |
|||
'laundry_management.product_product_laundry_service') |
|||
self.sale_id = self.env['sale.order'].create( |
|||
{'partner_id': self.partner_id.id, |
|||
'partner_invoice_id': self.partner_invoice_id.id, |
|||
'partner_shipping_id': self.partner_shipping_id.id, |
|||
'user_id': self.laundry_person_id.id, |
|||
'order_line': [Command.create({'product_id': product_id.id, |
|||
'name': 'Laundry Service', |
|||
'price_unit': self.total_amount, |
|||
})] |
|||
}) |
|||
for order in self: |
|||
for line in order.order_line_ids: |
|||
self.env['washing.washing'].create( |
|||
{'name': line.product_id.name + '-Washing', |
|||
'user_id': line.washing_type_id.assigned_person_id.id, |
|||
'description': line.description, |
|||
'laundry_id': line.id, |
|||
'state': 'draft', |
|||
'washing_date': datetime.now().strftime( |
|||
'%Y-%m-%d %H:%M:%S')}) |
|||
|
|||
def action_create_invoice(self): |
|||
"""Creating a new invoice for the laundry orders.""" |
|||
if self.sale_id.state in ['draft', 'sent']: |
|||
self.sale_id.action_confirm() |
|||
self.invoice_status = self.sale_id.invoice_status |
|||
return { |
|||
'name': 'Create Invoice', |
|||
'view_type': 'form', |
|||
'view_mode': 'form', |
|||
'res_model': 'sale.advance.payment.inv', |
|||
'type': 'ir.actions.act_window', |
|||
'context': {'laundry_sale_id': self.sale_id.id}, |
|||
'target': 'new' |
|||
} |
|||
|
|||
def action_return_dress(self): |
|||
"""Return dress after laundry""" |
|||
self.state = 'return' |
|||
|
|||
def action_cancel_order(self): |
|||
"""Cancel the laundry order""" |
|||
self.state = 'cancel' |
|||
|
|||
def _compute_invoice_count(self): |
|||
"""Compute the invoice count.""" |
|||
for order in self: |
|||
order.invoice_count = len(order.env['account.move'].search( |
|||
[('invoice_origin', '=', order.sale_id.name)])) |
|||
|
|||
def _compute_work_count(self): |
|||
"""Computing the work count""" |
|||
if self.id: |
|||
wrk_ordr_ids = self.env['washing.washing'].search( |
|||
[('laundry_id.laundry_id.id', '=', self.id)]) |
|||
self.work_count = len(wrk_ordr_ids) |
|||
else: |
|||
self.work_count = False |
|||
|
|||
def action_view_laundry_works(self): |
|||
"""Function for viewing the laundry works.""" |
|||
work_obj = self.env['washing.washing'].search( |
|||
[('laundry_id.laundry_id.id', '=', self.id)]) |
|||
work_ids = [] |
|||
for each in work_obj: |
|||
work_ids.append(each.id) |
|||
view_id = self.env.ref('laundry_management.washing_washing_view_form').id |
|||
if work_ids: |
|||
if len(work_ids) <= 1: |
|||
value = { |
|||
'view_type': 'form', |
|||
'view_mode': 'form', |
|||
'res_model': 'washing.washing', |
|||
'view_id': view_id, |
|||
'type': 'ir.actions.act_window', |
|||
'name': _('Works'), |
|||
'res_id': work_ids and work_ids[0] |
|||
} |
|||
else: |
|||
value = { |
|||
'domain': str([('id', 'in', work_ids)]), |
|||
'view_type': 'form', |
|||
'view_mode': 'list,form', |
|||
'res_model': 'washing.washing', |
|||
'view_id': False, |
|||
'type': 'ir.actions.act_window', |
|||
'name': _('Works'), |
|||
} |
|||
return value |
|||
|
|||
def action_view_invoice(self): |
|||
"""Function for viewing Laundry orders invoices.""" |
|||
self.ensure_one() |
|||
inv_ids = [] |
|||
for each in self.env['account.move'].search( |
|||
[('invoice_origin', '=', self.sale_id.name)]): |
|||
inv_ids.append(each.id) |
|||
if inv_ids: |
|||
if len(inv_ids) <= 1: |
|||
value = { |
|||
'view_type': 'form', |
|||
'view_mode': 'form', |
|||
'res_model': 'account.move', |
|||
'view_id': self.env.ref('account.view_move_form').id, |
|||
'type': 'ir.actions.act_window', |
|||
'name': _('Invoice'), |
|||
'res_id': inv_ids and inv_ids[0] |
|||
} |
|||
else: |
|||
value = { |
|||
'domain': str([('id', 'in', inv_ids)]), |
|||
'view_type': 'form', |
|||
'view_mode': 'list,form', |
|||
'res_model': 'account.move', |
|||
'view_id': False, |
|||
'type': 'ir.actions.act_window', |
|||
'name': _('Invoice'), |
|||
} |
|||
return value |
|||
|
|||
|
|||
class LaundryOrderLine(models.Model): |
|||
"""Laundry order lines generating model""" |
|||
_name = 'laundry.order.line' |
|||
_description = "Laundry Order Line" |
|||
|
|||
product_id = fields.Many2one('product.product', string='Dress', |
|||
required=True, help="Name of the product") |
|||
qty = fields.Integer(string='No of items', required=True, |
|||
help="Number of quantity") |
|||
description = fields.Text(string='Description', |
|||
help='Description of the line.') |
|||
washing_type_id = fields.Many2one('washing.type', string='Washing Type', |
|||
required=True, |
|||
help='Select the type of wash') |
|||
extra_work_ids = fields.Many2many('washing.work', string='Extra Work', |
|||
help='Add if any extra works') |
|||
amount = fields.Float(compute='_compute_amount', string='Amount', |
|||
help='Total amount of the line.') |
|||
laundry_id = fields.Many2one('laundry.order', string='Laundry Order', |
|||
help='Corresponding laundry order') |
|||
state = fields.Selection([ |
|||
('draft', 'Draft'), |
|||
('wash', 'Washing'), |
|||
('extra_work', 'Make Over'), |
|||
('done', 'Done'), |
|||
('cancel', 'Cancelled'), |
|||
], string='Status of the line', readonly=True, copy=False, index=True, |
|||
default='draft') |
|||
|
|||
@api.depends('washing_type_id', 'extra_work_ids', 'qty') |
|||
def _compute_amount(self): |
|||
"""Compute the total amount""" |
|||
for line in self: |
|||
total = line.washing_type_id.amount * line.qty |
|||
for each in line.extra_work_ids: |
|||
total += each.amount * line.qty |
|||
line.amount = total |
@ -0,0 +1,139 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 time |
|||
from odoo import models, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class SaleAdvancePaymentInv(models.TransientModel): |
|||
"""Inheriting the model of sale.advance.payment.inv to generate advance |
|||
payment of invoice""" |
|||
_inherit = 'sale.advance.payment.inv' |
|||
|
|||
def create_invoices(self): |
|||
"""Function for creating invoices for the advance payment.""" |
|||
laundry_sale_id = self._context.get('laundry_sale_id') |
|||
sale_order = self.env['sale.order'] |
|||
if laundry_sale_id: |
|||
sale_orders = sale_order.browse(laundry_sale_id) |
|||
else: |
|||
sale_orders = sale_order.browse( |
|||
self._context.get('active_ids', [])) |
|||
if self.advance_payment_method == 'delivered': |
|||
sale_orders._create_invoices() |
|||
elif self.advance_payment_method == 'all': |
|||
sale_orders._create_invoices()(final=True) |
|||
else: |
|||
# Create deposit product if necessary |
|||
if not self.product_id: |
|||
vals = self._prepare_deposit_product() |
|||
self.product_id = self.env['product.product'].create(vals) |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'sale.default_deposit_product_id', self.product_id.id) |
|||
for order in sale_orders: |
|||
if self.advance_payment_method == 'percentage': |
|||
amount = order.amount_untaxed * self.amount / 100 |
|||
else: |
|||
amount = self.amount |
|||
if self.product_id.invoice_policy != 'order': |
|||
raise UserError(_( |
|||
'The product used to invoice a down payment should have' |
|||
' an invoice policy set to "Ordered' |
|||
' quantities". Please update your deposit product to be' |
|||
' able to create a deposit invoice.')) |
|||
if self.product_id.type != 'service': |
|||
raise UserError(_( |
|||
"The product used to invoice a down payment should be" |
|||
" of type 'Service'. Please use another " |
|||
"product or update this product.")) |
|||
taxes = self.product_id.taxes_id.filtered( |
|||
lambda |
|||
r: not order.company_id or r.company_id == |
|||
order.company_id) |
|||
if order.fiscal_position_id and taxes: |
|||
tax_ids = order.fiscal_position_id.map_tax(taxes).ids |
|||
else: |
|||
tax_ids = taxes.ids |
|||
so_line = self.env['sale.order.line'].create({ |
|||
'name': _('Advance: %s') % (time.strftime('%m %Y'),), |
|||
'price_unit': amount, |
|||
'product_uom_qty': 0.0, |
|||
'order_id': order.id, |
|||
'discount': 0.0, |
|||
'product_uom': self.product_id.uom_id.id, |
|||
'product_id': self.product_id.id, |
|||
'tax_id': [(6, 0, tax_ids)], |
|||
}) |
|||
self._create_invoice(order, so_line, amount) |
|||
if self._context.get('open_invoices', False): |
|||
return sale_orders.action_view_invoice() |
|||
return {'type': 'ir.actions.act_window_close'} |
|||
|
|||
def _create_invoice(self, order, so_line): |
|||
"""Function for creating invoice""" |
|||
if (self.advance_payment_method == 'percentage' and |
|||
self.amount <= 0.00) or (self.advance_payment_method == 'fixed' and |
|||
self.fixed_amount <= 0.00): |
|||
raise UserError( |
|||
_('The value of the down payment amount must be positive.')) |
|||
if self.advance_payment_method == 'percentage': |
|||
amount = order.amount_untaxed * self.amount / 100 |
|||
name = _("Down payment of %s%%") % (self.amount,) |
|||
else: |
|||
amount = self.fixed_amount |
|||
name = _('Down Payment') |
|||
|
|||
invoice_vals = { |
|||
'move_type': 'out_invoice', |
|||
'invoice_origin': order.name, |
|||
'invoice_user_id': order.user_id.id, |
|||
'narration': order.note, |
|||
'partner_id': order.partner_invoice_id.id, |
|||
'fiscal_position_id': order.fiscal_position_id.id or order. |
|||
partner_id.property_account_position_id.id, |
|||
'partner_shipping_id': order.partner_shipping_id.id, |
|||
'currency_id': order.pricelist_id.currency_id.id, |
|||
'ref': order.client_order_ref, |
|||
'invoice_payment_term_id': order.payment_term_id.id, |
|||
'team_id': order.team_id.id, |
|||
'campaign_id': order.campaign_id.id, |
|||
'medium_id': order.medium_id.id, |
|||
'source_id': order.source_id.id, |
|||
'invoice_line_ids': [(0, 0, { |
|||
'name': name, |
|||
'price_unit': amount, |
|||
'quantity': 1.0, |
|||
'product_id': self.product_id.id, |
|||
'product_uom_id': so_line.product_uom.id, |
|||
'sale_line_ids': [(6, 0, [so_line.id])], |
|||
'analytic_tag_ids': [(6, 0, so_line.analytic_tag_ids.ids)], |
|||
'analytic_account_id': order.analytic_account_id.id or False, |
|||
})], |
|||
} |
|||
if order.fiscal_position_id: |
|||
invoice_vals['fiscal_position_id'] = order.fiscal_position_id.id |
|||
invoice = self.env['account.move'].create(invoice_vals) |
|||
invoice.message_post_with_view('mail.message_origin_link', |
|||
values={'self': invoice, |
|||
'origin': order}, |
|||
subtype_id=self.env.ref( |
|||
'mail.mt_note').id) |
@ -0,0 +1,37 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 WashingType(models.Model): |
|||
"""Washing types generating model""" |
|||
_name = 'washing.type' |
|||
_description = "Washing TYpe" |
|||
|
|||
name = fields.Char(string='Name', required=True, |
|||
help='Name of Washing type.') |
|||
assigned_person_id = fields.Many2one('res.users', |
|||
string='Assigned Person', |
|||
required=True, |
|||
help="Name of assigned person") |
|||
amount = fields.Float(string='Service Charge', required=True, |
|||
help='Service charge of this type') |
@ -0,0 +1,141 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 datetime import datetime |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class WashingWashing(models.Model): |
|||
"""Washing activity generating model""" |
|||
_name = 'washing.washing' |
|||
_description = 'Washing Washing' |
|||
|
|||
name = fields.Char(string='Work', help='Mention the work') |
|||
laundry_works = fields.Boolean(default=False, help='For set conditions') |
|||
user_id = fields.Many2one('res.users', |
|||
string='Assigned Person', |
|||
help="Name of assigned person") |
|||
washing_date = fields.Datetime(string='Date', help="Date of washing") |
|||
description = fields.Text(string='Description', |
|||
help='Add the description') |
|||
state = fields.Selection([ |
|||
('draft', 'Draft'), |
|||
('process', 'Process'), |
|||
('done', 'Done'), |
|||
('cancel', 'Cancelled'), |
|||
], string='Status', readonly=True, copy=False, index=True, default='draft', |
|||
help='State of wash') |
|||
laundry_id = fields.Many2one('laundry.order.line') |
|||
product_line_ids = fields.One2many('wash.order.line', 'wash_id', |
|||
string='Products', ondelete='cascade', |
|||
help='Related Products for wash.') |
|||
total_amount = fields.Float(compute='_compute_total_amount', |
|||
string='Grand Total') |
|||
|
|||
def start_wash(self): |
|||
"""Function for initiating the activity of washing.""" |
|||
if not self.laundry_works: |
|||
self.laundry_id.state = 'wash' |
|||
self.laundry_id.laundry_id.state = 'process' |
|||
for wash in self: |
|||
for line in wash.product_line_ids: |
|||
self.env['sale.order.line'].create( |
|||
{'product_id': line.product_id.id, |
|||
'name': line.name, |
|||
'price_unit': line.price_unit, |
|||
'order_id': wash.laundry_id.laundry_id.sale_id.id, |
|||
'product_uom_qty': line.quantity, |
|||
'product_uom': line.uom_id.id, |
|||
}) |
|||
self.state = 'process' |
|||
|
|||
def action_set_to_done(self): |
|||
"""Function for set to done.""" |
|||
self.state = 'done' |
|||
f = 0 |
|||
if not self.laundry_works: |
|||
if self.laundry_id.extra_work_ids: |
|||
for each in self.laundry_id.extra_work_ids: |
|||
self.create({'name': each.name, |
|||
'user_id': each.assigned_person_id.id, |
|||
'description': self.laundry_id.description, |
|||
'laundry_id': self.laundry_id.id, |
|||
'state': 'draft', |
|||
'laundry_works': True, |
|||
'washing_date': datetime.now().strftime( |
|||
'%Y-%m-%d %H:%M:%S')}) |
|||
self.laundry_id.state = 'extra_work' |
|||
laundry_id = self.search([('laundry_id.laundry_id', '=', |
|||
self.laundry_id.laundry_id.id)]) |
|||
for each in laundry_id: |
|||
if each.state != 'done' or each.state == 'cancel': |
|||
f = 1 |
|||
break |
|||
if f == 0: |
|||
self.laundry_id.laundry_id.state = 'done' |
|||
laundry = self.search([('laundry_id', '=', self.laundry_id.id)]) |
|||
f1 = 0 |
|||
for each in laundry: |
|||
if each.state != 'done' or each.state == 'cancel': |
|||
f1 = 1 |
|||
break |
|||
if f1 == 0: |
|||
self.laundry_id.state = 'done' |
|||
|
|||
@api.depends('product_line_ids') |
|||
def _compute_total_amount(self): |
|||
"""Total of the line""" |
|||
total = 0 |
|||
for obj in self: |
|||
for each in obj.product_line_ids: |
|||
total += each.subtotal |
|||
obj.total_amount = total |
|||
|
|||
|
|||
class WashOrderLine(models.Model): |
|||
"""For creating order lines in washing.""" |
|||
_name = 'wash.order.line' |
|||
_description = 'Wash Order Line' |
|||
|
|||
wash_id = fields.Many2one('washing.washing', string='Order Reference', |
|||
help='Order reference from washing', |
|||
ondelete='cascade') |
|||
name = fields.Text(string='Description', required=True, |
|||
help='Add description') |
|||
uom_id = fields.Many2one('uom.uom', 'Unit of Measure ', required=True) |
|||
quantity = fields.Integer(string='Quantity', |
|||
help='Add the required quantity') |
|||
product_id = fields.Many2one('product.product', string='Product', |
|||
help='Order line Product') |
|||
price_unit = fields.Float('Unit Price', default=0.0, |
|||
related='product_id.list_price', |
|||
help='Unit price of Product') |
|||
subtotal = fields.Float(compute='_compute_subtotal', string='Subtotal', |
|||
readonly=True, store=True, |
|||
help='Subtotal of the order line') |
|||
|
|||
@api.depends('price_unit', 'quantity') |
|||
def _compute_subtotal(self): |
|||
"""Computing the subtotal""" |
|||
total = 0 |
|||
for wash in self: |
|||
total += wash.price_unit * wash.quantity |
|||
wash.subtotal = total |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 WashingWork(models.Model): |
|||
"""Model for creating extra work for washing.""" |
|||
_name = 'washing.work' |
|||
_description = 'Washing Work' |
|||
|
|||
name = fields.Char(string='Name', required=True) |
|||
assigned_person_id = fields.Many2one('res.users', |
|||
string='Assigned Person', |
|||
required=True, |
|||
help="Name of assigned person") |
|||
amount = fields.Float(string='Service Charge', required=True, |
|||
help='Service charge for the extra work') |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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 report_laundry_order |
@ -0,0 +1,105 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ammu Raj (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, tools |
|||
|
|||
|
|||
class ReportLaundryOrder(models.Model): |
|||
"""Model for checking the history of all laundry orders.""" |
|||
_name = "report.laundry.order" |
|||
_description = "Report Laundry Order" |
|||
_order = 'name desc' |
|||
_auto = False |
|||
|
|||
name = fields.Char(string="Label") |
|||
invoice_status = fields.Selection([ |
|||
('upselling', 'Upselling Opportunity'), |
|||
('invoiced', 'Fully Invoiced'), |
|||
('to invoice', 'To Invoice'), |
|||
('no', 'Nothing to Invoice') |
|||
], string='Invoice Status', store=True, help="status of invoice") |
|||
partner_id = fields.Many2one('res.partner', string='Customer', |
|||
help="Name of the customer") |
|||
partner_invoice_id = fields.Many2one('res.partner', |
|||
string='Invoice Address', |
|||
help="Invoice address of Customer") |
|||
partner_shipping_id = fields.Many2one('res.partner', |
|||
string='Delivery Address', |
|||
help="Delivery address of customer") |
|||
order_date = fields.Datetime(string="Date", help="Date of order") |
|||
laundry_person_id = fields.Many2one('res.users', |
|||
string='Laundry Person', |
|||
help="Name of laundry person") |
|||
total_amount = fields.Float(string='Total') |
|||
currency_id = fields.Many2one("res.currency", |
|||
string="Currency", help="Name of currency") |
|||
state = fields.Selection([ |
|||
('draft', 'Draft'), |
|||
('order', 'Laundry Order'), |
|||
('process', 'Processing'), |
|||
('done', 'Done'), |
|||
('return', 'Returned'), |
|||
('cancel', 'Cancelled'), |
|||
], string='Status') |
|||
|
|||
def _select(self): |
|||
select_str = """ |
|||
SELECT |
|||
(select 1 ) AS nbr, |
|||
t.id as id, |
|||
t.name as name, |
|||
t.invoice_status as invoice_status, |
|||
t.partner_id as partner_id, |
|||
t.partner_invoice_id as partner_invoice_id, |
|||
t.partner_shipping_id as partner_shipping_id, |
|||
t.order_date as order_date, |
|||
t.laundry_person_id as laundry_person_id, |
|||
t.total_amount as total_amount, |
|||
t.currency_id as currency_id, |
|||
t.state as state |
|||
""" |
|||
return select_str |
|||
|
|||
def _group_by(self): |
|||
group_by_str = """ |
|||
GROUP BY |
|||
t.id, |
|||
name, |
|||
invoice_status, |
|||
partner_id, |
|||
partner_invoice_id, |
|||
partner_shipping_id, |
|||
order_date, |
|||
laundry_person_id, |
|||
total_amount, |
|||
currency_id, |
|||
state |
|||
""" |
|||
return group_by_str |
|||
|
|||
def init(self): |
|||
tools.sql.drop_view_if_exists(self._cr, 'report_laundry_order') |
|||
self._cr.execute(""" |
|||
CREATE view report_laundry_order as |
|||
%s |
|||
FROM laundry_order t |
|||
%s |
|||
""" % (self._select(), self._group_by())) |
|
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" ?> |
|||
<odoo> |
|||
<!-- Defined Groups and Record rules--> |
|||
<record id="module_category_laundry" model="ir.module.category"> |
|||
<field name="name">Laundry</field> |
|||
<field name="sequence">18</field> |
|||
</record> |
|||
<record id="group_laundry_user" model="res.groups"> |
|||
<field name="name">User</field> |
|||
<field name="category_id" ref="module_category_laundry"/> |
|||
<field name="users" eval="[(4, ref('base.group_user'))]"/> |
|||
</record> |
|||
<record id="group_laundry_manager" model="res.groups"> |
|||
<field name="name">Manager</field> |
|||
<field name="implied_ids" eval="[(4, ref('group_laundry_user'))]"/> |
|||
<field name="category_id" ref="module_category_laundry"/> |
|||
<field name="users" |
|||
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/> |
|||
</record> |
|||
<record id="laundry_order_admin_rule" model="ir.rule"> |
|||
<field name="name">Laundry Manager: Full access</field> |
|||
<field name="model_id" ref="model_laundry_order"/> |
|||
<field name="domain_force">[(1,'=',1)]</field> |
|||
<field name="groups" eval="[(4,ref('group_laundry_manager'))]"/> |
|||
</record> |
|||
<record id="laundry_order_user_rule" model="ir.rule"> |
|||
<field name="name">User: own document only</field> |
|||
<field name="model_id" ref="model_laundry_order"/> |
|||
<field name="domain_force">[('laundry_person_id.id','=',user.id)] |
|||
</field> |
|||
<field name="groups" eval="[(4,ref('group_laundry_user'))]"/> |
|||
</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: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 29 KiB |