mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 01:43:10 +00:00
Merge pull request #24508 from frappe/rebrand-ui
This commit is contained in:
@@ -22,6 +22,7 @@ from six import text_type
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||
from erpnext.stock.get_item_details import get_item_warehouse, _get_item_tax_template, get_item_tax_map
|
||||
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
||||
from erpnext.controllers.print_settings import set_print_templates_for_item_table, set_print_templates_for_taxes
|
||||
|
||||
class AccountMissingError(frappe.ValidationError): pass
|
||||
|
||||
@@ -31,6 +32,19 @@ class AccountsController(TransactionBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AccountsController, self).__init__(*args, **kwargs)
|
||||
|
||||
def get_print_settings(self):
|
||||
print_setting_fields = []
|
||||
items_field = self.meta.get_field('items')
|
||||
|
||||
if items_field and items_field.fieldtype == 'Table':
|
||||
print_setting_fields += ['compact_item_print', 'print_uom_after_quantity']
|
||||
|
||||
taxes_field = self.meta.get_field('taxes')
|
||||
if taxes_field and taxes_field.fieldtype == 'Table':
|
||||
print_setting_fields += ['print_taxes_with_zero_amount']
|
||||
|
||||
return print_setting_fields
|
||||
|
||||
@property
|
||||
def company_currency(self):
|
||||
if not hasattr(self, "__company_currency"):
|
||||
@@ -157,7 +171,7 @@ class AccountsController(TransactionBase):
|
||||
elif self.doctype in ("Quotation", "Purchase Order", "Sales Order"):
|
||||
self.validate_non_invoice_documents_schedule()
|
||||
|
||||
def before_print(self):
|
||||
def before_print(self, settings=None):
|
||||
if self.doctype in ['Purchase Order', 'Sales Order', 'Sales Invoice', 'Purchase Invoice',
|
||||
'Supplier Quotation', 'Purchase Receipt', 'Delivery Note', 'Quotation']:
|
||||
if self.get("group_same_items"):
|
||||
@@ -170,6 +184,9 @@ class AccountsController(TransactionBase):
|
||||
else:
|
||||
df.set("print_hide", 1)
|
||||
|
||||
set_print_templates_for_item_table(self, settings)
|
||||
set_print_templates_for_taxes(self, settings)
|
||||
|
||||
def calculate_paid_amount(self):
|
||||
if hasattr(self, "is_pos") or hasattr(self, "is_paid"):
|
||||
is_paid = self.get("is_pos") or self.get("is_paid")
|
||||
|
||||
@@ -20,16 +20,6 @@ from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
|
||||
from erpnext.stock.utils import get_incoming_rate
|
||||
|
||||
class BuyingController(StockController):
|
||||
def __setup__(self):
|
||||
if hasattr(self, "taxes"):
|
||||
self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
|
||||
"print_taxes_with_zero_amount"))
|
||||
self.flags.show_inclusive_tax_in_print = self.is_inclusive_tax()
|
||||
|
||||
self.print_templates = {
|
||||
"total": "templates/print_formats/includes/total.html",
|
||||
"taxes": "templates/print_formats/includes/taxes.html"
|
||||
}
|
||||
|
||||
def get_feed(self):
|
||||
if self.get("supplier_name"):
|
||||
|
||||
@@ -5,20 +5,34 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import cint
|
||||
|
||||
def print_settings_for_item_table(doc):
|
||||
|
||||
def set_print_templates_for_item_table(doc, settings):
|
||||
doc.print_templates = {
|
||||
"qty": "templates/print_formats/includes/item_table_qty.html"
|
||||
"items": "templates/print_formats/includes/items.html",
|
||||
}
|
||||
doc.hide_in_print_layout = ["uom", "stock_uom"]
|
||||
|
||||
doc.flags.compact_item_print = cint(frappe.db.get_single_value("Print Settings", "compact_item_print"))
|
||||
doc.child_print_templates = {
|
||||
"items": {
|
||||
"qty": "templates/print_formats/includes/item_table_qty.html",
|
||||
}
|
||||
}
|
||||
|
||||
if doc.flags.compact_item_print:
|
||||
doc.print_templates["description"] = "templates/print_formats/includes/item_table_description.html"
|
||||
doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
|
||||
if doc.meta.get_field("items"):
|
||||
doc.meta.get_field("items").hide_in_print_layout = ["uom", "stock_uom"]
|
||||
|
||||
doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
|
||||
|
||||
if settings.compact_item_print:
|
||||
doc.child_print_templates["items"]["description"] =\
|
||||
"templates/print_formats/includes/item_table_description.html"
|
||||
doc.flags.format_columns = format_columns
|
||||
|
||||
def set_print_templates_for_taxes(doc, settings):
|
||||
doc.flags.show_inclusive_tax_in_print = doc.is_inclusive_tax()
|
||||
doc.print_templates.update({
|
||||
"total": "templates/print_formats/includes/total.html",
|
||||
"taxes": "templates/print_formats/includes/taxes.html"
|
||||
})
|
||||
|
||||
def format_columns(display_columns, compact_fields):
|
||||
compact_fields = compact_fields + ["image", "item_code", "item_name"]
|
||||
final_columns = []
|
||||
|
||||
@@ -16,16 +16,6 @@ from erpnext.controllers.stock_controller import StockController
|
||||
from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
|
||||
|
||||
class SellingController(StockController):
|
||||
def __setup__(self):
|
||||
if hasattr(self, "taxes"):
|
||||
self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
|
||||
"print_taxes_with_zero_amount"))
|
||||
self.flags.show_inclusive_tax_in_print = self.is_inclusive_tax()
|
||||
|
||||
self.print_templates = {
|
||||
"total": "templates/print_formats/includes/total.html",
|
||||
"taxes": "templates/print_formats/includes/taxes.html"
|
||||
}
|
||||
|
||||
def get_feed(self):
|
||||
return _("To {0} | {1} {2}").format(self.customer_name, self.currency,
|
||||
|
||||
@@ -239,9 +239,6 @@ class calculate_taxes_and_totals(object):
|
||||
|
||||
self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"])
|
||||
|
||||
if self.doc.doctype == 'Sales Invoice' and self.doc.is_pos:
|
||||
self.doc.pos_total_qty = self.doc.total_qty
|
||||
|
||||
def calculate_taxes(self):
|
||||
self.doc.rounding_adjustment = 0
|
||||
# maintain actual tax rate based on idx
|
||||
|
||||
Reference in New Issue
Block a user