Merge branch 'master' into 'master'
[IMP]GST:change field label, fiscal position->Nature of Transection,changes gst excel report format See merge request flectra-hq/flectra!69
This commit is contained in:
commit
bf98f2f23f
@ -43,9 +43,15 @@ class AccountInvoice(models.Model):
|
|||||||
('composite', 'Composite'), ('volunteer', 'Volunteer')],
|
('composite', 'Composite'), ('volunteer', 'Volunteer')],
|
||||||
string='GST Type', copy=False)
|
string='GST Type', copy=False)
|
||||||
partner_location = fields.Selection(
|
partner_location = fields.Selection(
|
||||||
[('inter_state', 'Inter State'), ('intra_state', 'intra State'),
|
[('inter_state', 'Inter State'), ('intra_state', 'Intra State'),
|
||||||
('inter_country', 'Inter Country')],
|
('inter_country', 'Inter Country')],
|
||||||
related='partner_id.partner_location', string="Partner Location")
|
related='partner_id.partner_location', string="Partner Location")
|
||||||
|
fiscal_position_id = fields.Many2one('account.fiscal.position',
|
||||||
|
string='Nature of Transaction',
|
||||||
|
oldname='fiscal_position',
|
||||||
|
readonly=True,
|
||||||
|
states={
|
||||||
|
'draft': [('readonly', False)]})
|
||||||
|
|
||||||
@api.onchange('partner_id', 'company_id')
|
@api.onchange('partner_id', 'company_id')
|
||||||
def _onchange_partner_id(self):
|
def _onchange_partner_id(self):
|
||||||
@ -54,11 +60,12 @@ class AccountInvoice(models.Model):
|
|||||||
self.partner_id.partner_location = \
|
self.partner_id.partner_location = \
|
||||||
self.partner_id._get_partner_location_details(self.company_id)
|
self.partner_id._get_partner_location_details(self.company_id)
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('fiscal_position_id')
|
@api.onchange('fiscal_position_id')
|
||||||
def _onchange_fiscal_position_id(self):
|
def _onchange_fiscal_position_id(self):
|
||||||
""" Onchange of Fiscal Position update tax values in invoice lines. """
|
""" Onchange of Fiscal Position update tax values in invoice lines. """
|
||||||
for line in self.invoice_line_ids:
|
for line in self.invoice_line_ids:
|
||||||
line._onchange_product_id()
|
line._set_taxes()
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_move_create(self):
|
def action_move_create(self):
|
||||||
|
@ -19,6 +19,13 @@ class Partner(models.Model):
|
|||||||
('intra_state', 'intra State'),
|
('intra_state', 'intra State'),
|
||||||
('inter_country', 'Inter Country')
|
('inter_country', 'Inter Country')
|
||||||
], "Partner Location")
|
], "Partner Location")
|
||||||
|
property_account_position_id = fields.Many2one(
|
||||||
|
'account.fiscal.position',
|
||||||
|
company_dependent=True,
|
||||||
|
string="Nature of Transaction",
|
||||||
|
help="The fiscal position will determine taxes and accounts "
|
||||||
|
"used for the partner.",
|
||||||
|
oldname="property_account_position")
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.constrains('vat', 'state_id')
|
@api.constrains('vat', 'state_id')
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from operator import itemgetter
|
||||||
|
from itertools import groupby
|
||||||
import xlsxwriter
|
import xlsxwriter
|
||||||
|
from functools import reduce
|
||||||
from flectra import api, models, _
|
from flectra import api, models, _
|
||||||
|
|
||||||
|
|
||||||
@ -901,6 +903,20 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
self.write_data_worksheet_values(worksheet, inv_value, row, col)
|
self.write_data_worksheet_values(worksheet, inv_value, row, col)
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
|
def _groupby_b2cs_inv(self, invoices):
|
||||||
|
keys = ['place_supply', 'rate']
|
||||||
|
|
||||||
|
return [reduce(lambda a,b: {
|
||||||
|
"place_supply":a["place_supply"],
|
||||||
|
"rate": a['rate'], "type": a['type'],
|
||||||
|
"taxable_value":a["taxable_value"]+b["taxable_value"],
|
||||||
|
"cess_amount":a["cess_amount"]+b["cess_amount"],
|
||||||
|
"ecommerce_gstin":a["ecommerce_gstin"]},list(g))
|
||||||
|
for k, g in groupby(sorted(invoices, key=itemgetter(
|
||||||
|
*keys)), key=itemgetter(*keys))
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def sheet_b2cs(self, data, workbook, **post):
|
def sheet_b2cs(self, data, workbook, **post):
|
||||||
""" Generate excel sheet for 'b2cs' data """
|
""" Generate excel sheet for 'b2cs' data """
|
||||||
cell_format = self.cell_format(workbook=workbook, **post)
|
cell_format = self.cell_format(workbook=workbook, **post)
|
||||||
@ -909,6 +925,7 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
worksheet.set_column(0, 20, 20)
|
worksheet.set_column(0, 20, 20)
|
||||||
worksheet.protect()
|
worksheet.protect()
|
||||||
inv_ids_b2cs = self.get_data_b2cs(data=data, **post)
|
inv_ids_b2cs = self.get_data_b2cs(data=data, **post)
|
||||||
|
b2cs_data = self._groupby_b2cs_inv(inv_ids_b2cs)
|
||||||
# Calculation of header
|
# Calculation of header
|
||||||
summary = self.get_data_b2cs_summary(data=data, **post)
|
summary = self.get_data_b2cs_summary(data=data, **post)
|
||||||
row = 0
|
row = 0
|
||||||
@ -943,7 +960,7 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
worksheet, invoice_header, cell_format[
|
worksheet, invoice_header, cell_format[
|
||||||
'header_cell_format'], row, col)
|
'header_cell_format'], row, col)
|
||||||
row += 1
|
row += 1
|
||||||
for inv in inv_ids_b2cs:
|
for inv in b2cs_data:
|
||||||
inv_value = [{
|
inv_value = [{
|
||||||
'value': inv['type'],
|
'value': inv['type'],
|
||||||
'format': cell_format['regular_cell_format']},
|
'format': cell_format['regular_cell_format']},
|
||||||
@ -1142,8 +1159,9 @@ class GSTR1Report(models.AbstractModel):
|
|||||||
invoice_header = ["GSTIN/UIN of Recipient",
|
invoice_header = ["GSTIN/UIN of Recipient",
|
||||||
'Invoice/Advance Receipt Number',
|
'Invoice/Advance Receipt Number',
|
||||||
'Invoice/Advance Receipt date',
|
'Invoice/Advance Receipt date',
|
||||||
|
'Note/Refund Voucher Number',
|
||||||
'Note/Refund Voucher date',
|
'Note/Refund Voucher date',
|
||||||
'Note/Refund Voucher Number', 'Document Type',
|
'Document Type',
|
||||||
'Reason For Issuing document', "Place Of Supply",
|
'Reason For Issuing document', "Place Of Supply",
|
||||||
'Note/Refund Voucher Value',
|
'Note/Refund Voucher Value',
|
||||||
"Rate", "Taxable Value", "Cess Amount", 'Pre GST']
|
"Rate", "Taxable Value", "Cess Amount", 'Pre GST']
|
||||||
|
Loading…
Reference in New Issue
Block a user