Browse Source

Jan 11 [UPDT] : Updated 'advanced_vat_invoice'

pull/301/head
AjmalCybro 1 year ago
parent
commit
bc6fbf2cfa
  1. 2
      advanced_vat_invoice/__init__.py
  2. 2
      advanced_vat_invoice/__manifest__.py
  3. 2
      advanced_vat_invoice/doc/RELEASE_NOTES.md
  4. 2
      advanced_vat_invoice/models/__init__.py
  5. 28
      advanced_vat_invoice/models/account_move.py
  6. 6
      advanced_vat_invoice/models/res_config_settings.py
  7. 2
      advanced_vat_invoice/report/simplified_tax_report_templates.xml
  8. 1
      advanced_vat_invoice/report/vat_invoice_report_templates.xml
  9. 5
      advanced_vat_invoice/views/account_move_views.xml
  10. 2
      advanced_vat_invoice/views/res_config_settings_views.xml

2
advanced_vat_invoice/__init__.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Athira P S (odoo@cybrosys.com) # Author: Athira P S (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

2
advanced_vat_invoice/__manifest__.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Athira P S (odoo@cybrosys.com) # Author: Athira P S (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

2
advanced_vat_invoice/doc/RELEASE_NOTES.md

@ -1,6 +1,6 @@
## Module <advanced_vat_invoice> ## Module <advanced_vat_invoice>
#### 25.08.2023 #### 11.01.2024
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
##### ADD ##### ADD

2
advanced_vat_invoice/models/__init__.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Athira P S (odoo@cybrosys.com) # Author: Athira P S (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO

28
advanced_vat_invoice/models/account_move.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Athira P S (odoo@cybrosys.com) # Author: Athira P S (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
@ -43,8 +43,10 @@ class AccountMove(models.Model):
qr = fields.Binary(string="QR Code", compute='generate_qrcode', store=True, qr = fields.Binary(string="QR Code", compute='generate_qrcode', store=True,
help="QR code") help="QR code")
qr_button = fields.Boolean(struct="Qr Button", compute="_compute_qr", qr_button = fields.Boolean(string="Qr Button", compute="_compute_qr",
help="Is QR button is enable or not") help="Is QR button is enable or not")
qr_page = fields.Boolean(string="Qr Page", compute="_compute_qr",
help="Is QR page is enable or not")
@api.depends('qr_button') @api.depends('qr_button')
def _compute_qr(self): def _compute_qr(self):
@ -52,7 +54,15 @@ class AccountMove(models.Model):
for record in self: for record in self:
qr_code = self.env['ir.config_parameter'].sudo().get_param( qr_code = self.env['ir.config_parameter'].sudo().get_param(
'advanced_vat_invoice.is_qr') 'advanced_vat_invoice.is_qr')
record.qr_button = qr_code == 'True' qr_code_generate_method = self.env[
'ir.config_parameter'].sudo().get_param(
'advanced_vat_invoice.generate_qr')
record.qr_button = True if qr_code and qr_code_generate_method == 'manually' else False
record.qr_page = True if (qr_code and record.state in ['posted',
'cancelled']
and qr_code_generate_method == 'manually'
or qr_code_generate_method == 'automatically') \
else False
def timezone(self, userdate): def timezone(self, userdate):
"""Function to convert a user's date to their timezone.""" """Function to convert a user's date to their timezone."""
@ -94,10 +104,18 @@ class AccountMove(models.Model):
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)
amount_total = self.currency_id._convert(
self.amount_total,
self.env.ref('base.SAR'),
self.env.company, self.invoice_date or fields.Date.today())
total_with_vat_hex = self.hexa("04", "0a", total_with_vat_hex = self.hexa("04", "0a",
str(round(self.amount_total, 2))) str(round(amount_total, 2)))
amount_tax = self.currency_id._convert(
self.amount_tax,
self.env.ref('base.SAR'),
self.env.company, self.invoice_date or fields.Date.today())
total_vat_hex = self.hexa("05", "09", total_vat_hex = self.hexa("05", "09",
str(round(self.amount_tax, 2))) str(round(amount_tax, 2)))
qr_hex = (seller_hex + vat_hex + date_hex + total_with_vat_hex + qr_hex = (seller_hex + vat_hex + date_hex + total_with_vat_hex +
total_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()

6
advanced_vat_invoice/models/res_config_settings.py

@ -3,7 +3,7 @@
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Athira P S (odoo@cybrosys.com) # Author: Athira P S (odoo@cybrosys.com)
# #
# You can modify it under the terms of the GNU AFFERO # You can modify it under the terms of the GNU AFFERO
@ -36,7 +36,7 @@ class ResConfigSettings(models.TransientModel):
@api.model @api.model
def get_values(self): def get_values(self):
"""Get the current configuration values.""" """Get the current configuration values."""
res = super(ResConfigSettings, self).get_values() res = super().get_values()
res.update( res.update(
generate_qr=self.env['ir.config_parameter'].sudo().get_param( generate_qr=self.env['ir.config_parameter'].sudo().get_param(
'advanced_vat_invoice.generate_qr'), 'advanced_vat_invoice.generate_qr'),
@ -47,7 +47,7 @@ class ResConfigSettings(models.TransientModel):
def set_values(self): def set_values(self):
"""Set the configuration values.""" """Set the configuration values."""
super(ResConfigSettings, self).set_values() super().set_values()
param = self.env['ir.config_parameter'].sudo() param = self.env['ir.config_parameter'].sudo()
generate_qr = self.generate_qr and self.generate_qr or False generate_qr = self.generate_qr and self.generate_qr or False
is_qr = self.is_qr and self.is_qr or False is_qr = self.is_qr and self.is_qr or False

2
advanced_vat_invoice/report/simplified_tax_report_templates.xml

@ -116,6 +116,7 @@
<td width="40%" <td width="40%"
style="text-align:right;padding:2pt" style="text-align:right;padding:2pt"
class="text-right"> class="text-right">
<span t-esc="doc.currency_id.symbol"/>
<span t-esc="doc.amount_untaxed"/> <span t-esc="doc.amount_untaxed"/>
</td> </td>
</tr> </tr>
@ -142,6 +143,7 @@
</td> </td>
<td style="text-align:right;padding:3pt" <td style="text-align:right;padding:3pt"
class="text-right"> class="text-right">
<span t-esc="doc.currency_id.symbol"/>
<span t-esc="doc.amount_residual"/> <span t-esc="doc.amount_residual"/>
</td> </td>
</tr> </tr>

1
advanced_vat_invoice/report/vat_invoice_report_templates.xml

@ -69,7 +69,6 @@
</div> </div>
</div> </div>
<br/> <br/>
<table style="border:2pt solid grey;width:100%;color:black; margin-top:0pt; color:black;" <table style="border:2pt solid grey;width:100%;color:black; margin-top:0pt; color:black;"
class="table-condensed"> class="table-condensed">
<thead> <thead>

5
advanced_vat_invoice/views/account_move_views.xml

@ -10,13 +10,14 @@
<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)]}"> attrs="{'visible': [('qr_page', '!=', True)]}">
<group> <group>
<group> <group>
<label for="qr"/> <label for="qr"/>
<field name="qr" widget='image' nolabel="1" <field name="qr" widget='image' nolabel="1"
attrs="{'invisible': [('state', '!=', 'posted')]}"/> attrs="{'invisible': [('state', '!=', 'posted')]}"/>
<field name="qr_button" invisible="1"/> <field name="qr_button" invisible="1"/>
<field name="qr_page" invisible="1"/>
</group> </group>
</group> </group>
</page> </page>
@ -24,7 +25,7 @@
<xpath expr="header" position="inside"> <xpath expr="header" position="inside">
<button name="generate_qr_button" string="Generate QR" <button name="generate_qr_button" string="Generate QR"
type="object" type="object"
attrs="{'invisible': [('qr_button', '=', False)]}"/> attrs="{'invisible': ['|',('qr_button', '=', False),('state', '!=', 'posted')]}"/>
</xpath> </xpath>
</field> </field>
</record> </record>

2
advanced_vat_invoice/views/res_config_settings_views.xml

@ -9,7 +9,7 @@
<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">
<xpath expr="//div[@id='account_vendor_bills']" position="after"> <xpath expr="//div[@id='account_vendor_bills']" position="after">
<h2>QR CODE</h2> <h2>QR Code</h2>
<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">

Loading…
Cancel
Save