diff --git a/automatic_payroll/README.rst b/automatic_payroll/README.rst new file mode 100644 index 000000000..e162f8d8a --- /dev/null +++ b/automatic_payroll/README.rst @@ -0,0 +1,30 @@ +Automatic Payroll +================= +* Generate payslip batches automatically. +* The feature works with the help of scheduler. + +Tech +==== +* [Python] - Models +* [XML] - Odoo views + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Developer: Varsha Vivek, odoo@cybrosys.com + +Maintainer +---------- +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. + +Contacts +======== +* Cybrosys Technologies diff --git a/automatic_payroll/__init__.py b/automatic_payroll/__init__.py new file mode 100644 index 000000000..9a7e03ede --- /dev/null +++ b/automatic_payroll/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/automatic_payroll/__manifest__.py b/automatic_payroll/__manifest__.py new file mode 100644 index 000000000..90c4a3a02 --- /dev/null +++ b/automatic_payroll/__manifest__.py @@ -0,0 +1,18 @@ +{ + 'name': 'Automatic Payroll', + 'version': '13.0.1.0.0', + 'category': 'Generic Modules/Human Resources', + 'description': """Generate payslips automatically""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base', 'hr_payroll_community'], + 'data': ['views/schedule_cron.xml', + 'views/res_config_settings_view.xml'], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/automatic_payroll/doc/RELEASE_NOTES.md b/automatic_payroll/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..ee388fb2f --- /dev/null +++ b/automatic_payroll/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 14.10.2019 +#### Version 13.0.1.0.0 +##### ADD +- Initial Commit diff --git a/automatic_payroll/models/__init__.py b/automatic_payroll/models/__init__.py new file mode 100644 index 000000000..e6aceae90 --- /dev/null +++ b/automatic_payroll/models/__init__.py @@ -0,0 +1,2 @@ +from . import auto_generate_payslips +from . import res_config_settings diff --git a/automatic_payroll/models/auto_generate_payslips.py b/automatic_payroll/models/auto_generate_payslips.py new file mode 100644 index 000000000..7528668e0 --- /dev/null +++ b/automatic_payroll/models/auto_generate_payslips.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +from datetime import date, datetime +from dateutil.relativedelta import relativedelta + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError + + +class HrPayslipRunCron(models.Model): + """ + Automate payslip generation + 1.Month First + 2.Specific Date + 3.Month End + """ + _inherit = 'hr.payslip.run' + + @api.onchange('generate_payslip') + def _check(self): + """Check the options and call the corresponding methods""" + if self.env['ir.config_parameter'].sudo().get_param('generate_payslip'): + if self.env['ir.config_parameter'].sudo().get_param( + 'option', 'first') == 'first': + self.month_first() + elif self.env['ir.config_parameter'].sudo().get_param( + 'option', 'specific') == 'specific': + self.specific_date() + elif self.env['ir.config_parameter'].sudo().get_param( + 'option', 'end') == 'end': + self.month_end() + else: + raise UserError(_("Enable configuration settings")) + + def month_first(self): + """Method for automate month first option""" + today = fields.Date.today() + day = today.day + if day == 1: + self.generate_payslips() + else: + raise UserError(_("Today is not month first")) + pass + + def month_end(self): + """Method for automate month end option""" + today = fields.Date.today() + day_today = today.day + last_date = today + relativedelta(day=1, months=+1, days=-1) + last_day = last_date.day + if day_today == last_day: + self.generate_payslips() + else: + raise UserError(_("Today is not month end")) + pass + + def specific_date(self): + """Method for automate specific day option""" + val = int(self.env['ir.config_parameter'].sudo().get_param('generate_day')) + today = fields.Date.today() + day = today.day + if day == val: + self.generate_payslips() + else: + raise UserError(_("Can't generate payslips today")) + pass + + def generate_payslips(self): + """Method for generate payslip batches and payslips, + before that you must assign ongoing contracts for employees""" + batch_id = self.create([{ + 'name': 'Payslip Batch For ' + date.today().strftime('%B') + + ' ' + str(date.today().year), + 'date_start': fields.Date.to_string(date.today().replace(day=1)), + 'date_end': fields.Date.to_string( + (datetime.now() + relativedelta(months=+1, day=1, days=-1)).date()) + }]) + + generate_payslip = self.env['hr.payslip.employees'] + contract_ids = self.env['hr.contract'].search([('state', '=', 'open')]) + employee_ids = [] + for line in contract_ids: + employee_ids.append(line.employee_id) + generate_payslip.create([{ + 'name': line.employee_id.id, + 'work_phone': line.employee_id.work_phone or None, + 'work_email': line.employee_id.work_email or None, + 'department_id': line.employee_id.department_id or None, + 'job_id': line.employee_id.job_id or None, + 'parent_id': line.employee_id.parent_id or None, + }]) + payslips = self.env['hr.payslip'] + [run_data] = batch_id.read( + ['date_start', 'date_end', 'credit_note']) + from_date = run_data.get('date_start') + to_date = run_data.get('date_end') + if not employee_ids: + raise UserError(_("You must select employee(s) to generate payslip(s).")) + for employee in employee_ids: + slip_data = self.env['hr.payslip'].onchange_employee_id(from_date, to_date, employee.id, + contract_id=False) + res = { + 'employee_id': employee.id, + 'name': slip_data['value'].get('name'), + 'struct_id': slip_data['value'].get('struct_id'), + 'contract_id': slip_data['value'].get('contract_id'), + 'payslip_run_id': batch_id.id, + 'input_line_ids': [(0, 0, x) for x in slip_data['value'].get('input_line_ids')], + 'worked_days_line_ids': [ + (0, 0, x) for x in slip_data['value'].get('worked_days_line_ids')], + 'date_from': from_date, + 'date_to': to_date, + 'credit_note': run_data.get('credit_note'), + 'company_id': employee.company_id.id, + } + payslips += self.env['hr.payslip'].create(res) + payslips.compute_sheet() + return {'type': 'ir.actions.act_window_close'} diff --git a/automatic_payroll/models/res_config_settings.py b/automatic_payroll/models/res_config_settings.py new file mode 100644 index 000000000..67f202e57 --- /dev/null +++ b/automatic_payroll/models/res_config_settings.py @@ -0,0 +1,35 @@ +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + generate_payslip = fields.Boolean(help="Automatic generation of payslip batches" + " and payslips using cron job (Monthly)") + + option = fields.Selection([ + ('first', 'Month First'), + ('specific', 'Specific date'), + ('end', 'Month End'), + ], string='Option', default='first', help='Option to select the date to generate payslips') + + generate_day = fields.Integer(string="Day", default=1, + help="payslip generated day in a month") + + @api.model + def get_values(self): + """get values from the fields""" + res = super(ResConfigSettings, self).get_values() + res.update( + generate_payslip=self.env['ir.config_parameter'].sudo().get_param('generate_payslip'), + generate_day=int(self.env['ir.config_parameter'].sudo().get_param('generate_day') or 1), + option=self.env['ir.config_parameter'].sudo().get_param('option') or 'first' + ) + return res + + def set_values(self): + """Set values in the fields""" + super(ResConfigSettings, self).set_values() + self.env['ir.config_parameter'].sudo().set_param('generate_payslip', self.generate_payslip) + self.env['ir.config_parameter'].sudo().set_param('generate_day', int(self.generate_day)) + self.env['ir.config_parameter'].sudo().set_param("option", self.option) diff --git a/automatic_payroll/static/description/automatic-payroll.gif b/automatic_payroll/static/description/automatic-payroll.gif new file mode 100644 index 000000000..8f986f6aa Binary files /dev/null and b/automatic_payroll/static/description/automatic-payroll.gif differ diff --git a/automatic_payroll/static/description/automatic_payroll-1.png b/automatic_payroll/static/description/automatic_payroll-1.png new file mode 100644 index 000000000..a02fa17fb Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-1.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-2.png b/automatic_payroll/static/description/automatic_payroll-2.png new file mode 100644 index 000000000..900af4fb3 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-2.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-3.png b/automatic_payroll/static/description/automatic_payroll-3.png new file mode 100644 index 000000000..47aa273a4 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-3.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-4.png b/automatic_payroll/static/description/automatic_payroll-4.png new file mode 100644 index 000000000..ff676a3ce Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-4.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-5.png b/automatic_payroll/static/description/automatic_payroll-5.png new file mode 100644 index 000000000..2243fcb66 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-5.png differ diff --git a/automatic_payroll/static/description/automatic_payroll-6.png b/automatic_payroll/static/description/automatic_payroll-6.png new file mode 100644 index 000000000..62f19de98 Binary files /dev/null and b/automatic_payroll/static/description/automatic_payroll-6.png differ diff --git a/automatic_payroll/static/description/banner.png b/automatic_payroll/static/description/banner.png new file mode 100644 index 000000000..cd1d8e5e8 Binary files /dev/null and b/automatic_payroll/static/description/banner.png differ diff --git a/automatic_payroll/static/description/checked.png b/automatic_payroll/static/description/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/automatic_payroll/static/description/checked.png differ diff --git a/automatic_payroll/static/description/employee_orientation.jpeg b/automatic_payroll/static/description/employee_orientation.jpeg new file mode 100644 index 000000000..067ede9fb Binary files /dev/null and b/automatic_payroll/static/description/employee_orientation.jpeg differ diff --git a/automatic_payroll/static/description/hr_employee_transfer.jpeg b/automatic_payroll/static/description/hr_employee_transfer.jpeg new file mode 100644 index 000000000..1859d8b14 Binary files /dev/null and b/automatic_payroll/static/description/hr_employee_transfer.jpeg differ diff --git a/automatic_payroll/static/description/hr_payslip_monthly_report.jpeg b/automatic_payroll/static/description/hr_payslip_monthly_report.jpeg new file mode 100644 index 000000000..aa8ba62e1 Binary files /dev/null and b/automatic_payroll/static/description/hr_payslip_monthly_report.jpeg differ diff --git a/automatic_payroll/static/description/icon.png b/automatic_payroll/static/description/icon.png new file mode 100644 index 000000000..3992d7ae7 Binary files /dev/null and b/automatic_payroll/static/description/icon.png differ diff --git a/automatic_payroll/static/description/index.html b/automatic_payroll/static/description/index.html new file mode 100644 index 000000000..1151f38fe --- /dev/null +++ b/automatic_payroll/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + + Bootstrap 101 Template + + + + + + +
+
+
+

Automatic Payroll

+

Generate payslip batches automatically.

+
+

Key Highlights

+
    +
  • check Automatic payroll generation for Odoo12 community edition.
  • +
  • check Generate payslip batches via adding all active employees.
  • + +
  • check The feature works with the help of scheduler.
  • + +
  • check Schedule the activity for month first,month end or specific day.
  • + + +
+
+ +
+
+
+
+

Overview

+
+

+ The module brings you an automatic payroll generation function further improvising the standard Odoo HR Payroll application. The module provisions to generate payslip batches automatically once in a month. +

The feature works with the help of scheduler.

+
+

+
+ +
+
+ +
+
+
+
+

Automatic Payroll

+
    +
  • + Available in Odoo 12.0 community edition. +
  • +
  • + The feature works with the help of scheduler. +
  • +
  • + Scheduler would check the options in the configuration settings and automatically generate payslip batches via adding all active employees possessing active contracts. +
  • +
  • + The module helps to generate payslips for month first,month end or specific day in a month. +
  • +
  • + The end user can confirm the generated payslip batch as well as the payslips in draft state. +
  • +
+
+
+
+
+

+ To enable/disable Automatic payroll, go to Payroll > Configuration > Settings > Enable/Disable Automatic Payroll. +

+
+ +
+
+
+

+ Three options are available. +

+
+ +
+
+
+

+ Upon selecting the second option (Specific date), there appears a field to enter specific date of the month. Based on date the scheduler shall generate payslip batches for the month. +

+
+ +
+
+
+

+ The feature works with the help of scheduler. +

+
+ +
+
+
+

+ During execution of scheduler, it would check contract table for active contracts and later create a new payslip batch via adding all active employees. +

+
+ +
+
+ +
+
+
Default 3
+ +
+
+
+ +
+
+
+

Video Demo

+
+

Odoo12 Automatic Payroll Demo

+ + +
+
+
+ +

Suggested Products

+
+ + +
+ + +
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+ +
+ +
+ + + + + + + diff --git a/automatic_payroll/static/description/oh_appraisal.jpeg b/automatic_payroll/static/description/oh_appraisal.jpeg new file mode 100644 index 000000000..0823d44d3 Binary files /dev/null and b/automatic_payroll/static/description/oh_appraisal.jpeg differ diff --git a/automatic_payroll/static/description/send_email_payslip.jpeg b/automatic_payroll/static/description/send_email_payslip.jpeg new file mode 100644 index 000000000..f585caa20 Binary files /dev/null and b/automatic_payroll/static/description/send_email_payslip.jpeg differ diff --git a/automatic_payroll/static/description/timesheet_payroll.jpeg b/automatic_payroll/static/description/timesheet_payroll.jpeg new file mode 100644 index 000000000..54dadb311 Binary files /dev/null and b/automatic_payroll/static/description/timesheet_payroll.jpeg differ diff --git a/automatic_payroll/views/res_config_settings_view.xml b/automatic_payroll/views/res_config_settings_view.xml new file mode 100644 index 000000000..aaa804ef3 --- /dev/null +++ b/automatic_payroll/views/res_config_settings_view.xml @@ -0,0 +1,40 @@ + + + + res_config_settings_view + res.config.settings + + + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/automatic_payroll/views/schedule_cron.xml b/automatic_payroll/views/schedule_cron.xml new file mode 100644 index 000000000..a82d9c039 --- /dev/null +++ b/automatic_payroll/views/schedule_cron.xml @@ -0,0 +1,13 @@ + + + + Generate payslip batches and payslips + + code + model._check() + 1 + days + -1 + + + \ No newline at end of file diff --git a/print_voucher_receipts/README.rst b/print_voucher_receipts/README.rst new file mode 100644 index 000000000..feaf82323 --- /dev/null +++ b/print_voucher_receipts/README.rst @@ -0,0 +1,40 @@ +Payment/Receipt voucher print +============================= +* Used to print payment/receipt voucher. + +Installation +============ +- www.odoo.com/documentation/12.0/setup/install.html +- Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(http://www.gnu.org/licenses/agpl.html) + +Company +------- +* 'Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: + odoo v12 - Varsha Vivek + +Contacts +-------- +* Mail Contact : odoo@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 +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ diff --git a/print_voucher_receipts/__init__.py b/print_voucher_receipts/__init__.py new file mode 100644 index 000000000..64e375b4b --- /dev/null +++ b/print_voucher_receipts/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Varsha Vivek (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 . +# +############################################################################# + +from . import models diff --git a/print_voucher_receipts/__manifest__.py b/print_voucher_receipts/__manifest__.py new file mode 100644 index 000000000..a5ff96d7a --- /dev/null +++ b/print_voucher_receipts/__manifest__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Varsha Vivek (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 . +# +############################################################################# + +{ + 'name': 'Print Voucher Receipts', + 'version': '13.0.1.0.0', + 'summary': """Print receipts from invoicing """, + 'description': """Print receipts from invoicing""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintaner': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'category': 'Accounting', + 'depends': ['base', 'account'], + 'data': ['views/template.xml', + 'views/account_voucher_print.xml'], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} + diff --git a/print_voucher_receipts/doc/RELEASE_NOTES.md b/print_voucher_receipts/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..cb70df756 --- /dev/null +++ b/print_voucher_receipts/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 29.08.2019 +#### Version 13.0.1.0.0 +##### ADD +- Initial commit for print_voucher_receipts diff --git a/print_voucher_receipts/models/__init__.py b/print_voucher_receipts/models/__init__.py new file mode 100644 index 000000000..50ec3e13d --- /dev/null +++ b/print_voucher_receipts/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Varsha Vivek (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 . +# +############################################################################# + +from . import account_voucher_print diff --git a/print_voucher_receipts/models/account_voucher_print.py b/print_voucher_receipts/models/account_voucher_print.py new file mode 100644 index 000000000..54945f785 --- /dev/null +++ b/print_voucher_receipts/models/account_voucher_print.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Varsha Vivek (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 . +# +############################################################################# + +from odoo import api, models, fields, _ +from odoo.exceptions import UserError + + +class AccountMove(models.Model): + """Inherit account.move model and enable the print option""" + _inherit = "account.move" + + @api.depends('amount_total') + def _compute_amount_total_words(self): + for receipt in self: + receipt.amount_total_words = receipt.currency_id.amount_to_text(receipt.amount_total) + + amount_total_words = fields.Char("Total (In Words)", compute="_compute_amount_total_words") + + def print_report(self): + """Method to print report""" + return self.env.ref( + 'print_voucher_receipts.action_print_receipt').report_action(self, data='') + + +class VoucherReceiptPrint(models.AbstractModel): + """Class for print the Qweb report""" + _name = 'report.print_voucher_receipts.print_voucher_receipt' + + @api.model + def _get_report_values(self, docids, data): + for move in self.env['account.move'].search([('id', 'in', docids)]): + if move.type not in ('in_receipt', 'out_receipt'): + raise UserError(_("Only receipts could be printed.")) + self.model = self.env.context.get('active_model') + docs = self.env.context.get('active_ids') + if docs == None: + docs = docids + return { + 'data': self.env['account.move'].search([('id', 'in', docs)]) + } diff --git a/print_voucher_receipts/static/description/banner.png b/print_voucher_receipts/static/description/banner.png new file mode 100644 index 000000000..f9e847d53 Binary files /dev/null and b/print_voucher_receipts/static/description/banner.png differ diff --git a/print_voucher_receipts/static/description/icon.png b/print_voucher_receipts/static/description/icon.png new file mode 100644 index 000000000..b9a96b37d Binary files /dev/null and b/print_voucher_receipts/static/description/icon.png differ diff --git a/print_voucher_receipts/static/description/icon.png~ b/print_voucher_receipts/static/description/icon.png~ new file mode 100644 index 000000000..5c1d3b967 Binary files /dev/null and b/print_voucher_receipts/static/description/icon.png~ differ diff --git a/print_voucher_receipts/static/description/images/account_day_book.jpeg b/print_voucher_receipts/static/description/images/account_day_book.jpeg new file mode 100644 index 000000000..07e6902f6 Binary files /dev/null and b/print_voucher_receipts/static/description/images/account_day_book.jpeg differ diff --git a/print_voucher_receipts/static/description/images/account_reports_xlsx.jpeg b/print_voucher_receipts/static/description/images/account_reports_xlsx.jpeg new file mode 100644 index 000000000..b3ce5bdcc Binary files /dev/null and b/print_voucher_receipts/static/description/images/account_reports_xlsx.jpeg differ diff --git a/print_voucher_receipts/static/description/images/bank_book_dynamic_reports.png b/print_voucher_receipts/static/description/images/bank_book_dynamic_reports.png new file mode 100644 index 000000000..d74daba97 Binary files /dev/null and b/print_voucher_receipts/static/description/images/bank_book_dynamic_reports.png differ diff --git a/print_voucher_receipts/static/description/images/cash_book_dynamic_reports.png b/print_voucher_receipts/static/description/images/cash_book_dynamic_reports.png new file mode 100644 index 000000000..35bd4aee9 Binary files /dev/null and b/print_voucher_receipts/static/description/images/cash_book_dynamic_reports.png differ diff --git a/print_voucher_receipts/static/description/images/checked.png b/print_voucher_receipts/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/print_voucher_receipts/static/description/images/checked.png differ diff --git a/print_voucher_receipts/static/description/images/cybrosys.png b/print_voucher_receipts/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/print_voucher_receipts/static/description/images/cybrosys.png differ diff --git a/print_voucher_receipts/static/description/images/day_book_dynamic_report.jpeg b/print_voucher_receipts/static/description/images/day_book_dynamic_report.jpeg new file mode 100644 index 000000000..2409df5bb Binary files /dev/null and b/print_voucher_receipts/static/description/images/day_book_dynamic_report.jpeg differ diff --git a/print_voucher_receipts/static/description/images/dynamic_reports_pdf.png b/print_voucher_receipts/static/description/images/dynamic_reports_pdf.png new file mode 100644 index 000000000..16745e06c Binary files /dev/null and b/print_voucher_receipts/static/description/images/dynamic_reports_pdf.png differ diff --git a/print_voucher_receipts/static/description/images/pos_multivariant-2.png~ b/print_voucher_receipts/static/description/images/pos_multivariant-2.png~ new file mode 100644 index 000000000..979476ecf Binary files /dev/null and b/print_voucher_receipts/static/description/images/pos_multivariant-2.png~ differ diff --git a/print_voucher_receipts/static/description/images/pos_multivariant-3.png~ b/print_voucher_receipts/static/description/images/pos_multivariant-3.png~ new file mode 100644 index 000000000..6951ae5d2 Binary files /dev/null and b/print_voucher_receipts/static/description/images/pos_multivariant-3.png~ differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-1.png b/print_voucher_receipts/static/description/images/print_voucher_receipts-1.png new file mode 100644 index 000000000..de9b8cb03 Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-1.png differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-2.png b/print_voucher_receipts/static/description/images/print_voucher_receipts-2.png new file mode 100644 index 000000000..dc37b455f Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-2.png differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-3.png b/print_voucher_receipts/static/description/images/print_voucher_receipts-3.png new file mode 100644 index 000000000..fe3845cec Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-3.png differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-4.png b/print_voucher_receipts/static/description/images/print_voucher_receipts-4.png new file mode 100644 index 000000000..7e6d88913 Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-4.png differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-4.png~ b/print_voucher_receipts/static/description/images/print_voucher_receipts-4.png~ new file mode 100644 index 000000000..266acc022 Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-4.png~ differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-5.png b/print_voucher_receipts/static/description/images/print_voucher_receipts-5.png new file mode 100644 index 000000000..8c99a37a0 Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-5.png differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts-6.png b/print_voucher_receipts/static/description/images/print_voucher_receipts-6.png new file mode 100644 index 000000000..67f5d6f57 Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts-6.png differ diff --git a/print_voucher_receipts/static/description/images/print_voucher_receipts.png b/print_voucher_receipts/static/description/images/print_voucher_receipts.png new file mode 100644 index 000000000..f7fc17c3d Binary files /dev/null and b/print_voucher_receipts/static/description/images/print_voucher_receipts.png differ diff --git a/print_voucher_receipts/static/description/index.html b/print_voucher_receipts/static/description/index.html new file mode 100644 index 000000000..e3347d110 --- /dev/null +++ b/print_voucher_receipts/static/description/index.html @@ -0,0 +1,376 @@ + + +
cybrosys-logo
+ +
+
+
+

Payment/Receipt Voucher Print

+

Print voucher receipts from invoicing

+
+

Key Highlights

+
    +
  • checkPayment/Receipt voucher print for Odoo12 community edition.
  • +
  • checkPrint customer payment voucher receipts.
  • +
  • checkPrint vendor voucher receipts.
  • +
+ +
+
+
+
+ + + + + + +
+
+
+ + + +
+
+ +

Overview

+
+

+ Payment/Receipt voucher print module helps with printing of voucher receipts. Currently there is no option for printing payments/receipts voucher. This module helps the user to print the vouchers from Odoo invoicing.

+
+ +
+ +

Payment/Receipt Voucher Print

+
+
    +
  • + checkPayment/Receipt voucher print for Odoo12 community edition.
  • +
  • + checkPrint customer payment voucher receipts.
  • + +
  • + checkPrint vendor voucher receipts.
  • +
+
+ + + +
+ +
+

Screenshots

+
+
+
+ + + +
+
+
+
+ + + + + + + + + + + + + +
+ + +
+
    + + +
+
+
+
+
+ + +
+

Suggested Products

+
+ +
+ + +
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+ +
+
+

Trading

+

Easily procure and sell your products.

+
+
+
+
+ +
+
+

Manufacturing

+

Plan, track and schedule your operations.

+
+
+
+
+ +
+
+

Restaurant

+

Run your bar or restaurant methodical.

+
+
+
+
+ +
+
+

POS

+

Easy configuring and convivial selling.

+
+
+
+
+ +
+
+

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages.

+
+
+
+
+ +
+
+

Hotel Management

+

An all-inclusive hotel management application.

+
+
+
+
+ +
+
+

Education

+

A Collaborative platform for educational management.

+
+
+
+
+ +
+
+

Service Management

+

Keep track of services and invoice accordingly.

+
+
+
+
+ +
+ + + +
+
+
+

Need Any Help?

+
+ +

If you have anything to share with us based on your use of this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com / info@cybrosys.com

+ +
+
+

Contact Us

+ www.cybrosys.com +
+
+ +
+
+ + +
+
+
+ + + + +
+
+ +
+ + + + + + + + +
+
+
+ + diff --git a/print_voucher_receipts/static/description/pos_book_order-17.png~ b/print_voucher_receipts/static/description/pos_book_order-17.png~ new file mode 100644 index 000000000..07f009cae Binary files /dev/null and b/print_voucher_receipts/static/description/pos_book_order-17.png~ differ diff --git a/print_voucher_receipts/views/account_voucher_print.xml b/print_voucher_receipts/views/account_voucher_print.xml new file mode 100644 index 000000000..788ba6817 --- /dev/null +++ b/print_voucher_receipts/views/account_voucher_print.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/print_voucher_receipts/views/template.xml b/print_voucher_receipts/views/template.xml new file mode 100644 index 000000000..609d6336c --- /dev/null +++ b/print_voucher_receipts/views/template.xml @@ -0,0 +1,189 @@ + + + + \ No newline at end of file diff --git a/product_return_pos/README.md b/product_return_pos/README.md new file mode 100644 index 000000000..4bc9ac410 --- /dev/null +++ b/product_return_pos/README.md @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--1-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Product Return In POS +===================== +POS Order Return. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Anusha P P@cybrosys + Version 13: Nimisha Murali@cybrosys + +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 `__ + +Further information +=================== +HTML Description: ``__ + + + + + + diff --git a/product_return_pos/__init__.py b/product_return_pos/__init__.py new file mode 100644 index 000000000..afe5fa815 --- /dev/null +++ b/product_return_pos/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Anusha P 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 . +# +############################################################################# +from . import models diff --git a/product_return_pos/__manifest__.py b/product_return_pos/__manifest__.py new file mode 100644 index 000000000..e40fec8c5 --- /dev/null +++ b/product_return_pos/__manifest__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Anusha P 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 . +# +############################################################################# +{ + 'name': 'Product Return In POS', + 'version': '13.0.1.0.0', + 'category': 'Point of Sale', + 'summary': 'POS Order Return', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.jpg'], + 'website': 'https://www.cybrosys.com', + 'depends': ['point_of_sale'], + 'data': [ + 'views/return.xml', + 'views/pos_template.xml', + ], + 'qweb': ['static/src/xml/pos_return.xml'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, + +} diff --git a/product_return_pos/doc/RELEASE_NOTES.md b/product_return_pos/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..50cbbc3d4 --- /dev/null +++ b/product_return_pos/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 10.10.2019 +#### Version 13.0.1.0.0 +##### ADD +- Migrated to Version 13. diff --git a/product_return_pos/models/__init__.py b/product_return_pos/models/__init__.py new file mode 100644 index 000000000..7b5f6316d --- /dev/null +++ b/product_return_pos/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Anusha P 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 . +# +############################################################################# + +from . import pos_return diff --git a/product_return_pos/models/pos_return.py b/product_return_pos/models/pos_return.py new file mode 100644 index 000000000..85318e0cc --- /dev/null +++ b/product_return_pos/models/pos_return.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Anusha P 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 . +# +############################################################################# +from odoo import models, api, fields + + +class PosOrderReturn(models.Model): + _inherit = 'pos.order' + + return_ref = fields.Char(string='Return Ref', readonly=True, copy=False) + return_status = fields.Selection([ + ('nothing_return', 'Nothing Returned'), + ('partialy_return', 'Partialy Returned'), + ('fully_return', 'Fully Returned') + ], string="Return Status", default='nothing_return', + readonly=True, copy=False, help="Return status of Order") + + @api.model + def get_lines(self, ref): + result = [] + order_id = self.search([('pos_reference', '=', ref)], limit=1) + if order_id: + lines = self.env['pos.order.line'].search([('order_id', '=', order_id.id)]) + for line in lines: + if line.qty - line.returned_qty > 0: + new_vals = { + 'product_id': line.product_id.id, + 'product': line.product_id.name, + 'qty': line.qty - line.returned_qty, + 'price_unit': line.price_unit, + 'discount': line.discount, + 'line_id': line.id, + } + result.append(new_vals) + + return [result] + + def _order_fields(self, ui_order): + order = super(PosOrderReturn, self)._order_fields(ui_order) + if 'return_ref' in ui_order.keys() and ui_order['return_ref']: + order['return_ref'] = ui_order['return_ref'] + parent_order = self.search([('pos_reference', '=', ui_order['return_ref'])], limit=1) + + updated_lines = ui_order['lines'] + ret = 0 + qty = 0 + for uptd in updated_lines: + line = self.env['pos.order.line'].search([('order_id', '=', parent_order.id), + ('id', '=', uptd[2]['line_id'])], limit=1) + if line: + line.returned_qty += -(uptd[2]['qty']) + for line in parent_order.lines: + qty += line.qty + ret += line.returned_qty + if qty-ret == 0: + if parent_order: + parent_order.return_status = 'fully_return' + elif ret: + if qty > ret: + if parent_order: + parent_order.return_status = 'partialy_return' + return order + + +class PosOrderLineReturn(models.Model): + _inherit = 'pos.order.line' + + returned_qty = fields.Integer(string='Returned Qty', digits=0, readonly=True) diff --git a/product_return_pos/static/description/banner.jpg b/product_return_pos/static/description/banner.jpg new file mode 100644 index 000000000..874a6d32a Binary files /dev/null and b/product_return_pos/static/description/banner.jpg differ diff --git a/product_return_pos/static/description/cybro_logo.png b/product_return_pos/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/product_return_pos/static/description/cybro_logo.png differ diff --git a/product_return_pos/static/description/icon.png b/product_return_pos/static/description/icon.png new file mode 100644 index 000000000..787de69d0 Binary files /dev/null and b/product_return_pos/static/description/icon.png differ diff --git a/product_return_pos/static/description/index.html b/product_return_pos/static/description/index.html new file mode 100644 index 000000000..7e6c92ca5 --- /dev/null +++ b/product_return_pos/static/description/index.html @@ -0,0 +1,361 @@ +
+
+

+ Product Return In POS +

+

+ Manages Product Return From POS Frontend +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies +
+
+
+
+
+
+

+ Overview +

+

+ This app will help you to return the products from the POS user interface. +

+
+
+
+
+

+ Features +

+

+ + Manage Product Return through POS interface. +

+

+ + Track Return Reference and Status +

+
+
+
+
+

+ Screenshots +

+

+
+ + Create a normal order. +
+

+
+ +
+

+
+ + Click on Return button In order to return products. +
+

+
+ +
+

+
+ Select the order and click on Return. +
+

+
+ +
+

+
+ + Return some of the products. +
+

+
+ +
+

+
+ We get the return reference and status of the return from backend also. +
+

+
+ +
+
+
+
+
+ cybrosys technologies +
+
+
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
+ + + diff --git a/product_return_pos/static/description/pos_return_cybrosys_1.png b/product_return_pos/static/description/pos_return_cybrosys_1.png new file mode 100644 index 000000000..d35ee061b Binary files /dev/null and b/product_return_pos/static/description/pos_return_cybrosys_1.png differ diff --git a/product_return_pos/static/description/pos_return_cybrosys_2.png b/product_return_pos/static/description/pos_return_cybrosys_2.png new file mode 100644 index 000000000..b065d51d6 Binary files /dev/null and b/product_return_pos/static/description/pos_return_cybrosys_2.png differ diff --git a/product_return_pos/static/description/pos_return_cybrosys_3.png b/product_return_pos/static/description/pos_return_cybrosys_3.png new file mode 100644 index 000000000..045375609 Binary files /dev/null and b/product_return_pos/static/description/pos_return_cybrosys_3.png differ diff --git a/product_return_pos/static/description/pos_return_cybrosys_4.png b/product_return_pos/static/description/pos_return_cybrosys_4.png new file mode 100644 index 000000000..da2ec39e6 Binary files /dev/null and b/product_return_pos/static/description/pos_return_cybrosys_4.png differ diff --git a/product_return_pos/static/description/pos_return_cybrosys_5.png b/product_return_pos/static/description/pos_return_cybrosys_5.png new file mode 100644 index 000000000..f6c17c6e7 Binary files /dev/null and b/product_return_pos/static/description/pos_return_cybrosys_5.png differ diff --git a/product_return_pos/static/src/css/pos_return.css b/product_return_pos/static/src/css/pos_return.css new file mode 100644 index 000000000..d363ba7ed --- /dev/null +++ b/product_return_pos/static/src/css/pos_return.css @@ -0,0 +1,50 @@ +.return-screen .return-button { + color: #f0f0f0; + display: inline-block; + box-sizing: border-box; + -moz-box-sizing: border-box; + /* height: 20px; */ + padding: 4px 8px; + margin: 3px; + margin-bottom: 0px; + margin-right: 2px; + padding-top: 0px; + background: #8b8b8b; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + vertical-align: top; + line-height: 20px; + text-align: center; + box-shadow: 0px -5px 10px -6px rgb(82,82,82) inset; + cursor: pointer; + min-width: 45px; +} +.return-screen .order-list tr.highlight{ + transition: all 150ms linear; + background: rgb(110,200,155) !important; + color: white; +} +.return-screen .order-list td tr.lowlight{ + transition: all 150ms linear; + background: rgb(216, 238, 227); +} +.return-screen .order-list tr.lowlight:nth-child(even){ + transition: all 150ms linear; + background: rgb(227, 246, 237); +} + +.return-screen .searchbox{ + right: auto; + margin-left: 90px; + margin-top:8px; + left: 50%; +} +.reprint_order_screen .searchbox input{ + width: 120px; +} + +.return-screen .order-list{ + font-size: 15px; + width: 100%; + line-height: 40px; +} \ No newline at end of file diff --git a/product_return_pos/static/src/js/pos_return.js b/product_return_pos/static/src/js/pos_return.js new file mode 100644 index 000000000..821a64807 --- /dev/null +++ b/product_return_pos/static/src/js/pos_return.js @@ -0,0 +1,417 @@ +odoo.define('product_return_pos.return',function(require) { + "use strict"; + +var models = require('point_of_sale.models'); +var screens = require('point_of_sale.screens'); +var ScreenWidget = screens.ScreenWidget; +var gui = require('point_of_sale.gui'); +var core = require('web.core'); +var QWeb = core.qweb; +var PopupWidget = require('point_of_sale.popups'); +var rpc = require('web.rpc'); +var _t = require('web.core')._t; +var session = require('web.session'); +models.load_models({ + model: 'pos.order', + fields: ['name', 'partner_id','date_order','amount_total', 'amount_tax', + 'pos_reference','lines','state','session_id','company_id','return_ref','return_status'], + loaded: function(self, orders){ + self.orders = orders; + } + }, + { + model: 'pos.order.line', + fields: ['product_id','qty','price_unit','price_subtotal_incl','order_id','discount','returned_qty'], + loaded: function(self,order_lines){ + self.order_line = []; + for (var i = 0; i < order_lines.length; i++) { + self.order_line[i] = order_lines[i]; + } + } +}); + + +var ReturnWidget = PopupWidget.extend({ + template:'ReturnWidget', + + init: function(parent, options){ + this._super(parent, options); + this.options = {}; + this.pos_reference = ""; + + }, + show: function(options){ + this._super(options); + this.render_list(options); + + }, + events: { + 'click .button.cancel': 'click_cancel', + 'click .button.confirm': 'click_confirm', + }, + render_list:function(options){ + $("#table-body").empty(); + var lines = []; + this.pos_reference = options.ref + rpc.query({ + model: 'pos.order', + method: 'get_lines', + args: [options.ref], + }).then(function (result) { + lines = result[0]; + for(var j=0;j < lines.length; j++){ + var product_line = lines[j]; + var rows = ""; + var id = product_line.product_id + var price_unit = product_line.price_unit; + var name =product_line.product; + var qty = product_line.qty; + var line_id = product_line.line_id; + var discount = product_line.discount; + rows += "" + id + "" + price_unit +" " + name + "" + qty + "" + discount + "" + line_id + ""; + $(rows).appendTo("#list tbody"); + var rows = document.getElementById('list').rows; + for (var row = 0; row < rows.length; row++) { + var cols = rows[row].cells; + cols[0].style.display = 'none'; + cols[1].style.display = 'none'; + cols[5].style.display = 'none'; + + } + + } + var table = document.getElementById('list'); + var tr = table.getElementsByTagName("tr"); + for (var i = 1; i < tr.length; i++) { + var td = document.createElement('td'); + var input = document.createElement('input'); + input.setAttribute("type", "text"); + input.setAttribute("value", 0); + input.setAttribute("id", "text"+i); + td.appendChild(input); + tr[i].appendChild(td); + + } + }).catch(function () { + alert("NO DATA") + }); + }, + click_confirm: function(){ + + var self = this; + var myTable = document.getElementById('list').tBodies[0]; + var count = 0; + var c = 1; + + for (r=0, n = myTable.rows.length; r < n; r++) { + var row = myTable.rows[r] + var return_qty = document.getElementById("text"+c).value + if (row.cells[3].innerHTML < return_qty){ + count +=1 + } + c = c+1 + } + if (count > 0){ + alert('Please check the Returned Quantity,it is higher than purchased') + } + else{ + c = 1; + // OrderSuper.prototype.set_client.call(this, this.client); + for (var r=0, n = myTable.rows.length; r < n; r++) { + row = myTable.rows[r] + return_qty = document.getElementById("text"+c).value; + var product = this.pos.db.get_product_by_id(row.cells[0].innerHTML); + if (!product) { + return; + } + + if (return_qty > 0){ + this.pos.get_order().add_product(product, { + price: row.cells[1].innerHTML, + quantity: -(return_qty), + discount:row.cells[4].innerHTML, + merge: false, + extras: {return_ref: this.pos_reference, + label:row.cells[5].innerHTML}, + }); + + } + c = c+1 + + } + + if (this.options.client){ + this.pos.get_order().set_client(self.pos.db.get_partner_by_id(this.options.client)); + } + + } + + this.gui.close_popup(); + self.gui.show_screen('products'); + + }, + click_cancel: function(){ + this.gui.close_popup(); + + } + +}); +gui.define_popup({name:'ReturnWidget', widget: ReturnWidget}); + +var OrderListScreenWidget = ScreenWidget.extend({ + template:'OrderListScreenWidget', + init: function(parent, options){ + this._super(parent, options); + }, + show: function(){ + var self = this; + this._super(); + this.renderElement(); + this.$('.back').click(function(){ + self.gui.back(); + }); + var orders = this.pos.orders; + this.render_list(orders); + var search_timeout = null; + this.$('.searchbox input').on('keypress',function(event){ + clearTimeout(search_timeout); + + var searchbox = this; + + search_timeout = setTimeout(function(){ + self.perform_search(searchbox.value, event.which === 13); + },70); + }); + + this.$('.searchbox .search-clear').click(function(){ + self.clear_search(); + }); + this.$('.return_order').click(function(e){ + var order = $(e.target).closest("tr").data('id'); + self.return_order(order); + }); + }, + + hide: function () { + this._super(); + }, + get_orders: function(){ + return this.gui.get_current_screen_param('orders'); + }, + perform_search: function(query, associate_result){ + var orders; + if(query){ + orders = this.search_order(query); + this.render_list(orders); + }else{ + orders = this.pos.orders; + this.render_list(orders); + } + }, + search_order: function(query){ + try { + var re = RegExp(query, 'i'); + }catch(e){ + return []; + } + var results = []; + for (var order_id in this.pos.orders){ + var r = re.exec(this.pos.orders[order_id]['name']+ '|'+ this.pos.orders[order_id]['partner_id'][1]); + if(r){ + results.push(this.pos.orders[order_id]); + } + } + return results; + }, + clear_search: function(){ + var orders = this.pos.orders; + this.render_list(orders); + this.$('.searchbox input')[0].value = ''; + this.$('.searchbox input').focus(); + }, + render_list: function(orders){ + var contents = this.$el[0].querySelector('.order-list-contents'); + contents.innerHTML = ""; + for(var i = 0, len = Math.min(orders.length,1000); i < len; i++){ + var order = orders[i]; + var orderline_html = QWeb.render('OrderLine',{widget: this, order:order}); + var orderline = document.createElement('tbody'); + orderline.innerHTML = orderline_html; + orderline = orderline.childNodes[1]; + contents.appendChild(orderline); + } + }, + return_order:function(order_id){ + var self = this; + var order = this.get_order_by_id(order_id); + var client = '' + if (order.partner_id){ + client = order.partner_id[0]; + } + if (order && order.return_status ==='fully_return'){ + self.gui.show_popup('error',_t('This is a fully returned order')); + } + else if (order && order.return_ref) { + self.gui.show_popup('error',_t('This is a returned order')); + } + else{ + console.log(order.pos_reference,client) + self.gui.show_popup('ReturnWidget',{ref: order.pos_reference,client:client}); + + } + + }, + get_order_by_id: function(id){ + var orders = this.pos.orders; + for (var i in orders){ + if (orders[i].id === id){ + return orders[i]; + } + } + + } +}); + +gui.define_screen({name:'orderlist', widget: OrderListScreenWidget}); +var ReturnButton = screens.ActionButtonWidget.extend({ + template: 'ReturnButton', + button_click: function(){ + var orders = this.pos.orders; + this.gui.show_screen('orderlist',{orders:orders}); + } +}); + +screens.define_action_button({ + 'name': 'return', + 'widget': ReturnButton +}); +var _super_orderline = models.Orderline; +models.Orderline = models.Orderline.extend({ + + set_line_id: function(line_id){ + this.line_id = line_id; + }, + export_as_JSON: function(){ + var json = _super_orderline.prototype.export_as_JSON.apply(this,arguments); + json.line_id = this.line_id; + return json; + }, + init_from_JSON: function(json){ + _super_orderline.prototype.init_from_JSON.apply(this,arguments); + this.line_id = json.line_id; + }, +}); + +var _super = models.Order; +models.Order = models.Order.extend({ + + add_product: function (product, options) { + + var order = this.pos.get_order(); + _super.prototype.add_product.call(this, product, options); + if (options !== undefined) { + if (options.extras !== undefined) { + for (var prop in options.extras) { + if (prop === 'return_ref') { + this.return_ref = options.extras['return_ref'] + this.trigger('change', this); + } + if (prop === 'label') { + order.selected_orderline.set_line_id(options.extras['label']); + } + + } + + } + + } + + }, + + export_as_JSON: function(){ + var json = _super.prototype.export_as_JSON.apply(this,arguments); + json.return_ref = this.return_ref; + return json; + }, + init_from_JSON: function(json){ + _super.prototype.init_from_JSON.apply(this,arguments); + this.return_ref = json.return_ref; + } + +}); + +models.PosModel.extend({ + _save_to_server: function (orders, options) { + if (!orders || !orders.length) { + var result = $.Deferred(); + result.resolve([]); + return result; + } + var fields = _.find(this.models,function(model){ return model.model === 'pos.order'; }).fields; + options = options || {}; + + var self = this; + var timeout = typeof options.timeout === 'number' ? options.timeout : 7500 * orders.length; + + // Keep the order ids that are about to be sent to the + // backend. In between create_from_ui and the success callback + // new orders may have been added to it. + var order_ids_to_sync = _.pluck(orders, 'id'); + + // we try to send the order. shadow prevents a spinner if it takes too long. (unless we are sending an invoice, + // then we want to notify the user that we are waiting on something ) + var args = [_.map(orders, function (order) { + order.to_invoice = options.to_invoice || false; + return order; + })]; + return rpc.query({ + model: 'pos.order', + method: 'create_from_ui', + args: args, + kwargs: {context: session.user_context}, + }, { + timeout: timeout, + shadow: !options.to_invoice + }) + .then(function (server_ids) { + _.each(order_ids_to_sync, function (order_id) { + self.db.remove_order(order_id); + }); + self.set('failed',false); + if (server_ids.length != 0){ + for (var item in server_ids){ + rpc.query({ + model: 'pos.order', + method: 'search_read', + args: [[['id', '=', server_ids[item]]], fields], + limit: 1, + }) + .then(function (order){ + self.orders.unshift(order[0]); + }); + } + } + self.load_server_data(); + return server_ids; + }).catch(function (type, error){ + if(error.code === 200 ){ // Business Logic Error, not a connection problem + //if warning do not need to display traceback!! + if (error.data.exception_type == 'warning') { + delete error.data.debug; + } + + // Hide error if already shown before ... + if ((!self.get('failed') || options.show_error) && !options.to_invoice) { + self.gui.show_popup('error-traceback',{ + 'title': error.data.message, + 'body': error.data.debug + }); + } + self.set('failed',error); + } + console.error('Failed to send orders:', orders); + }); + }, +}); + +}); \ No newline at end of file diff --git a/product_return_pos/static/src/xml/pos_return.xml b/product_return_pos/static/src/xml/pos_return.xml new file mode 100644 index 000000000..94013285d --- /dev/null +++ b/product_return_pos/static/src/xml/pos_return.xml @@ -0,0 +1,95 @@ + + + + +
+ Return +
+
+ + + + + + + + + + Return + + + + +
+
+
+ + + Cancel + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + +
Order RefReturn RefPartnerDate
+
+
+
+
+
+
+
+
+ + + +
\ No newline at end of file diff --git a/product_return_pos/views/pos_template.xml b/product_return_pos/views/pos_template.xml new file mode 100644 index 000000000..c227cf9df --- /dev/null +++ b/product_return_pos/views/pos_template.xml @@ -0,0 +1,13 @@ + + + +