[Fix] Is fixed asset checkbox not checked if user duplicate the existing invoice
This commit is contained in:
parent
402ffa8b29
commit
f6f503a1f6
@ -50,6 +50,16 @@ class TestAsset(unittest.TestCase):
|
|||||||
self.assertFalse(frappe.db.get_value("GL Entry",
|
self.assertFalse(frappe.db.get_value("GL Entry",
|
||||||
{"voucher_type": "Purchase Invoice", "voucher_no": pi.name}))
|
{"voucher_type": "Purchase Invoice", "voucher_no": pi.name}))
|
||||||
|
|
||||||
|
def test_is_fixed_asset_set(self):
|
||||||
|
doc = frappe.new_doc('Purchase Invoice')
|
||||||
|
doc.supplier = '_Test Supplier'
|
||||||
|
doc.append('items', {
|
||||||
|
'item_code': 'Macbook Pro',
|
||||||
|
'qty': 1
|
||||||
|
})
|
||||||
|
|
||||||
|
doc.set_missing_values()
|
||||||
|
self.assertEquals(doc.items[0].is_fixed_asset, 1)
|
||||||
|
|
||||||
def test_schedule_for_straight_line_method(self):
|
def test_schedule_for_straight_line_method(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||||
|
@ -218,6 +218,9 @@ class AccountsController(TransactionBase):
|
|||||||
if stock_qty != len(get_serial_nos(item.get('serial_no'))):
|
if stock_qty != len(get_serial_nos(item.get('serial_no'))):
|
||||||
item.set(fieldname, value)
|
item.set(fieldname, value)
|
||||||
|
|
||||||
|
if self.doctype in ["Purchase Invoice", "Sales Invoice"] and item.meta.get_field('is_fixed_asset'):
|
||||||
|
item.set('is_fixed_asset', ret.get('is_fixed_asset', 0))
|
||||||
|
|
||||||
if ret.get("pricing_rule"):
|
if ret.get("pricing_rule"):
|
||||||
# if user changed the discount percentage then set user's discount percentage ?
|
# if user changed the discount percentage then set user's discount percentage ?
|
||||||
item.set("discount_percentage", ret.get("discount_percentage"))
|
item.set("discount_percentage", ret.get("discount_percentage"))
|
||||||
|
Loading…
Reference in New Issue
Block a user