Documentation ¶
Index ¶
Constants ¶
const CurrencyDisplayPattern = `(\w+)\s*(?:\((.*)\))?`
CurrencyDisplayPattern is the regexp pattern for displaying a currency
const (
// MODULE_NAME is the name of this module
MODULE_NAME = "base"
)
const QueueJobHoldDelay = 500 * time.Millisecond
QueueJobHoldDelay is the delay that the system waits before polling the job queue again if it has not seen any job left on the last poll.
const QueueJobPeriod = 10 * time.Millisecond
QueueJobPeriod is the delay between two polls of the job queue
Variables ¶
var ( // WarningMessage gives the possible warning that can be applied to a partner. WarningMessage = types.Selection{ "no-message": "No Message", "warning": "Warning", "block": "Blocking Message", } // WarningHelp is the help message for the Warning fields. WarningHelp = `` /* 204-byte string literal not displayed */ )
var ( // GroupSystem is given to users who are allowed to modify general settings GroupSystem *security.Group // GroupUser is the group for Employees GroupUser *security.Group // GroupMultiCurrency displays data to work in a multi-currency context GroupMultiCurrency *security.Group // GroupPartnerManager is given to users who are allowed to manage contacts GroupPartnerManager *security.Group // GroupMultiCompany displays data to work in a multi-company context GroupMultiCompany *security.Group // GroupPortal is granted to portal users GroupPortal *security.Group // GroupPublic is granted to external users GroupPublic *security.Group // GroupERPManager can modify access rights for other users GroupERPManager *security.Group // GroupTechnicalFeatures can see and modify technical parameters of the ERP GroupTechnicalFeatures *security.Group )
var CompanyDependent = models.FieldContexts{ "company": func(rs models.RecordSet) string { companyID := rs.Env().Context().GetInteger("force_company") if companyID == 0 { companyID = rs.Env().Context().GetInteger("company_id") } if companyID == 0 { return "" } return fmt.Sprintf("%d", companyID) }, }
CompanyDependent is a context to add to make a field depend on the user's current company. If a company ID is passed in the context under the key "force_company", then this company is used instead.
var QueueJobStates = types.Selection{
"pending": "Pending",
"enqueued": "Enqueued",
"started": "Started",
"done": "Done",
"failed": "Failed",
}
QueueJobStates is the selection for the states of the QueueJob model.
var SequenceFuncs = map[string]func(time.Time) string{ "doy": func(t time.Time) string { return fmt.Sprintf("%d", t.YearDay()) }, "woy": func(t time.Time) string { _, woy := t.ISOWeek() return fmt.Sprintf("%d", woy) }, "weekday": func(t time.Time) string { return fmt.Sprintf("%d", int(t.Weekday())) }, }
SequenceFuncs maps Hexya formats to functions that must be applied to a time.Time object
var Sequences = map[string]string{
"year": "2006", "month": "01", "day": "02", "y": "06",
"h24": "15", "h12": "03", "min": "04", "sec": "05",
}
Sequences maps Hexya formats to Go time format
Functions ¶
func CompanyGetUserCurrency ¶
func CompanyGetUserCurrency(env models.Environment) interface{}
CompanyGetUserCurrency returns the currency of the current user's company if it exists or the default currency otherwise
Types ¶
type AuthBackend ¶ added in v0.0.43
type AuthBackend struct{}
AuthBackend is the authentication backend of the Base module Users are authenticated against the User model in the database
func (*AuthBackend) Authenticate ¶ added in v0.0.43
func (bab *AuthBackend) Authenticate(login, secret string, context *types.Context) (uid int64, err error)
Authenticate the user defined by login and secret.