[Frappe] - Param on routes

626 views
Skip to first unread message

Maxwell Morais

unread,
Mar 11, 2014, 12:02:20 AM3/11/14
to erpnext-dev...@googlegroups.com

Hi, guys!

I’m developing a simple registration of persons, to show some differences between Django, web2py and Frappe for some friends, and I have is the following:

Doctype Person: He represents:

  • A generic person or
  • An individual or
  • A company or
  • A supplier or
  • A credit provider or
  • An Employee or
  • A goods carrier

Each variation is a form loaded in a Section Break, what I would do is:

Add a parameter called “ViewMode” in the url eg:
https://localhost.com/app.html#Form/Person/New Person 1?viewmode=Customer

And starting this parameter which manage the Section Breaks should be visible.

I just do not know how to manage URLs with frappe, someone could give me a help?

--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3

Anand Doshi

unread,
Mar 11, 2014, 1:50:43 AM3/11/14
to ERPNext Developer's Forum
Hi Max,

Instead of making separate views, you can use depends_on to hide/unhide fields based on a field's value, like Person Type.


Suppose you want to pass a default value to the person type field, so that when the user navigates to the Person form, appropriate fields are shown, you can use wn.route_options/frappe.route_options dictionary to pass the value from one route to another.

So, if you are in a list of Person's of type Supplier and you click on new, the person type will be automatically filled in the new form.

Or, if you want to create an entirely new custom view which does not use the framework's form builder, you can have a look at: https://github.com/frappe/erpnext/blob/develop/erpnext/public/js/transaction.js#L99

Thanks,
Anand.


--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CABK1YkOegNPNVToqVtJVKHBAc3OnXJ91hWWShnoohFgbSbkmcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Anand Doshi

unread,
Mar 11, 2014, 1:52:21 AM3/11/14
to ERPNext Developer's Forum
Also, to understand routing in frappe, start from here:
https://github.com/frappe/frappe/blob/develop/frappe/public/js/frappe/router.js#L95

Thanks,
Anand.

Maxwell Morais

unread,
Mar 11, 2014, 8:53:52 AM3/11/14
to erpnext-dev...@googlegroups.com

Hi, Anand!

I understand your perspective and I will use this, but, the Form (“widget”) is for me like a table, with one difference, tables represents One to Many relations, a form represents a One to One and Links represents a Many to One relation.

In my case I’m have these motivations to use a Form:

  • All person requires one or more addresses - the address showed in Person View is the primary address

  • A Individual person does not contains the same details that a Company

All persons are distincts with few details:

  • Bank:

    • Branch
    • Account
  • Company:

    • Fancy Name
    • CNPJ - Register of Legal Entities
  • Individual

    • RG - State Register of Persons
    • CPF - National Register of Persons
    • Birth Date
      …..

The idea is to partition the tables according to each segmentation of people.
This makes them slightly larger pieces, but improves standardization Database.

  • A Bank



For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages