Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 51 additions & 3 deletions uk_vat/fixtures/custom_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"default": true,
"depends_on": null,
"description": null,
"docstatus": 0,
Expand Down Expand Up @@ -350,7 +350,7 @@
"dt": "Item Tax Template",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "vat_rules",
"fieldname": "vat_country",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
Expand All @@ -359,13 +359,61 @@
"in_list_view": 0,
"in_standard_filter": 0,
"insert_after": "vat_is_in_vat_return",
"label": "VAT Country",
"length": 0,
"mandatory_depends_on": null,
"modified": "2020-07-07 00:37:54.183648",
"name": "Item Tax Template-vat_country",
"no_copy": 0,
"options": "UK",
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Item Tax Template",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "vat_rules",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"insert_after": "vat_country",
"label": "VAT Rules",
"length": 0,
"mandatory_depends_on": null,
"modified": "2020-04-10 16:48:54.187648",
"name": "Item Tax Template-vat_rules",
"no_copy": 0,
"options": "UK\nEU\nRest of World",
"options": "Domestic\nEU\nRest of World",
"parent": null,
"parentfield": null,
"parenttype": null,
Expand Down
9 changes: 5 additions & 4 deletions uk_vat/uk_vat_return/doctype/uk_vat_return/uk_vat_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_transactions(company, invoice_type, period_start_date, period_end_date):
select invoice.name as name, ii.item_name, ii.item_code, ii.idx,
ii.base_amount, ii.item_tax_template,
tt.vat_rate, tt.vat_is_reverse_charge, tt.vat_transaction_type,
tt.vat_rules from
tt.vat_rules, tt.vat_country from
`tab{invoice_type} Invoice` invoice
inner join `tab{invoice_type} Invoice Item` ii on
ii.parent = invoice.name
Expand All @@ -75,7 +75,8 @@ def get_transactions(company, invoice_type, period_start_date, period_end_date):
invoice.docstatus = 1 and
invoice.posting_date >= %s and
invoice.posting_date <= %s and
tt.vat_is_in_vat_return = 1
tt.vat_is_in_vat_return = 1 and
tt.vat_country = 'UK'
""".format(invoice_type=invoice_type),
(period_start_date, period_end_date), as_dict=True)

Expand Down Expand Up @@ -139,7 +140,7 @@ def increment(item, field_list):
repr(sale["vat_transaction_type"]))

# UK trade
elif sale["vat_rules"]=="UK":
elif sale["vat_rules"]=="Domestic":

# Boxes 1 and 6
increment(sale, ("vatDueSales","totalValueSalesExVAT"))
Expand Down Expand Up @@ -188,7 +189,7 @@ def increment(item, field_list):
repr(purchase["vat_transaction_type"]))

# UK trade
elif purchase["vat_rules"]=="UK":
elif purchase["vat_rules"]=="Domestic":

if purchase["vat_is_reverse_charge"]:

Expand Down