~michael-howden/sahana-eden/taiwan

« back to all changes in this revision

Viewing changes to models/07_req.py

  • Committer: Michael Howden
  • Date: 2011-04-24 12:44:13 UTC
  • mfrom: (1612.1.163 eden)
  • Revision ID: michael@sahanafoundation.org-20110424124413-mrhnt6iewq5toxlg
MergeĀ lp:~michael-howden/sahana-eden/eden

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
        shn_component_copy_role_func(component_name = "req_req",
201
201
                                     resource_name = "org_site",
202
202
                                     fk = "site_id",
203
 
                                     pk = "site_id"),
 
203
                                     pk = "site_id")(form)
204
204
    
205
205
        # Configure the next page to go to based on the request type
206
206
        table = db.req_req
209
209
                                  create_next = URL(r=request,
210
210
                                                    c="req",
211
211
                                                    f="req",
 
212
                                                    args=["[id]", "req_item"]),)
 
213
            s3xrc.model.configure(table,
 
214
                                  update_next = URL(r=request,
 
215
                                                    c="req",
 
216
                                                    f="req",
212
217
                                                    args=["[id]", "req_item"]))
213
218
        elif form.vars.type == "2" and deployment_settings.has_module("asset"):
214
219
            s3xrc.model.configure(table,
509
514
 
510
515
                if inv_quantity and inv_quantity != NONE:
511
516
                    if inv_quantity < req_item.quantity:
512
 
                        status = REQ_STATUS_PARTIAL
 
517
                        status = SPAN(T("Partial"), _class = "req_status_partial")
513
518
                    else:
514
 
                        status = REQ_STATUS_COMPLETE
 
519
                        status = SPAN(T("YES"), _class = "req_status_complete")
515
520
                else:
516
 
                    status = REQ_STATUS_NONE
 
521
                    status = SPAN(T("NO"), _class = "req_status_none"),
517
522
 
518
523
                items.append(TR( #A(req_item.id),
519
524
                                 shn_item_represent(req_item.item_id),
528
533
                                 #shn_req_quantity_represent(req_item.quantity_fulfil, "fulfil"),
529
534
                                 #shn_req_quantity_represent(req_item.quantity_transit, "transit"),
530
535
                                 inv_quantity,
531
 
                                 req_status_opts[status],
 
536
                                 status,
532
537
                                )
533
538
                            )
534
539
                output["items"] = items
712
717
                    status_update["%s_status" % status_type] = REQ_STATUS_NONE
713
718
                else:
714
719
                    status_update["%s_status" % status_type] = REQ_STATUS_PARTIAL
715
 
            db.req_req[req_id] = status_update
 
720
            #db.req_req[req_id] = status_update <- works on web2py r3204
 
721
            db(db.req_req.id == req_id).update(**status_update)
716
722
 
717
723
        s3xrc.model.configure(table, onaccept=shn_req_item_onaccept)
718
724
 
920
926
 
921
927
 
922
928
        s3xrc.model.configure(table, onaccept = shn_commit_item_onaccept )
923
 
        
 
929
 
 
930
    #--------------------------------------------------------------------------
 
931
    def shn_show_req_tabs(r):
 
932
        """
 
933
            Add an set of Tabs for a Site's Request Tasks
 
934
        """
 
935
        if deployment_settings.has_module("req") and \
 
936
            auth.s3_has_permission("read", db.req_req):
 
937
            return [(T("Requests"), "req"),
 
938
                    (T("Match Requests"), "req_match/"), 
 
939
                    (T("Commit"), "commit")
 
940
                    ]
 
941
        else:
 
942
            return []
924
943
# END =========================================================================
 
 
b'\\ No newline at end of file'