Browse Source

Aug 25 [FIX] : Bug Fixed 'advanced_vat_invoice'

pull/277/head
AjmalCybro 2 years ago
parent
commit
a0efc6fe94
  1. 34
      advanced_vat_invoice/README.rst
  2. 27
      advanced_vat_invoice/__init__.py
  3. 49
      advanced_vat_invoice/__manifest__.py
  4. 5
      advanced_vat_invoice/doc/RELEASE_NOTES.md
  5. 31
      advanced_vat_invoice/models/__init__.py
  6. 88
      advanced_vat_invoice/models/account_move.py
  7. 48
      advanced_vat_invoice/models/qr_config.py
  8. 55
      advanced_vat_invoice/models/res_config_settings.py
  9. 45
      advanced_vat_invoice/report/account_move_reports.xml
  10. 22
      advanced_vat_invoice/report/invoice_pdf.xml
  11. 127
      advanced_vat_invoice/report/simplified_tax_report_template.xml
  12. 155
      advanced_vat_invoice/report/simplified_tax_report_templates.xml
  13. 352
      advanced_vat_invoice/report/vat_invoice_report_template.xml
  14. 379
      advanced_vat_invoice/report/vat_invoice_report_templates.xml
  15. 2
      advanced_vat_invoice/security/ir.model.access.csv
  16. BIN
      advanced_vat_invoice/static/description/assets/modules/1.png
  17. BIN
      advanced_vat_invoice/static/description/assets/modules/2.png
  18. BIN
      advanced_vat_invoice/static/description/assets/modules/3.png
  19. BIN
      advanced_vat_invoice/static/description/assets/modules/4.png
  20. BIN
      advanced_vat_invoice/static/description/assets/modules/5.gif
  21. BIN
      advanced_vat_invoice/static/description/assets/modules/5.png
  22. BIN
      advanced_vat_invoice/static/description/assets/modules/6.png
  23. 12
      advanced_vat_invoice/static/description/index.html
  24. 20
      advanced_vat_invoice/views/account_move_views.xml
  25. 14
      advanced_vat_invoice/views/res_config_settings_views.xml
  26. 25
      advanced_vat_invoice/views/vat_invoice_in_action.xml

34
advanced_vat_invoice/README.rst

@ -1,29 +1,34 @@
Advanced VAT Invoice .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
========================= :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
* Configure VAT Invoice :alt: License: AGPL-3
Installation Advanced VAT Invoice
============ ====================
- www.odoo.com/documentation/12.0/setup/install.html This module allow us to print vat invoice report and simplified tax invoice
- Install our custom addon report in arabic language and also this module have an option for generating
qr code and display invoice reports while scanning the QR code.
License License
------- -------
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) General Public License, Version 3 (AGPL v3).
(http://www.gnu.org/licenses/agpl.html) https://www.gnu.org/licenses/agpl-3.0-standalone.html
Configuration
=============
* Select QR code generation method from Configuration --> Settings --> QR Code
Company Company
------- -------
* 'Cybrosys Techno Solutions <https://cybrosys.com/>`__ * `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits Credits
------- -------
* Developer: Developer: (V16) Athira P S , Contact: odoo@cybrosys.com
Athira PS @Cybrosys
Contacts Contacts
-------- --------
* Mail Contact : odoo@cybrosys.com * Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com
Bug Tracker Bug Tracker
----------- -----------
@ -31,9 +36,12 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you
Maintainer Maintainer
========== ==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies. This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com For support and more information, please visit `Our Website <https://cybrosys.com/>`__
Further information Further information
=================== ===================

27
advanced_vat_invoice/__init__.py

@ -1,23 +1,22 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
###################################################################################### ###############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)) # Author: Athira P S (odoo@cybrosys.com)
# #
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) # You can modify it under the terms of the GNU AFFERO
# It is forbidden to publish, distribute, sublicense, or sell copies of the Software # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
# or modified copies of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # This program is distributed in the hope that it will be useful,
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # but WITHOUT ANY WARRANTY; without even the implied warranty of
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# #
######################################################################################## # 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 models

49
advanced_vat_invoice/__manifest__.py

@ -1,46 +1,45 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
###################################################################################### ###############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)) # Author: Athira P S (odoo@cybrosys.com)
# #
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) # You can modify it under the terms of the GNU AFFERO
# It is forbidden to publish, distribute, sublicense, or sell copies of the Software # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
# or modified copies of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # This program is distributed in the hope that it will be useful,
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # but WITHOUT ANY WARRANTY; without even the implied warranty of
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# #
######################################################################################## # 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': 'e-Invoicing For Saudi | Saudi VAT Invoice | Saudi Electronic Invoice | Saudi Zatca', 'name': 'e-Invoicing For Saudi | Saudi VAT Invoice | Saudi Electronic Invoice | Saudi Zatca',
'version': '16.0.1.0.0', 'version': '16.0.1.0.0',
'summary': 'e-Invoicing For Saudi | Saudi VAT Invoice | Saudi Electronic Invoice | Saudi Zatca', 'category': 'Accounting',
'description': 'e-Invoicing For Saudi,Saudi VAT Invoice,Saudi Electronic Invoice,Saudi Zatca,Zatca,Saudi,e-Invoicing', 'summary': "Module for e-Invoicing For Saudi | Saudi VAT Invoice | Saudi Electronic Invoice | Saudi Zatca",
'description': "e-Invoicing For Saudi,Saudi VAT Invoice,Saudi Electronic Invoice,Saudi Zatca,Zatca,Saudi,e-Invoicing",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com', 'website': 'https://www.cybrosys.com',
'depends': ['base', 'account'], 'depends': ['base', 'account'],
'images': ['static/description/banner.png'],
'data': [ 'data': [
'views/qr_config.xml', 'views/res_config_settings_views.xml',
'views/qrcode_in_invoices.xml', 'views/account_move_views.xml',
'report/invoice_pdf.xml', 'report/account_move_reports.xml',
'report/vat_invoice_report_template.xml', 'report/vat_invoice_report_templates.xml',
'views/vat_invoice_in_action.xml', 'report/simplified_tax_report_templates.xml'
'report/simplified_tax_report_template.xml'
], ],
'images': ['static/description/banner.png'],
'license': 'AGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,
'license': 'AGPL-3',
} }

5
advanced_vat_invoice/doc/RELEASE_NOTES.md

@ -1,6 +1,7 @@
## Module <advanced_vat_invoice> ## Module <advanced_vat_invoice>
#### 29.11.2022 #### 25.08.2023
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
##### ADD ##### ADD
- Initial commit
- Initial Commit for Advanced VAT Invoice

31
advanced_vat_invoice/models/__init__.py

@ -1,24 +1,23 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
###################################################################################### ###############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)) # Author: Athira P S (odoo@cybrosys.com)
# #
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) # You can modify it under the terms of the GNU AFFERO
# It is forbidden to publish, distribute, sublicense, or sell copies of the Software # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
# or modified copies of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # This program is distributed in the hope that it will be useful,
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # but WITHOUT ANY WARRANTY; without even the implied warranty of
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# #
######################################################################################## # 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 qr_config ###############################################################################
from . import qrcode_in_invoices from . import account_move
from . import res_config_settings

88
advanced_vat_invoice/models/qrcode_in_invoices.py → advanced_vat_invoice/models/account_move.py

@ -1,26 +1,31 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
###################################################################################### ###############################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)) # Author: Athira P S (odoo@cybrosys.com)
# #
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) # You can modify it under the terms of the GNU AFFERO
# It is forbidden to publish, distribute, sublicense, or sell copies of the Software # GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
# or modified copies of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # This program is distributed in the hope that it will be useful,
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # but WITHOUT ANY WARRANTY; without even the implied warranty of
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# #
######################################################################################## # 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, api, _ ###############################################################################
from io import BytesIO
import binascii
import pytz
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
try: try:
import qrcode import qrcode
@ -30,27 +35,34 @@ try:
import base64 import base64
except ImportError: except ImportError:
base64 = None base64 = None
from io import BytesIO
import binascii
import pytz
from odoo.exceptions import UserError
from odoo.tools.pycompat import to_text
from odoo.tools import float_is_zero, float_compare, DEFAULT_SERVER_DATETIME_FORMAT
class InheritAccountMove(models.Model): class AccountMove(models.Model):
"""Class for adding new button and a page in account move"""
_inherit = 'account.move' _inherit = 'account.move'
qr = fields.Binary("QR Code", compute='generate_qrcode', store=True) qr = fields.Binary(string="QR Code", compute='generate_qrcode', store=True,
help="QR code")
qr_button = fields.Boolean(struct="Qr Button", compute="_compute_qr",
help="Is QR button is enable or not")
def timezone(self, userdate): @api.depends('qr_button')
def _compute_qr(self):
"""Compute function for checking the value of a field in settings"""
for record in self:
qr_code = self.env['ir.config_parameter'].sudo().get_param(
'advanced_vat_invoice.is_qr')
record.qr_button = qr_code == 'True'
def timezone(self, userdate):
"""Function to convert a user's date to their timezone."""
tz_name = self.env.context.get('tz') or self.env.user.tz tz_name = self.env.context.get('tz') or self.env.user.tz
contex_tz = pytz.timezone(tz_name) contex_tz = pytz.timezone(tz_name)
date_time = pytz.utc.localize(userdate).astimezone(contex_tz) date_time = pytz.utc.localize(userdate).astimezone(contex_tz)
return date_time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) return date_time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
def string_hexa(self, value): def string_hexa(self, value):
"""Convert a string to a hexadecimal representation."""
if value: if value:
string = str(value) string = str(value)
string_bytes = string.encode("UTF-8") string_bytes = string.encode("UTF-8")
@ -59,10 +71,12 @@ class InheritAccountMove(models.Model):
return hex_value return hex_value
def hexa(self, tag, length, value): def hexa(self, tag, length, value):
"""Generate a hex value with tag, length, and value."""
if tag and length and value: if tag and length and value:
hex_string = self.string_hexa(value) hex_string = self.string_hexa(value)
length = int(len(hex_string) / 2) length = int(len(hex_string) / 2)
conversion_table = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] conversion_table = ['0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'a', 'b', 'c', 'd', 'e', 'f']
hexadecimal = '' hexadecimal = ''
while (length > 0): while (length > 0):
remainder = length % 16 remainder = length % 16
@ -73,20 +87,25 @@ class InheritAccountMove(models.Model):
return tag + hexadecimal + hex_string return tag + hexadecimal + hex_string
def qr_code_data(self): def qr_code_data(self):
sellername = str(self.company_id.name) """Generate QR code data for the current record."""
seller_name = str(self.company_id.name)
seller_vat_no = self.company_id.vat or '' seller_vat_no = self.company_id.vat or ''
seller_hex = self.hexa("01", "0c", sellername) seller_hex = self.hexa("01", "0c", seller_name)
vat_hex = self.hexa("02", "0f", seller_vat_no) or "" vat_hex = self.hexa("02", "0f", seller_vat_no) or ""
time_stamp = self.timezone(self.create_date) time_stamp = self.timezone(self.create_date)
date_hex = self.hexa("03", "14", time_stamp) date_hex = self.hexa("03", "14", time_stamp)
total_with_vat_hex = self.hexa("04", "0a", str(round(self.amount_total, 2))) total_with_vat_hex = self.hexa("04", "0a",
total_vat_hex = self.hexa("05", "09", str(round(self.amount_tax, 2))) str(round(self.amount_total, 2)))
qr_hex = seller_hex + vat_hex + date_hex + total_with_vat_hex + total_vat_hex total_vat_hex = self.hexa("05", "09",
str(round(self.amount_tax, 2)))
qr_hex = (seller_hex + vat_hex + date_hex + total_with_vat_hex +
total_vat_hex)
encoded_base64_bytes = base64.b64encode(bytes.fromhex(qr_hex)).decode() encoded_base64_bytes = base64.b64encode(bytes.fromhex(qr_hex)).decode()
return encoded_base64_bytes return encoded_base64_bytes
@api.depends('state') @api.depends('state')
def generate_qrcode(self): def generate_qrcode(self):
"""Generate and save QR code after the invoice is posted."""
param = self.env['ir.config_parameter'].sudo() param = self.env['ir.config_parameter'].sudo()
qr_code = param.get_param('advanced_vat_invoice.generate_qr') qr_code = param.get_param('advanced_vat_invoice.generate_qr')
for rec in self: for rec in self:
@ -107,9 +126,12 @@ class InheritAccountMove(models.Model):
qr_image = base64.b64encode(temp.getvalue()) qr_image = base64.b64encode(temp.getvalue())
rec.qr = qr_image rec.qr = qr_image
else: else:
raise UserError(_('Necessary Requirements To Run This Operation Is Not Satisfied')) raise UserError(
_('Necessary Requirements To Run This Operation Is '
'Not Satisfied'))
def generate_qr_button(self): def generate_qr_button(self):
"""Manually generate and save QR code."""
param = self.env['ir.config_parameter'].sudo() param = self.env['ir.config_parameter'].sudo()
qr_code = param.get_param('advanced_vat_invoice.generate_qr') qr_code = param.get_param('advanced_vat_invoice.generate_qr')
for rec in self: for rec in self:
@ -129,4 +151,6 @@ class InheritAccountMove(models.Model):
qr_image = base64.b64encode(temp.getvalue()) qr_image = base64.b64encode(temp.getvalue())
rec.qr = qr_image rec.qr = qr_image
else: else:
raise UserError(_('Necessary Requirements To Run This Operation Is Not Satisfied')) raise UserError(
_('Necessary Requirements To Run This Operation Is '
'Not Satisfied'))

48
advanced_vat_invoice/models/qr_config.py

@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
######################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>))
#
# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1)
# It is forbidden to publish, distribute, sublicense, or sell copies of the Software
# or modified copies of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
########################################################################################
from odoo import fields, models, api
class QRCode(models.TransientModel):
_inherit = 'res.config.settings'
generate_qr = fields.Selection(
[('automatically', 'Generate QR Code when invoice validate/post'), ('manually', 'Manually Generate')])
is_qr = fields.Boolean("QR Code Generation Configuration")
@api.model
def get_values(self):
res = super(QRCode, self).get_values()
res.update(
generate_qr=self.env['ir.config_parameter'].sudo().get_param('advanced_vat_invoice.generate_qr'),
is_qr=self.env['ir.config_parameter'].sudo().get_param('advanced_vat_invoice.is_qr'),
)
return res
def set_values(self):
super(QRCode, self).set_values()
param = self.env['ir.config_parameter'].sudo()
generate_qr = self.generate_qr and self.generate_qr or False
is_qr = self.is_qr and self.is_qr or False
param.set_param('advanced_vat_invoice.generate_qr', generate_qr)
param.set_param('advanced_vat_invoice.is_qr', is_qr)

55
advanced_vat_invoice/models/res_config_settings.py

@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Athira P S (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
###############################################################################
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
"""Class foe adding qr code generation configuration"""
_inherit = 'res.config.settings'
generate_qr = fields.Selection(
[('automatically', 'Generate QR Code when invoice validate/post'),
('manually', 'Manually Generate')], string="Generate",
help="Select the way of generating QR code")
is_qr = fields.Boolean(string="QR Code",
help="QR code Generation Configuration")
@api.model
def get_values(self):
"""Get the current configuration values."""
res = super(ResConfigSettings, self).get_values()
res.update(
generate_qr=self.env['ir.config_parameter'].sudo().get_param(
'advanced_vat_invoice.generate_qr'),
is_qr=self.env['ir.config_parameter'].sudo().get_param(
'advanced_vat_invoice.is_qr'),
)
return res
def set_values(self):
"""Set the configuration values."""
super(ResConfigSettings, self).set_values()
param = self.env['ir.config_parameter'].sudo()
generate_qr = self.generate_qr and self.generate_qr or False
is_qr = self.is_qr and self.is_qr or False
param.set_param('advanced_vat_invoice.generate_qr', generate_qr)
param.set_param('advanced_vat_invoice.is_qr', is_qr)

45
advanced_vat_invoice/report/account_move_reports.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- VAT Invoice Report -->
<record id="action_report_vat_report" model="ir.actions.report">
<field name="name">VAT Invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.vat_template</field>
<field name="report_file">advanced_vat_invoice.vat_template</field>
<field name="binding_model_id" eval="False"/>
<field name="binding_type">report</field>
</record>
<!-- Report action for VAT invoice report-->
<record id="action_vat_invoice" model="ir.actions.report">
<field name="name">VAT Invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.vat_template</field>
<field name="report_file">advanced_vat_invoice.vat_template</field>
<field name="print_report_name">(object._get_report_base_filename())</field>
<field name="binding_model_id" ref="model_account_move"/>
<field name="binding_type">report</field>
</record>
<!-- Simplified Tax Report -->
<record id="action_report_simplified_report" model="ir.actions.report">
<field name="name">Simplified Tax</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.simplified_tax_template</field>
<field name="report_file">advanced_vat_invoice.simplified_tax_template</field>
<field name="binding_model_id" eval="False"/>
<field name="binding_type">report</field>
</record>
<!-- Report action for simplified VAT invoice report-->
<record id="action_tax_invoice" model="ir.actions.report">
<field name="name">Simplified Tax invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.simplified_tax_template</field>
<field name="report_file">advanced_vat_invoice.simplified_tax_template</field>
<field name="print_report_name">(object._get_report_base_filename())</field>
<field name="binding_model_id" ref="model_account_move"/>
<field name="binding_type">report</field>
</record>
</odoo>

22
advanced_vat_invoice/report/invoice_pdf.xml

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_report_vat_report" model="ir.actions.report">
<field name="name">VAT Invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.vat_template</field>
<field name="report_file">advanced_vat_invoice.vat_template</field>
<field name="binding_model_id" eval="False"/>
<field name="binding_type">report</field>
</record>
<record id="action_report_simplified_report" model="ir.actions.report">
<field name="name">Simplified Tax</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.simplified_tax_template</field>
<field name="report_file">advanced_vat_invoice.simplified_tax_template</field>
<field name="binding_model_id" eval="False"/>
<field name="binding_type">report</field>
</record>
</odoo>

127
advanced_vat_invoice/report/simplified_tax_report_template.xml

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="simplified_tax_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h4>
<center>
<span class="text-right">فاتورة ضريبية مبسطة</span>
<br/>
<span>Simplified Tax Invoice</span>
</center>
</h4>
</div>
<br/>
<div>
<div style="float:left !important;">
<span>Invoice Number :</span>
<t t-esc="doc.name"></t>
<br/>
<span>Issue Date:</span>
<t t-esc="doc.invoice_date"/>
</div>
<div style="float:right !important;">
<img t-attf-src="data:image/png;base64, {{doc.qr}}"/>
</div>
</div>
<br/>
<table style="border:2pt solid grey;width:100%;color:black;" class="table-condensed">
<thead>
<tr style="background-color:#DCDCDC">
<td width="40%" style="border:2pt solid grey;text-align:center;padding:2pt;">
Description
<br/>
<span class="description">تفاصيل السلع أو الخدمات</span>
</td>
<td width="20%" style="border:2pt solid grey;text-align:center;padding:2pt;">
Unit Price
<br/>
<span class="unit_price">سعر الوحدة</span>
</td>
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt;width:7%">
Quantity
<br/>
<span class="qty"/>
الكمية
</td>
<td width="20%" style="border:2pt solid grey;text-align:center;padding:2pt;">
Total
<br/>
(excl.vat)
<br/>
<span class="total">المجموع (شامل ضريبة القيمة المضافة)</span>
</td>
</tr>
</thead>
<t t-set="tax_total" t-value="0"/>
<tbody class="invoice_line">
<tr t-foreach="doc.invoice_line_ids" t-as="line">
<t t-set="line_tax_total" t-value="0"/>
<t t-foreach="line.tax_ids" t-as="tax">
<t t-set="tax_total" t-value="tax_total + line.price_subtotal* tax.amount/100"/>
<t t-set="line_tax_total" t-value="line_tax_total + tax.amount"/>
</t>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-field="line.name"/>
<br/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-field="line.price_unit" t-options='{" widget": "monetary", "
display_currency": doc.currency_id}'/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-esc="'%.2f %s '%(line.quantity,line.product_uom_id.name)"/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-field="line.price_subtotal" t-options='{" widget": "monetary", "
display_currency": doc.currency_id}'/>
</td>
</tr>
</tbody>
</table>
<br/>
<table style="border:2pt solid grey;width:100%;color:black;"
class="table table-bordered table-sm">
<thead>
<tr>
<td width="40%" style="font-weight: bold;text-align:left;padding:2pt">Total Taxable
Amount (excl. VAT)
</td>
<td class="amount" width="40%" style="text-align:right;padding:2pt">إجمالي المبلغ
الخاضع للضريبة (غير شامل ضريبة القيمة المضافة)
</td>
<td width="40%" style="text-align:right;padding:2pt" class="text-right">
<span t-esc="doc.amount_untaxed"/>
</td>
</tr>
<tr>
<td style="font-weight: bold;text-align:left;padding:3pt">Total VAT</td>
<td class="total" style="text-align:right;padding:3pt">مجموع ضريبة القيمة المضافة
</td>
<td style="text-align:right;padding:3pt" class="text-right">
<span t-esc="tax_total"/>
</td>
</tr>
<tr>
<td style="font-weight: bold;text-align:left;padding:3pt">Amount Due</td>
<td class="due" style="text-align:right;padding:3pt">اجمالي المبلغ المستحق</td>
<td style="text-align:right;padding:3pt" class="text-right">
<span t-esc="doc.amount_residual"/>
</td>
</tr>
</thead>
</table>
<br/>
</t>
</t>
</t>
</template>
</data>
</odoo>

155
advanced_vat_invoice/report/simplified_tax_report_templates.xml

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--Template for simplified tax report-->
<template id="simplified_tax_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h4>
<center>
<span class="text-right">فاتورة ضريبية مبسطة
</span>
<br/>
<span>Simplified Tax Invoice</span>
</center>
</h4>
</div>
<br/>
<div>
<div style="float:left !important;">
<span>Invoice Number :</span>
<t t-esc="doc.name"/>
<br/>
<span>Issue Date:</span>
<t t-esc="doc.invoice_date"/>
</div>
<div style="float:right !important;">
<img t-attf-src="data:image/png;base64, {{doc.qr}}"/>
</div>
</div>
<br/>
<table style="border:2pt solid grey;width:100%;color:black;"
class="table-condensed">
<thead>
<tr style="background-color:#DCDCDC">
<td width="40%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
Description
<br/>
<span class="description">تفاصيل السلع أو
الخدمات
</span>
</td>
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
Unit Price
<br/>
<span class="unit_price">سعر الوحدة</span>
</td>
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt;width:7%">
Quantity
<br/>
<span class="qty"/>
الكمية
</td>
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
Total
<br/>
(excl.vat)
<br/>
<span class="total">المجموع (شامل ضريبة
القيمة المضافة)
</span>
</td>
</tr>
</thead>
<t t-set="tax_total" t-value="0"/>
<tbody class="invoice_line">
<tr t-foreach="doc.invoice_line_ids" t-as="line">
<t t-set="line_tax_total" t-value="0"/>
<t t-foreach="line.tax_ids" t-as="tax">
<t t-set="tax_total"
t-value="tax_total + line.price_subtotal* tax.amount/100"/>
<t t-set="line_tax_total"
t-value="line_tax_total + tax.amount"/>
</t>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-field="line.name"/>
<br/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-field="line.price_unit" t-options='{" widget": "monetary", "
display_currency": doc.currency_id}'/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-esc="'%.2f %s '%(line.quantity,line.product_uom_id.name)"/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-field="line.price_subtotal"
t-options='{" widget": "monetary", "
display_currency": doc.currency_id}'/>
</td>
</tr>
</tbody>
</table>
<br/>
<table style="border:2pt solid grey;width:100%;color:black;"
class="table table-bordered table-sm">
<thead>
<tr>
<td width="40%"
style="font-weight: bold;text-align:left;padding:2pt">
Total Taxable
Amount (excl. VAT)
</td>
<td class="amount" width="40%"
style="text-align:right;padding:2pt">إجمالي
المبلغ
الخاضع للضريبة (غير شامل ضريبة القيمة
المضافة)
</td>
<td width="40%"
style="text-align:right;padding:2pt"
class="text-right">
<span t-esc="doc.amount_untaxed"/>
</td>
</tr>
<tr>
<td style="font-weight: bold;text-align:left;padding:3pt">
Total VAT
</td>
<td class="total"
style="text-align:right;padding:3pt">مجموع
ضريبة القيمة المضافة
</td>
<td style="text-align:right;padding:3pt"
class="text-right">
<span t-esc="tax_total"/>
</td>
</tr>
<tr>
<td style="font-weight: bold;text-align:left;padding:3pt">
Amount Due
</td>
<td class="due"
style="text-align:right;padding:3pt">اجمالي
المبلغ المستحق
</td>
<td style="text-align:right;padding:3pt"
class="text-right">
<span t-esc="doc.amount_residual"/>
</td>
</tr>
</thead>
</table>
<br/>
</t>
</t>
</t>
</template>
</odoo>

352
advanced_vat_invoice/report/vat_invoice_report_template.xml

@ -1,352 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="vat_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h4>
<center>
<span class="text-right">فاتورة ضريبية مبسطة</span>
<br/>
<span>VAT Invoice</span>
</center>
</h4>
</div>
<div>
<table>
<tr style="border:2pt solid grey;">
<td width="16%">
<span/>Invoice Number
</td>
<td width="16%">
<span>رقم الفاتورة</span>
</td>
<td width="16%">
<t t-esc="doc.name"/>
</td>
</tr>
<br/>
</table>
</div>
<br/>
<div class="row mt32 mb32">
<div class="col-9" style="color:black; ">
<table style="border:2pt solid grey;width:100%;padding:10pt;color:black;"
class="table table-bordered table-sm">
<tr>
<td style="font-weight:bold; width:25%;">Invoice Issue Date:</td>
<td class="issue" style="width:25%; text-align:right;">رقم الفاتورة</td>
<td style="width:30%; text-align:center;">
<t t-esc="doc.invoice_date"/>
</td>
</tr>
<tr>
<td style="font-weight:bold; width:25%;">Due Date:</td>
<td class="due" style="width:25%; text-align:right;">تاريخ الاستحقاق</td>
<td style="width:30%; text-align:center;">
<t t-esc="doc.invoice_payment_term_id.name"></t>
</td>
</tr>
</table>
<br/>
</div>
<div class="col-3" style="margin-top: -8pt; padding-left:30pt;">
<img t-attf-src="data:image/png;base64, {{doc.qr}}"/>
</div>
</div><br/>
<table style="border:2pt solid grey;width:100%;color:black; margin-top:0pt; color:black;"
class="table-condensed">
<thead>
<tr style="background-color:#DCDCDC">
<td width="15%" style="border:2pt solid grey;text-align:center;padding:2pt; ">
seller
</td>
<td width="15%" style="border:2pt solid grey;text-align:center;padding:2pt;">
تاجر
</td>
<td width="20%" style="border:2pt solid grey;text-align:center;padding:2pt;">
</td>
<td width="15%" style="border:2pt solid grey;text-align:center;padding:2pt; ">
Buyer
</td>
<td width="15%" style="border:2pt solid grey;text-align:center;padding:2pt; ">
مشتر
</td>
<td width="20%" style="border:2pt solid grey;text-align:center;padding:2pt;">
</td>
</tr>
</thead>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Name:
</td>
<td width="15%" style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.name"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<span>Name:</span>
</td>
<td width="15%" style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.name"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Street Name:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم الشارع
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.street"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Street Name:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم الشارع
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.street"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
District:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
منطقة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.city"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
District:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
منطقة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.city"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;width:8%">
State:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
حالة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.state_id.name"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
State:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
حالة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.state_id.name"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
Country:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
بلد
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.country_id.name"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Country:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
بلد
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.country_id.name"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
PIN Code:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
الرمز البريدي
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.zip"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
PIN Code:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
الرمز البريدي
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.zip"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Phone Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
رقم الهاتف
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.phone"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Phone Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
رقم الهاتف
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.phone"></t>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
VAT Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
ظريبه الشراء
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.vat"></t>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
VAT Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
ظريبه الشراء
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.vat"></t>
</td>
</tr>
</table>
<br/>
<table style="border:2pt solid grey;width:100%; height: 23px;color:black; margin-top:10pt;"
class="table-condensed table-sm">
<tr>
<td style="padding:2pt;margin:0pt;font-weight: bold;text-align:center;">
<span class="text-right arabic">Order Line Items/البنود</span>
</td>
</tr>
</table>
<table style="border:2pt solid grey;width:100%;color:black; margin-top:0pt; color:black;"
class="table-condensed">
<thead>
<tr style="background-color:#DCDCDC">
<td width="20%" style="border:2pt solid grey;text-align:center;padding:2pt; ">
product Name
<br/>
<span class="product">تفاصيل السلع أو الخدمات</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Unit Price
<br/>
<span class="price">سعر الوحدة</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;width:7%">
Quantity
<br/>
<span class="qty">الكمية</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Tax Amount
<br/>
<span class="tax">المبلغ الخاضع للضريبة</span>
</td>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
Discount Price
<br/>
<span class="discount">خصومات</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;width:8%">
Tax Rate
<br/>
<span class="tax_rate">نسبة الضريبة</span>
</td>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
Tax Amount
<br/>
<span class="amount">مبلغ الضريبة</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Subtotal
<br/>
(excl.vat)
<br/>
<span class="sub_total">المجموع (شامل ضريبة القيمة المضافة)</span>
</td>
</tr>
</thead>
<t t-set="tax_total" t-value="0"/>
<t t-set="discount_total" t-value="0"/>
<tbody class="invoice_line">
<tr t-foreach="doc.invoice_line_ids" t-as="line">
<t t-set="line_tax_total" t-value="0"/>
<t t-foreach="line.tax_ids" t-as="tax">
<t t-set="tax_total"
t-value="tax_total + line.price_subtotal* tax.amount/100"/>
<t t-set="line_tax_total"
t-value="line_tax_total + tax.amount"/>
</t>
<t t-set="discount_total"
t-value="discount_total + ((line.price_unit * line.quantity) - line.price_subtotal)"/>
<td style="border-right:2pt solid grey;padding:3pt">
<span t-field="line.name"/>
<br/>
</td>
<td style="border-right:2pt solid grey;text-align:right;padding:3pt">
<span t-field="line.price_unit"/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-esc="'%.2f %s '%(line.quantity,line.product_uom_id.name)"/>
</td>
<td style="padding:2pt;border-right:2pt solid grey;text-align:right;">
<sapn t-esc="line.price_unit * line.quantity"/>
</td>
<td style="border-right:2pt solid grey;text-align:right;padding:3pt;">
<span t-field="line.discount"/>%
</td>
<td style="border-right:2pt solid grey;padding:2pt;text-align:center;">
<t t-foreach="line.tax_ids" t-as="tax">
<span t-esc="'%.2f'%(tax.amount)"/>%
</t>
<span t-if="not line.tax_ids">0.0 %</span>
</td>
<td style="padding:2pt;border-right:2pt solid grey;text-align:right;">
<t t-set="line_tax_total"
t-value="line.price_subtotal*line_tax_total/100"/>
<sapn t-esc="line_tax_total"/>
</td>
<td style="border-right:2pt solid grey;text-align:right;padding:3pt">
<span t-field="line.price_subtotal"/>
</td>
</tr>
</tbody>
</table>
</t>
</t>
</t>
</template>
</data>
</odoo>

379
advanced_vat_invoice/report/vat_invoice_report_templates.xml

@ -0,0 +1,379 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--Template for VAT invoice report-->
<template id="vat_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h4>
<center>
<span class="text-right">فاتورة ضريبية مبسطة
</span>
<br/>
<span>VAT Invoice</span>
</center>
</h4>
</div>
<div>
<table>
<tr style="border:2pt solid grey;">
<td width="16%">
<span/>Invoice Number
</td>
<td width="16%">
<span>رقم الفاتورة</span>
</td>
<td width="16%">
<t t-esc="doc.name"/>
</td>
</tr>
<br/>
</table>
</div>
<br/>
<div class="row mt32 mb32">
<div class="col-9" style="color:black; ">
<table style="border:2pt solid grey;width:100%;padding:10pt;color:black;"
class="table table-bordered table-sm">
<tr>
<td style="font-weight:bold; width:25%;">
Invoice Issue Date:
</td>
<td class="issue"
style="width:25%; text-align:right;">
رقم الفاتورة
</td>
<td style="width:30%; text-align:center;">
<t t-esc="doc.invoice_date"/>
</td>
</tr>
<tr>
<td style="font-weight:bold; width:25%;">
Due Date:
</td>
<td class="due"
style="width:25%; text-align:right;">
تاريخ الاستحقاق
</td>
<td style="width:30%; text-align:center;">
<t t-esc="doc.invoice_payment_term_id.name"/>
</td>
</tr>
</table>
<br/>
</div>
<div class="col-3"
style="margin-top: -8pt; padding-left:30pt;">
<img t-attf-src="data:image/png;base64, {{doc.qr}}"/>
</div>
</div>
<br/>
<table style="border:2pt solid grey;width:100%;color:black; margin-top:0pt; color:black;"
class="table-condensed">
<thead>
<tr style="background-color:#DCDCDC">
<td width="15%"
style="border:2pt solid grey;text-align:center;padding:2pt; ">
seller
</td>
<td width="15%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
تاجر
</td>
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
</td>
<td width="15%"
style="border:2pt solid grey;text-align:center;padding:2pt; ">
Buyer
</td>
<td width="15%"
style="border:2pt solid grey;text-align:center;padding:2pt; ">
مشتر
</td>
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
</td>
</tr>
</thead>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Name:
</td>
<td width="15%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.name"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<span>Name:</span>
</td>
<td width="15%"
style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.name"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Street Name:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم الشارع
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.street"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Street Name:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
اسم الشارع
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.street"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
District:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
منطقة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.city"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
District:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
منطقة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.city"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;width:8%">
State:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
حالة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.state_id.name"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
State:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
حالة
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.state_id.name"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
Country:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
بلد
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.country_id.name"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Country:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
بلد
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.country_id.name"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
PIN Code:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
الرمز البريدي
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.zip"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
PIN Code:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
الرمز البريدي
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.zip"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Phone Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
رقم الهاتف
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.phone"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Phone Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
رقم الهاتف
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.phone"/>
</td>
</tr>
<tr>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
VAT Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
ظريبه الشراء
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.company_id.vat"/>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
VAT Number:
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
ظريبه الشراء
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
<t t-esc="doc.partner_id.vat"/>
</td>
</tr>
</table>
<br/>
<table style="border:2pt solid grey;width:100%; height: 23px;color:black; margin-top:10pt;"
class="table-condensed table-sm">
<tr>
<td style="padding:2pt;margin:0pt;font-weight: bold;text-align:center;">
<span class="text-right arabic">Order Line
Items/البنود
</span>
</td>
</tr>
</table>
<table style="border:2pt solid grey;width:100%;color:black; margin-top:0pt; color:black;"
class="table-condensed">
<thead>
<tr style="background-color:#DCDCDC">
<td width="20%"
style="border:2pt solid grey;text-align:center;padding:2pt; ">
product Name
<br/>
<span class="product">تفاصيل السلع أو
الخدمات
</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Unit Price
<br/>
<span class="price">سعر الوحدة</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;width:7%">
Quantity
<br/>
<span class="qty">الكمية</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Tax Amount
<br/>
<span class="tax">المبلغ الخاضع للضريبة
</span>
</td>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
Discount Price
<br/>
<span class="discount">خصومات</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;width:8%">
Tax Rate
<br/>
<span class="tax_rate">نسبة الضريبة</span>
</td>
<td style="border:2pt solid grey;text-align:center; width:10%;padding:2pt">
Tax Amount
<br/>
<span class="amount">مبلغ الضريبة</span>
</td>
<td style="border:2pt solid grey;text-align:center;padding:2pt;">
Subtotal
<br/>
(excl.vat)
<br/>
<span class="sub_total">المجموع (شامل ضريبة
القيمة المضافة)
</span>
</td>
</tr>
</thead>
<t t-set="tax_total" t-value="0"/>
<t t-set="discount_total" t-value="0"/>
<tbody class="invoice_line">
<tr t-foreach="doc.invoice_line_ids" t-as="line">
<t t-set="line_tax_total" t-value="0"/>
<t t-foreach="line.tax_ids" t-as="tax">
<t t-set="tax_total"
t-value="tax_total + line.price_subtotal* tax.amount/100"/>
<t t-set="line_tax_total"
t-value="line_tax_total + tax.amount"/>
</t>
<t t-set="discount_total"
t-value="discount_total + ((line.price_unit * line.quantity) - line.price_subtotal)"/>
<td style="border-right:2pt solid grey;padding:3pt">
<span t-field="line.name"/>
<br/>
</td>
<td style="border-right:2pt solid grey;text-align:right;padding:3pt">
<span t-field="line.price_unit"/>
</td>
<td style="border-right:2pt solid grey;text-align:center;padding:3pt">
<span t-esc="'%.2f %s '%(line.quantity,line.product_uom_id.name)"/>
</td>
<td style="padding:2pt;border-right:2pt solid grey;text-align:right;">
<sapn t-esc="line.price_unit * line.quantity"/>
</td>
<td style="border-right:2pt solid grey;text-align:right;padding:3pt;">
<span t-field="line.discount"/>%
</td>
<td style="border-right:2pt solid grey;padding:2pt;text-align:center;">
<t t-foreach="line.tax_ids" t-as="tax">
<span t-esc="'%.2f'%(tax.amount)"/>%
</t>
<span t-if="not line.tax_ids">0.0 %</span>
</td>
<td style="padding:2pt;border-right:2pt solid grey;text-align:right;">
<t t-set="line_tax_total"
t-value="line.price_subtotal*line_tax_total/100"/>
<sapn t-esc="line_tax_total"/>
</td>
<td style="border-right:2pt solid grey;text-align:right;padding:3pt">
<span t-field="line.price_subtotal"/>
</td>
</tr>
</tbody>
</table>
</t>
</t>
</t>
</template>
</odoo>

2
advanced_vat_invoice/security/ir.model.access.csv

@ -1,2 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_report_saudi_vat_invoice_vat_template,report.saudi_vat_invoice.vat_template,model_report_saudi_vat_invoice_vat_template,base.group_user,1,1,1,1 access_report_saudi_vat_invoice_vat_template,access.report.saudi_vat_invoice.vat_template,model_report_saudi_vat_invoice_vat_template,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_report_saudi_vat_invoice_vat_template report.saudi_vat_invoice.vat_template access.report.saudi_vat_invoice.vat_template model_report_saudi_vat_invoice_vat_template base.group_user 1 1 1 1

BIN
advanced_vat_invoice/static/description/assets/modules/1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 132 KiB

BIN
advanced_vat_invoice/static/description/assets/modules/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 94 KiB

BIN
advanced_vat_invoice/static/description/assets/modules/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 84 KiB

BIN
advanced_vat_invoice/static/description/assets/modules/4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 132 KiB

BIN
advanced_vat_invoice/static/description/assets/modules/5.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

BIN
advanced_vat_invoice/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
advanced_vat_invoice/static/description/assets/modules/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 84 KiB

12
advanced_vat_invoice/static/description/index.html

@ -199,7 +199,7 @@
<div class="carousel-inner" style="padding: 30px;"> <div class="carousel-inner" style="padding: 30px;">
<div class="carousel-item" style="min-height: 198.656px;"> <div class="carousel-item" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left"> <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/dynamic_accounts_report/" target="_blank"> <a href="https://apps.odoo.com/apps/modules/16.0/payment_details_invoice_report/" target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;" <img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/1.png"> src="assets/modules/1.png">
@ -207,7 +207,7 @@
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left"> <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/custom_gantt_view/" target="_blank"> <a href="https://apps.odoo.com/apps/modules/16.0/thermal_invoice_report/" target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;" <img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/2.png"> src="assets/modules/2.png">
@ -215,7 +215,7 @@
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left"> <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/project_custom_gantt/" target="_blank"> <a href="https://apps.odoo.com/apps/modules/16.0/dynamic_accounts_report/" target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;" <img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/3.png"> src="assets/modules/3.png">
@ -225,7 +225,7 @@
</div> </div>
<div class="carousel-item active" style="min-height: 198.656px;"> <div class="carousel-item active" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left"> <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/account_reports_xlsx/" target="_blank"> <a href="https://apps.odoo.com/apps/modules/16.0/payment_details_invoice_report/" target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;" <img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/4.png"> src="assets/modules/4.png">
@ -233,7 +233,7 @@
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left"> <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/base_accounting_kit/" target="_blank"> <a href="https://apps.odoo.com/apps/modules/16.0/automatic_invoice_and_post/" target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;" <img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/5.png"> src="assets/modules/5.png">
@ -241,7 +241,7 @@
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left"> <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/hr_payroll_community/" target="_blank"> <a href="https://apps.odoo.com/apps/modules/16.0/product_brand_invoicing/" target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" style="border-radius: 0px;" <img class="img img-responsive center-block" style="border-radius: 0px;"
src="assets/modules/6.png"> src="assets/modules/6.png">

20
advanced_vat_invoice/views/qrcode_in_invoices.xml → advanced_vat_invoice/views/account_move_views.xml

@ -1,23 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="invoice_view_form" model="ir.ui.view"> <!-- Account move views for adding a field-->
<field name="name">res.invoice.form.inherit</field> <record id="view_move_form" model="ir.ui.view">
<field name="name">
account.move.view.form.inherit.advanced.vat.invoice
</field>
<field name="model">account.move</field> <field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/> <field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//notebook/page[@id='other_tab']" position="after"> <xpath expr="//notebook/page[@id='other_tab']" position="after">
<page string="QR Code"> <page string="QR Code"
attrs="{'visible': [('qr_button', '=', True)]}">
<group> <group>
<group> <group>
<label for="qr"/> <label for="qr"/>
<field name="qr" widget='image' nolabel="1" attrs="{'invisible': [('state', '!=', 'posted')]}"/> <field name="qr" widget='image' nolabel="1"
attrs="{'invisible': [('state', '!=', 'posted')]}"/>
<field name="qr_button" invisible="1"/>
</group> </group>
</group> </group>
</page> </page>
</xpath> </xpath>
<xpath expr="header" position="inside"> <xpath expr="header" position="inside">
<button name="generate_qr_button" string="Generate QR" type="object"/> <button name="generate_qr_button" string="Generate QR"
type="object"
attrs="{'invisible': [('qr_button', '=', False)]}"/>
</xpath> </xpath>
</field> </field>
</record> </record>
</odoo> </odoo>

14
advanced_vat_invoice/views/qr_config.xml → advanced_vat_invoice/views/res_config_settings_views.xml

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="setting_inherit" model="ir.ui.view"> <!-- Res config settings view for adding new boolean fields-->
<field name="name">accounting.setting.form.inherit</field> <record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">
res.config.settings.view.form.inherit.advanced.vat.invoice
</field>
<field name="model">res.config.settings</field> <field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/> <field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -10,7 +13,7 @@
<div class="row mt16 o_settings_container" id="account_qr"> <div class="row mt16 o_settings_container" id="account_qr">
<div class="col-xs-12 col-md-6 o_setting_box" id="show_qr"> <div class="col-xs-12 col-md-6 o_setting_box" id="show_qr">
<div class="o_setting_left_pane"> <div class="o_setting_left_pane">
<field name="is_qr" widget="upgrade_boolean"/> <field name="is_qr"/>
</div> </div>
<div class="o_setting_right_pane" name="is_qr_right"> <div class="o_setting_right_pane" name="is_qr_right">
<label for="is_qr"/> <label for="is_qr"/>
@ -19,7 +22,8 @@
</div> </div>
<br/> <br/>
<div id="qr_code" class="content-group"> <div id="qr_code" class="content-group">
<field name="generate_qr" widget="radio" attrs="{'invisible': [('is_qr', '=', False)]}"/> <field name="generate_qr" widget="radio"
attrs="{'invisible': [('is_qr', '=', False)]}"/>
</div> </div>
</div> </div>
</div> </div>
@ -27,4 +31,4 @@
</xpath> </xpath>
</field> </field>
</record> </record>
</odoo> </odoo>

25
advanced_vat_invoice/views/vat_invoice_in_action.xml

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="action_vat_invoice" model="ir.actions.report">
<field name="name">VAT Invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.vat_template</field>
<field name="report_file">advanced_vat_invoice.vat_template</field>
<field name="print_report_name">(object._get_report_base_filename())</field>
<field name="binding_model_id" ref="model_account_move"/>
<field name="binding_type">report</field>
</record>
<record id="action_tax_invoice" model="ir.actions.report">
<field name="name">Simplified Tax invoice</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_vat_invoice.simplified_tax_template</field>
<field name="report_file">advanced_vat_invoice.simplified_tax_template</field>
<field name="print_report_name">(object._get_report_base_filename())</field>
<field name="binding_model_id" ref="model_account_move"/>
<field name="binding_type">report</field>
</record>
</odoo>
Loading…
Cancel
Save