Fixtures and Doc Events (using hooks) in Frappe Framework!

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ม.ค. 2025

ความคิดเห็น • 28

  • @wreakhavocc-r4n
    @wreakhavocc-r4n 2 หลายเดือนก่อน +1

    Long Live Frappe!

  • @RitvikSardana-p6o
    @RitvikSardana-p6o ปีที่แล้ว

    Amazing Video!!
    Helped me alot in understanding fixtures and doc events

  • @ericalaribe
    @ericalaribe ปีที่แล้ว

    I tried using the export-fixtures to export certain web-hooks I created under the Webhook doctype but it didn't work for it. Is there a way to do this using the export-fixtures? If not, how can I export the webhooks? Side note: I also have two other doctypes I wanted to create fixtures for. Thanks

    • @BuildWithHussain
      @BuildWithHussain  ปีที่แล้ว

      Hey 👋
      Can you share your code that you have for fixtures?

  • @kevinwakhisi7001
    @kevinwakhisi7001 ปีที่แล้ว

    As much as this was clear i also want to track custom fields too and upon adding "Custom Fields" in the fixtures array there is an error presented. How else can this be solved?

    • @BuildWithHussain
      @BuildWithHussain  ปีที่แล้ว

      What error? Can you share?

    • @kevinwakhisi7001
      @kevinwakhisi7001 ปีที่แล้ว

      @@BuildWithHussain
      Exporting County app mauzo_link filters None
      Exporting Custom Fields app mauzo_link filters None
      Traceback (most recent call last):
      File "", line 198, in _run_module_as_main
      File "", line 88, in _run_code
      File "/workspace/development/mauzolink/apps/frappe/frappe/utils/bench_helper.py", line 114, in
      main()
      File "/workspace/development/mauzolink/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
      click.Group(commands=commands)(prog_name="bench")
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
      return self.main(*args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
      rv = self.invoke(ctx)
      ^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
      return ctx.invoke(self.callback, **ctx.params)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
      return __callback(*args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
      return f(get_current_context(), *args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/commands/__init__.py", line 29, in _func
      ret = f(frappe._dict(ctx.obj), *args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/commands/utils.py", line 369, in export_fixtures
      export_fixtures(app=app)
      File "/workspace/development/mauzolink/apps/frappe/frappe/utils/fixtures.py", line 81, in export_fixtures
      export_json(
      File "/workspace/development/mauzolink/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 287, in export_json
      for doc in frappe.get_all(
      ^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/__init__.py", line 1970, in get_all
      return get_list(doctype, *args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/__init__.py", line 1945, in get_list
      return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/model/db_query.py", line 197, in execute
      self.columns = self.get_table_columns()
      ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/model/db_query.py", line 554, in get_table_columns
      return get_table_columns(self.doctype)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/model/meta.py", line 73, in get_table_columns
      return frappe.db.get_table_columns(doctype)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/workspace/development/mauzolink/apps/frappe/frappe/database/database.py", line 1183, in get_table_columns
      raise self.TableMissingError("DocType", doctype)
      pymysql.err.ProgrammingError: ('DocType', 'Custom Fields')

    • @kevinwakhisi7001
      @kevinwakhisi7001 ปีที่แล้ว

      and the way i used the fixtures
      fixtures =[
      {
      "dt": "County",
      },
      "Custom Fields"
      ]

    • @kevinwakhisi7001
      @kevinwakhisi7001 11 หลายเดือนก่อน

      Found my error. Namimg issue

  • @NavneetJain89
    @NavneetJain89 10 หลายเดือนก่อน

    I am creating a custom app using frappe framework version 15 and my app has around 10 to 15 server scripts and around 10 reports. I want these scripts and reports to be available by default to all customers/sites. How do I go about it?

    • @BuildWithHussain
      @BuildWithHussain  10 หลายเดือนก่อน

      Why server scripts? If you are doing custom app, you can use doc_events hook instead. Reports you can mark standard to bundle with app.

  • @TahirZaqout
    @TahirZaqout ปีที่แล้ว

    is there a difference between export-fixtures & export customization (from customize doctype)
    ?

    • @BuildWithHussain
      @BuildWithHussain  ปีที่แล้ว +2

      Export fixtures is more flexible, export customisation just gives you a JSON file of the customisations, which you don’t have much control over, but in fixtures you can apply filters.

    • @TahirZaqout
      @TahirZaqout ปีที่แล้ว

      @@BuildWithHussain 🌹😍

  • @prasantpant9483
    @prasantpant9483 9 หลายเดือนก่อน

    How to export the role permission from doctype?

    • @BuildWithHussain
      @BuildWithHussain  9 หลายเดือนก่อน +1

      Role permission manager is just meant for customisation layer and cannot/should not be exported. Permissions set in doctype get added to Doctype JSON file in development.

  • @sonalinarkar6087
    @sonalinarkar6087 6 หลายเดือนก่อน

    very nicely explained

  • @omarsalama6312
    @omarsalama6312 ปีที่แล้ว

    how can custom doctype python and js standard app like Sales Order in custom app

    • @BuildWithHussain
      @BuildWithHussain  ปีที่แล้ว

      Can you please elaborate?
      If you want to customize standard doctype, you can use client scripts + doc_events.

  • @prasantpant9483
    @prasantpant9483 8 หลายเดือนก่อน

    how can i pass the doc name as parameter in doc events?

    • @BuildWithHussain
      @BuildWithHussain  8 หลายเดือนก่อน +1

      Hey 👋
      Why do you want that? You get the whole “doc” object, so you can just do doc.name, or am I getting the question wrong? 🤔

    • @prasantpant9483
      @prasantpant9483 8 หลายเดือนก่อน

      @@BuildWithHussain thanks got it

  • @AbdulmalekAlsalmi-j6v
    @AbdulmalekAlsalmi-j6v 3 หลายเดือนก่อน

    thanks

  • @SaieshRaut-b6r
    @SaieshRaut-b6r 11 หลายเดือนก่อน

    Great Video!!!
    Can you make a video explaining how to add custom buttons to frappe or erpnext doctype from an custom app that you created without making any code changes to erpnext or frappe?

    • @BuildWithHussain
      @BuildWithHussain  11 หลายเดือนก่อน

      Use client scripts and export fixtures for exporting the client scripts.

  • @talibsheikh8466
    @talibsheikh8466 ปีที่แล้ว

    Really helpful

  • @gareebsportscricket2984
    @gareebsportscricket2984 7 หลายเดือนก่อน

    Your are master men

  • @TahirZaqout
    @TahirZaqout ปีที่แล้ว

    😘🌹🌹